Merge remote-tracking branch 'origin/develop_master' into develop_master
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
<!-- 项目名称 -->
|
||||
<property name="PROJECT_NAME" value="adc-da" />
|
||||
<!-- 定义日志文件的存储地址,勿在 LogBack的配置中使用相对路径 -->
|
||||
<property name="LOG_HOME" value="/data/slrs/rest-system-search/logs" />
|
||||
<property name="LOG_HOME" value="/tmp/applog/pcms-rest-system" />
|
||||
<!-- <property name="LOG_HOME" value="../logs/pcms-rest" />-->
|
||||
<!-- 定义系统日志文件的存储地址,勿在 LogBack的配置中使用相对路径 -->
|
||||
<property name="LOG_HOME_SYSTEM" value="system" />
|
||||
|
||||
+112
-79
@@ -1221,7 +1221,7 @@ public class SearchCenterServiceImpl implements SearchCenterService {
|
||||
hiBuilder.field(highlightDate);
|
||||
hiBuilder.preTags("<span class='highlight-class'>");
|
||||
hiBuilder.postTags("</span>");
|
||||
updateIndex("fulltextserch",99999999,2);
|
||||
updateIndex("fulltextserch",(searchInfoEO.getPage()-1)*searchInfoEO.getPageSize(),searchInfoEO.getPageSize());
|
||||
searchRequestBuilder = client.prepareSearch("fulltextserch")
|
||||
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
|
||||
.highlighter(hiBuilder)
|
||||
@@ -1306,7 +1306,7 @@ public class SearchCenterServiceImpl implements SearchCenterService {
|
||||
String select = "";
|
||||
if (-1 != num) {
|
||||
value = searchInfoEO.getSelectValue().substring(0, num).trim().toUpperCase();
|
||||
if (dicMap.containsKey(value) && dicMap.get(value) != null && !"".equals(dicMap.get(value))){
|
||||
if (dicMap.containsKey(value.toUpperCase()) && dicMap.get(value.toUpperCase()) != null && !"".equals(dicMap.get(value.toUpperCase()))){
|
||||
select = searchInfoEO.getSelectValue().substring(num + 1).trim();
|
||||
real = value + " " + select;
|
||||
}else {
|
||||
@@ -1315,60 +1315,83 @@ public class SearchCenterServiceImpl implements SearchCenterService {
|
||||
}
|
||||
}else{
|
||||
String reg = ".*[0-9].*";
|
||||
if("-".contains(real)){
|
||||
if(real.contains("-")){
|
||||
String content = real.split("-")[0];
|
||||
value = content.replaceAll("[^(A-Za-z\\/)]", "");
|
||||
String[] valArr = value.split("\\/");
|
||||
if (valArr.length > 2) {
|
||||
value = valArr[0] + "/" + valArr[1];
|
||||
select = content.replaceAll("[^(0-9a-zA-Z\\.\\(\\(\\)\\)\\s\\/\\-\\:)]", "").replace(value,"");
|
||||
// 如果类别小写 转 大写
|
||||
Pattern pattern = Pattern.compile("^[a-zA-Z\\/]+$");
|
||||
if (pattern.matcher(value).matches()) {
|
||||
value = value.toUpperCase();
|
||||
if (dicMap.containsKey(value.toUpperCase()) && dicMap.get(value.toUpperCase()) != null && !"".equals(dicMap.get(value.toUpperCase()))) {
|
||||
String[] valArr = value.split("\\/");
|
||||
if (valArr.length > 2) {
|
||||
value = valArr[0] + "/" + valArr[1];
|
||||
if (dicMap.containsKey(value.toUpperCase()) && dicMap.get(value.toUpperCase()) != null && !"".equals(dicMap.get(value.toUpperCase()))) {
|
||||
select = content.replaceAll("[^(0-9a-zA-Z\\.\\(\\(\\)\\)\\s\\/\\-\\:)]", "").replace(value,"");
|
||||
}else {
|
||||
select = content.replaceAll("[^(0-9a-zA-Z\\.\\(\\(\\)\\)\\s\\/\\-\\:)]", "");
|
||||
}
|
||||
// 如果类别小写 转 大写
|
||||
Pattern pattern = Pattern.compile("^[a-zA-Z\\/]+$");
|
||||
if (pattern.matcher(value).matches()) {
|
||||
value = value.toUpperCase();
|
||||
}
|
||||
}else{
|
||||
value = valArr[0];
|
||||
if (dicMap.containsKey(value.toUpperCase()) && dicMap.get(value.toUpperCase()) != null && !"".equals(dicMap.get(value.toUpperCase()))) {
|
||||
select = real.replaceAll("[^(0-9a-zA-Z\\.\\(\\(\\)\\)\\s\\/\\-\\:)]", "").replace(value,"");
|
||||
}else {
|
||||
select = real.replaceAll("[^(0-9a-zA-Z\\.\\(\\(\\)\\)\\s\\/\\-\\:)]", "");
|
||||
}
|
||||
// 如果类别小写 转 大写
|
||||
Pattern pattern = Pattern.compile("^[a-zA-Z\\/]+$");
|
||||
if (pattern.matcher(value).matches()) {
|
||||
value = value.toUpperCase();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
value = valArr[0];
|
||||
select = real.replaceAll("[^(0-9a-zA-Z\\.\\(\\(\\)\\)\\s\\/\\-\\:)]", "").replace(value,"");
|
||||
// 如果类别小写 转 大写
|
||||
Pattern pattern = Pattern.compile("^[a-zA-Z\\/]+$");
|
||||
if (pattern.matcher(value).matches()) {
|
||||
value = value.toUpperCase();
|
||||
if (dicMap.containsKey(value.toUpperCase()) && dicMap.get(value.toUpperCase()) != null && !"".equals(dicMap.get(value.toUpperCase()))){
|
||||
real = value + " " + select;
|
||||
}else {
|
||||
select = real;
|
||||
value = null;
|
||||
}
|
||||
}
|
||||
if (dicMap.containsKey(value) && dicMap.get(value) != null && !"".equals(dicMap.get(value))){
|
||||
real = value + " " + select;
|
||||
}else {
|
||||
select = null;
|
||||
value = real;
|
||||
select = real;
|
||||
value = null;
|
||||
}
|
||||
}else if(real.matches(reg)){
|
||||
value = real.replaceAll("[^(A-Za-z\\/)]", "");
|
||||
String[] valArr = value.split("\\/");
|
||||
if (valArr.length > 2) {
|
||||
value = valArr[0] + "/" + valArr[1];
|
||||
String[] str = real.split(value);
|
||||
String sel = str[1].replaceAll("[^(0-9\\.\\(\\(\\)\\)\\s\\/\\-\\:)]", "");
|
||||
String[] valArr2 = sel.split("\\/");
|
||||
if(valArr2.length > 2){
|
||||
select = valArr2[0] + '/' + valArr[3] + valArr2[1];
|
||||
}else {
|
||||
select = sel;
|
||||
}
|
||||
}else{
|
||||
select = real.replaceAll("[^(0-9a-zA-Z\\.\\(\\(\\)\\)\\s\\/\\-\\:)]", "").replace(value,"");
|
||||
System.out.println(dicMap.containsKey(value.toUpperCase()));
|
||||
if (dicMap.containsKey(value.toUpperCase()) && dicMap.get(value.toUpperCase()) != null && !"".equals(dicMap.get(value.toUpperCase()))) {
|
||||
String[] valArr = value.split("\\/");
|
||||
if (valArr.length > 2) {
|
||||
value = valArr[0] + "/" + valArr[1];
|
||||
String[] str = real.split(value);
|
||||
String sel = str[1].replaceAll("[^(0-9\\.\\(\\(\\)\\)\\s\\/\\-\\:)]", "");
|
||||
String[] valArr2 = sel.split("\\/");
|
||||
if(valArr2.length > 2){
|
||||
select = valArr2[0] + '/' + valArr[3] + valArr2[1];
|
||||
}else {
|
||||
select = sel;
|
||||
}
|
||||
}else{
|
||||
if (dicMap.containsKey(value.toUpperCase()) && dicMap.get(value.toUpperCase()) != null && !"".equals(dicMap.get(value.toUpperCase()))) {
|
||||
select = real.replaceAll("[^(0-9a-zA-Z\\.\\(\\(\\)\\)\\s\\/\\-\\:)]", "").replace(value,"");
|
||||
}else {
|
||||
select = real.replaceAll("[^(0-9a-zA-Z\\.\\(\\(\\)\\)\\s\\/\\-\\:)]", "");
|
||||
}
|
||||
|
||||
// 如果类别小写 转 大写
|
||||
Pattern pattern = Pattern.compile("^[a-zA-Z\\/]+$");
|
||||
if (pattern.matcher(value).matches()) {
|
||||
value = value.toUpperCase();
|
||||
// 如果类别小写 转 大写
|
||||
Pattern pattern = Pattern.compile("^[a-zA-Z\\/]+$");
|
||||
if (pattern.matcher(value).matches()) {
|
||||
value = value.toUpperCase();
|
||||
}
|
||||
}
|
||||
if (dicMap.containsKey(value.toUpperCase()) && dicMap.get(value.toUpperCase()) != null && !"".equals(dicMap.get(value.toUpperCase()))){
|
||||
real = value + " " + select;
|
||||
}else {
|
||||
select = real;
|
||||
value = null;
|
||||
}
|
||||
}
|
||||
if (dicMap.containsKey(value) && dicMap.get(value) != null && !"".equals(dicMap.get(value))){
|
||||
real = value + " " + select;
|
||||
}else {
|
||||
select = null;
|
||||
value = real;
|
||||
select = real;
|
||||
value = null;
|
||||
}
|
||||
}else {
|
||||
value = real;
|
||||
@@ -1390,30 +1413,30 @@ public class SearchCenterServiceImpl implements SearchCenterService {
|
||||
BoolQueryBuilder boolSelectValue = new BoolQueryBuilder();
|
||||
QueryBuilder multiQueryBuilder;
|
||||
String[] selects = null;
|
||||
if (StringUtils.isNotBlank(select)) {
|
||||
//判断标准号是否企标SMTC ,标准列别 (),/,字母
|
||||
Pattern pattern = Pattern.compile("^[a-zA-Z\\/\\(\\)\\(\\)]+$");
|
||||
if (pattern.matcher(value).matches()) {
|
||||
Pattern patternbianhao = Pattern.compile("^[0-9a-zA-Z\\.\\(\\(\\)\\)\\-\\s]+$");
|
||||
if (patternbianhao.matcher(select).matches()) {
|
||||
//符合标准编号
|
||||
selects = select.replace(" ","-").split("-");
|
||||
} else {
|
||||
//不符合标准编号 使用wildcard查询 编号
|
||||
selects = select.replace(" ","-").split("-");
|
||||
}
|
||||
} else {
|
||||
//不符合标准类别,wildcard 查询整体 real 6/23 解决搜索DRE的问题
|
||||
selects = null;
|
||||
value = real;
|
||||
// isReal = true;
|
||||
}
|
||||
}else{
|
||||
//没有空格,存在问题,使用wildcard查询 real
|
||||
selects = null;
|
||||
value = real;
|
||||
// isReal = true;
|
||||
}
|
||||
// if (StringUtils.isNotBlank(select)) {
|
||||
// //判断标准号是否企标SMTC ,标准列别 (),/,字母
|
||||
// Pattern pattern = Pattern.compile("^[a-zA-Z\\/\\(\\)\\(\\)]+$");
|
||||
// if (pattern.matcher(value).matches()) {
|
||||
// Pattern patternbianhao = Pattern.compile("^[0-9a-zA-Z\\.\\(\\(\\)\\)\\-\\s]+$");
|
||||
// if (patternbianhao.matcher(select).matches()) {
|
||||
// //符合标准编号
|
||||
// selects = select.replace(" ","-").split("-");
|
||||
// } else {
|
||||
// //不符合标准编号 使用wildcard查询 编号
|
||||
// selects = select.replace(" ","-").split("-");
|
||||
// }
|
||||
// } else {
|
||||
// //不符合标准类别,wildcard 查询整体 real 6/23 解决搜索DRE的问题
|
||||
// selects = null;
|
||||
// value = real;
|
||||
//// isReal = true;
|
||||
// }
|
||||
// }else{
|
||||
// //没有空格,存在问题,使用wildcard查询 real
|
||||
// selects = null;
|
||||
// value = real;
|
||||
//// isReal = true;
|
||||
// }
|
||||
|
||||
if (isReal){
|
||||
//查询real
|
||||
@@ -1421,23 +1444,31 @@ public class SearchCenterServiceImpl implements SearchCenterService {
|
||||
selects = null;
|
||||
}
|
||||
|
||||
if(null != value || null != selects){
|
||||
if (null != value && selects == null) {
|
||||
if(null != value || null != select){
|
||||
if (null != value && select == null) {
|
||||
boolSelectValue
|
||||
.should(QueryBuilders.wildcardQuery("title.keyword", "*" + value + "*").boost(1000f))
|
||||
.should(QueryBuilders.wildcardQuery("textContent.keyword", "*" + value + "*").boost(0.0000000000000000000000000000000001f))
|
||||
.should(QueryBuilders.wildcardQuery("issue_time", "*" + value + "*"));
|
||||
.should(QueryBuilders.wildcardQuery("sortTitle.keyword", "*" + value.toUpperCase() + "*").boost(1005f))
|
||||
.should(QueryBuilders.wildcardQuery("numberTitle.keyword", "*" + value.toUpperCase() + "*").boost(1003f))
|
||||
.should(QueryBuilders.wildcardQuery("yearOrder.keyword", "*" + value.toUpperCase() + "*").boost(1002f))
|
||||
.should(QueryBuilders.wildcardQuery("nameTitle.keyword", "*" + value.toUpperCase() + "*").boost(1001f))
|
||||
.should(QueryBuilders.wildcardQuery("title.keyword", "*" + value.toUpperCase() + "*").boost(1000f))
|
||||
.should(QueryBuilders.wildcardQuery("textContent.keyword", "*" + value.toUpperCase() + "*").boost(0.0000000000000000000000000000000001f))
|
||||
.should(QueryBuilders.wildcardQuery("issue_time", "*" + value.toUpperCase() + "*"));
|
||||
// multiQueryBuilder = QueryBuilders.multiMatchQuery("*"+value+"*",
|
||||
// "title.keyword", "textContent", "issue_time").minimumShouldMatch("100%").field("title.keyword", 1000f).field("textContent.keyword", 0.0000000000000000000000000000000001f);
|
||||
//// boolQueryMust.must(multiQueryBuilder);
|
||||
// boolQueryShould.should(multiQueryBuilder);
|
||||
}
|
||||
// searchInfoEO.setSelectValue(searchInfoEO.getSelectValue().replace("-","\\-"));
|
||||
if (null != selects) {
|
||||
if (null != select) {
|
||||
boolSelectValue
|
||||
.should(QueryBuilders.wildcardQuery("title.keyword", "*" + real + "*").boost(1000f))
|
||||
.should(QueryBuilders.wildcardQuery("textContent.keyword", "*" + real + "*").boost(0.0000000000000000000000000000000001f))
|
||||
.should(QueryBuilders.wildcardQuery("issue_time", "*" + real + "*"));
|
||||
.should(QueryBuilders.wildcardQuery("sortTitle.keyword", "*" + real.toUpperCase() + "*").boost(1005f))
|
||||
.should(QueryBuilders.wildcardQuery("numberTitle.keyword", "*" + real.toUpperCase() + "*").boost(1003f))
|
||||
.should(QueryBuilders.wildcardQuery("yearOrder.keyword", "*" + real.toUpperCase() + "*").boost(1002f))
|
||||
.should(QueryBuilders.wildcardQuery("nameTitle.keyword", "*" + real.toUpperCase() + "*").boost(1001f))
|
||||
.should(QueryBuilders.wildcardQuery("title.keyword", "*" + real.toUpperCase() + "*").boost(1000f))
|
||||
.should(QueryBuilders.wildcardQuery("textContent.keyword", "*" + real.toUpperCase() + "*").boost(0.0000000000000000000000000000000001f))
|
||||
.should(QueryBuilders.wildcardQuery("issue_time", "*" + real.toUpperCase() + "*"));
|
||||
// for (String se : selects) {
|
||||
// if (StringUtils.isNotBlank(se)) {
|
||||
// boolSelectValue
|
||||
@@ -1484,10 +1515,11 @@ public class SearchCenterServiceImpl implements SearchCenterService {
|
||||
hiBuilder.preTags("<span class='highlight-class'>");
|
||||
hiBuilder.postTags("</span>");
|
||||
|
||||
updateIndex("fulltextserch",99999999,2);
|
||||
updateIndex("fulltextserch",(searchInfoEO.getPage()-1)*searchInfoEO.getPageSize(),searchInfoEO.getPageSize());
|
||||
searchRequestBuilder = client.prepareSearch("fulltextserch")
|
||||
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
|
||||
.highlighter(hiBuilder)
|
||||
.addSort("issue_time_order",SortOrder.DESC)
|
||||
.setFrom((searchInfoEO.getPage()-1)*searchInfoEO.getPageSize())
|
||||
.setSize(searchInfoEO.getPageSize());
|
||||
|
||||
@@ -1554,6 +1586,7 @@ public class SearchCenterServiceImpl implements SearchCenterService {
|
||||
AcknowledgedResponse indexResponse = client.admin().indices()
|
||||
.prepareUpdateSettings(indices)
|
||||
.setSettings(Settings.builder()
|
||||
.put("index.max_result_window", records)
|
||||
.put("highlight.max_analyzed_offset", records)
|
||||
.build()
|
||||
).get();
|
||||
|
||||
+10
@@ -226,6 +226,9 @@ public class StandLawsSearchServiceImpl implements StandLawsSearchService {
|
||||
StringBuilder textContent = replaceAll(contentBuilder, "null", "--");
|
||||
fullTextSearchEO.put("textContent",textContent.toString());
|
||||
fullTextSearchEO.put("yearOrder", String.valueOf(attrInfoMap.get("standYear")));
|
||||
fullTextSearchEO.put("sortTitle", String.valueOf(attrInfoMap.get("standSort")));
|
||||
fullTextSearchEO.put("numberTitle", String.valueOf(attrInfoMap.get("standNumber")));
|
||||
fullTextSearchEO.put("nameTitle", String.valueOf(attrInfoMap.get("standName")));
|
||||
|
||||
// 全文检索 加入 发布稿 分解单条款内容逻辑
|
||||
StringBuilder itemBuilder = new StringBuilder();
|
||||
@@ -300,6 +303,9 @@ public class StandLawsSearchServiceImpl implements StandLawsSearchService {
|
||||
StringBuilder textContent = replaceAll(contentBuilder, "null", "--");
|
||||
fullTextSearchEO.put("textContent",textContent.toString());
|
||||
fullTextSearchEO.put("yearOrder", String.valueOf(attrInfoMap.get("lawsYearName")));
|
||||
fullTextSearchEO.put("sortTitle", String.valueOf(attrInfoMap.get("lawsTypeName")));
|
||||
fullTextSearchEO.put("numberTitle", String.valueOf(attrInfoMap.get("lawsNumber")));
|
||||
fullTextSearchEO.put("nameTitle", String.valueOf(attrInfoMap.get("lawsName")));
|
||||
|
||||
if (null != attrInfoMap.get("issueTime") && !"".equals(attrInfoMap.get("issueTime")) && !"null".equals(attrInfoMap.get("issueTime"))) {
|
||||
fullTextSearchEO.put("issue_time", dateFormatToStr(String.valueOf(attrInfoMap.get("issueTime"))));
|
||||
@@ -355,6 +361,10 @@ public class StandLawsSearchServiceImpl implements StandLawsSearchService {
|
||||
StringBuilder textContent = replaceAll(contentBuilder, "null", "--");
|
||||
fullTextSearchEO.put("textContent",textContent.toString());
|
||||
fullTextSearchEO.put("yearOrder", String.valueOf(attrInfoMap.get("standYear")));
|
||||
fullTextSearchEO.put("sortTitle", String.valueOf(attrInfoMap.get("standSort")));
|
||||
fullTextSearchEO.put("numberTitle", String.valueOf(attrInfoMap.get("standNumber")));
|
||||
fullTextSearchEO.put("nameTitle", String.valueOf(attrInfoMap.get("stand_name")));
|
||||
|
||||
if (null != attrInfoMap.get("issueTime") && !"".equals(attrInfoMap.get("issueTime")) && !"null".equals(attrInfoMap.get("issueTime"))) {
|
||||
fullTextSearchEO.put("issue_time", dateFormatToStr(String.valueOf(attrInfoMap.get("issueTime"))));
|
||||
fullTextSearchEO.put("issue_time_order", dateFormatToStr(String.valueOf(attrInfoMap.get("issueTime"))).replace("-",""));
|
||||
|
||||
@@ -131,7 +131,12 @@ public class SendBussMQService {
|
||||
}
|
||||
saveMap.put("standYear",infoEO.getStandYear());
|
||||
saveMap.put("stand_year",infoEO.getStandYear());
|
||||
saveMap.put("standNumber",infoEO.getStandCode());
|
||||
if(jsonobject.get("standNumber") != null){
|
||||
saveMap.put("standNumber",jsonobject.get("standNumber"));
|
||||
}else {
|
||||
saveMap.put("standNumber","");
|
||||
}
|
||||
|
||||
saveMap.put("stand_code",infoEO.getStandCode());
|
||||
saveMap = dealNumberMsg(saveMap,infoEO,infoEO.getStandSort());
|
||||
saveMap.put("nameshow",infoEO.getStandName());
|
||||
|
||||
@@ -44,9 +44,6 @@ public class ResetSearchCenterController extends BaseController<Map<String, Obje
|
||||
return Result.error("执行参数 ALL 存在更新 不存在新增 ,UPD 只 更新存在 es 里的标准 ,ADD 只新增不存在 es 的标准, DEL 只删除不存在标准库的数据");
|
||||
}
|
||||
|
||||
if(searchCenter.getCountStand() == null || searchCenter.getCountStand() == 0){
|
||||
return Result.error("分页总数不可为空和0");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,12 +15,11 @@ import java.util.List;
|
||||
@Data
|
||||
public class SearchCenter {
|
||||
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "分页查询总数")
|
||||
private Integer countStand;
|
||||
// @ApiModelProperty(value = "分页查询总数 可不填 自动带入总数")
|
||||
// private Integer countStand;
|
||||
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "执行参数 ALL 存在更新 不存在新增 ,UPD 只 更新存在 es 里的标准 ,ADD 只新增不存在 es 的标准, DEL 只删除不存在标准库的数据")
|
||||
@ApiModelProperty(value = "执行参数 ALL 存在更新 不存在新增 ,UPD 只 更新存在 es 里的标准 ,ADD 只新增不存在 es 的标准, DEL 只删除不存在标准库的数据(删除只能用DEL 减少自动错删)")
|
||||
private String execType;
|
||||
|
||||
@NotNull
|
||||
|
||||
+489
-154
@@ -1,27 +1,42 @@
|
||||
package com.adc.da.search.server;
|
||||
|
||||
import com.adc.da.att.entity.AttFileEO;
|
||||
import com.adc.da.att.service.IAttFileEOService;
|
||||
import com.adc.da.mq.CreateStandMQService;
|
||||
import com.adc.da.person.service.IPersonCollectEOService;
|
||||
import com.adc.da.search.bean.SearchCenter;
|
||||
import com.adc.da.search.service.ElasticsearchService;
|
||||
import com.adc.da.slrs.sarBussStandAttrInfo.dao.SarBussStandAttrInfoDao;
|
||||
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
|
||||
import com.adc.da.slrs.sarBussionessStand.service.ISarBussionessStandService;
|
||||
import com.adc.da.slrs.sarLawsAttrInfo.dao.SarLawsAttrInfoDao;
|
||||
import com.adc.da.slrs.sarLawsInfo.entity.SarLawsInfo;
|
||||
import com.adc.da.slrs.sarLawsInfo.page.SarLawsInfoEOPage;
|
||||
import com.adc.da.slrs.sarLawsItems.dao.SarLawsItemsDao;
|
||||
import com.adc.da.slrs.sarLawsItems.entity.SarLawsItems;
|
||||
import com.adc.da.slrs.sarLawsStandInfo.entity.SarLawsStandInfo;
|
||||
import com.adc.da.slrs.sarLawsStandInfo.entity.SarLawsStandInfoPage;
|
||||
import com.adc.da.slrs.sarLawsStandInfo.service.ISarLawsStandInfoService;
|
||||
import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao;
|
||||
import com.adc.da.slrs.sarStandItems.dao.SarStandItemsDao;
|
||||
import com.adc.da.slrs.sarStandItems.entity.FindSarItemsPageReqDTO;
|
||||
import com.adc.da.slrs.sarStandItems.entity.SarStandItems;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfoEOPage;
|
||||
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
|
||||
import com.adc.da.sys.dao.DicTypeEODao;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import com.adc.da.utils.util.DateUtil;
|
||||
import com.adc.da.utils.util.FieldConvertUtil;
|
||||
import com.adc.da.utils.util.InitStandAttrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.google.gson.JsonObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.elasticsearch.client.transport.TransportClient;
|
||||
import org.json.JSONTokener;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -31,6 +46,7 @@ import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.sql.Clob;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -48,6 +64,21 @@ public class ResetSearchCenterService {
|
||||
@Autowired
|
||||
private TransportClient client;
|
||||
|
||||
@Autowired
|
||||
private DicTypeEODao dicTypeEODao;
|
||||
|
||||
@Autowired
|
||||
private SarStandItemsDao standItemsDao;
|
||||
|
||||
@Autowired
|
||||
private SarLawsItemsDao sarLawsItemsDao;
|
||||
|
||||
@Autowired
|
||||
private IAttFileEOService attFileEOService;
|
||||
|
||||
@Autowired
|
||||
private SarLawsAttrInfoDao sarLawsAttrInfoDao;
|
||||
|
||||
@Autowired
|
||||
private ISarStandardsInfoService iSarStandardsInfoService;
|
||||
|
||||
@@ -60,6 +91,15 @@ public class ResetSearchCenterService {
|
||||
@Autowired
|
||||
private CreateStandMQService createStandMQService;
|
||||
|
||||
@Autowired
|
||||
private IPersonCollectEOService personCollectEOService;
|
||||
|
||||
@Autowired
|
||||
private SarStandAttrInfoDao sarStandAttrInfoEODao;
|
||||
|
||||
@Autowired
|
||||
private SarBussStandAttrInfoDao sarBussStandAttrInfoEODao;
|
||||
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
@@ -69,19 +109,36 @@ public class ResetSearchCenterService {
|
||||
@Async
|
||||
public ResponseMessage resetALLSearchCenter(SearchCenter searchCenter) throws Exception{
|
||||
Boolean getFulltextserchIndex = elasticsearchService.isIndexExist("fulltextserch");
|
||||
|
||||
ResponseMessage stand = resetStandSearchCenter(new SarStandardsInfoEOPage(),searchCenter);
|
||||
SearchCenter standSearch = new SearchCenter();
|
||||
standSearch.setExecType(searchCenter.getExecType());
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
|
||||
standSearch.setIdList(searchCenter.getIdList());
|
||||
}
|
||||
SarStandardsInfoEOPage page = new SarStandardsInfoEOPage();
|
||||
ResponseMessage stand = resetStandSearchCenter(page,standSearch);
|
||||
List<String> r = new ArrayList<>();
|
||||
if(stand.isOk() && StringUtils.isNotBlank(stand.getData().toString())){
|
||||
r.add(stand.getData().toString());
|
||||
}
|
||||
|
||||
ResponseMessage laws = resetLawsSearchCenter(new SarLawsStandInfoPage(),searchCenter);
|
||||
SearchCenter lawsSearch = new SearchCenter();
|
||||
lawsSearch.setExecType(searchCenter.getExecType());
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
|
||||
lawsSearch.setIdList(searchCenter.getIdList());
|
||||
}
|
||||
SarLawsStandInfoPage lawsPage = new SarLawsStandInfoPage();
|
||||
ResponseMessage laws = resetLawsSearchCenter(lawsPage,lawsSearch);
|
||||
if(laws.isOk() && StringUtils.isNotBlank(laws.getData().toString())){
|
||||
r.add(laws.getData().toString());
|
||||
}
|
||||
|
||||
ResponseMessage buss = resetBussStandSearchCenter(new SarBussionessStandEOPage(),searchCenter);
|
||||
SearchCenter bussSearch = new SearchCenter();
|
||||
bussSearch.setExecType(searchCenter.getExecType());
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty()){
|
||||
bussSearch.setIdList(searchCenter.getIdList());
|
||||
}
|
||||
SarBussionessStandEOPage bussPage = new SarBussionessStandEOPage();
|
||||
ResponseMessage buss = resetBussStandSearchCenter(bussPage,bussSearch);
|
||||
if(buss.isOk() && StringUtils.isNotBlank(buss.getData().toString())){
|
||||
r.add(buss.getData().toString());
|
||||
}
|
||||
@@ -96,11 +153,7 @@ public class ResetSearchCenterService {
|
||||
public ResponseMessage syncResetALLSearchCenter(SearchCenter searchCenter) throws Exception{
|
||||
Boolean getFulltextserchIndex = elasticsearchService.isIndexExist("fulltextserch");
|
||||
SearchCenter standSearch = new SearchCenter();
|
||||
QueryWrapper qw = new QueryWrapper();
|
||||
qw.eq("VALID_FLAG","0");
|
||||
int count = iSarStandardsInfoService.count(qw);
|
||||
standSearch.setExecType(searchCenter.getExecType());
|
||||
standSearch.setCountStand(count);
|
||||
SarStandardsInfoEOPage page = new SarStandardsInfoEOPage();
|
||||
page.setSyncParam("sync");
|
||||
ResponseMessage stand = resetStandSearchCenter(page,standSearch);
|
||||
@@ -110,11 +163,7 @@ public class ResetSearchCenterService {
|
||||
}
|
||||
|
||||
SearchCenter lawsSearch = new SearchCenter();
|
||||
QueryWrapper qw2 = new QueryWrapper();
|
||||
qw2.eq("VALID_FLAG","0");
|
||||
int count2 = iSarLawsStandInfoService.count(qw2);
|
||||
lawsSearch.setExecType(searchCenter.getExecType());
|
||||
lawsSearch.setCountStand(count2);
|
||||
SarLawsStandInfoPage lawsPage = new SarLawsStandInfoPage();
|
||||
page.setSyncParam("sync");
|
||||
ResponseMessage laws = resetLawsSearchCenter(lawsPage,lawsSearch);
|
||||
@@ -123,11 +172,7 @@ public class ResetSearchCenterService {
|
||||
}
|
||||
|
||||
SearchCenter bussSearch = new SearchCenter();
|
||||
QueryWrapper qw3 = new QueryWrapper();
|
||||
qw3.eq("VALID_FLAG","0");
|
||||
int count3 = iSarBussionessStandService.count(qw3);
|
||||
bussSearch.setExecType(searchCenter.getExecType());
|
||||
bussSearch.setCountStand(count3);
|
||||
SarBussionessStandEOPage bussPage = new SarBussionessStandEOPage();
|
||||
page.setSyncParam("sync");
|
||||
ResponseMessage buss = resetBussStandSearchCenter(bussPage,bussSearch);
|
||||
@@ -164,67 +209,161 @@ public class ResetSearchCenterService {
|
||||
String[] result = searchCenter.getIdList().toArray(new String[0]);
|
||||
page.setIdlist(result);
|
||||
}
|
||||
QueryWrapper qw = new QueryWrapper();
|
||||
qw.eq("VALID_FLAG","0");
|
||||
int count = iSarStandardsInfoService.count(qw);
|
||||
if(count > 0){
|
||||
page.setPageSize(count);
|
||||
page.setMenuId("nomenu");
|
||||
page.setStandType("ALL");
|
||||
List<SarStandardsInfo> rowsStand = iSarStandardsInfoService.getSarStandardsInfoPage(page);
|
||||
List<SarStandardsInfo> insList = new ArrayList<>();
|
||||
List<SarStandardsInfo> updList = new ArrayList<>();
|
||||
List<String> delList = new ArrayList<>();
|
||||
List<String> standIdList = rowsStand.stream().map(SarStandardsInfo::getId).collect(Collectors.toList());
|
||||
if(!esIdList.isEmpty()){
|
||||
|
||||
page.setPageSize(searchCenter.getCountStand());
|
||||
page.setMenuId("nomenu");
|
||||
page.setStandType("ALL");
|
||||
List<SarStandardsInfo> rowsStand = iSarStandardsInfoService.getSarStandardsInfoPage(page);
|
||||
List<SarStandardsInfo> insList = new ArrayList<>();
|
||||
List<SarStandardsInfo> updList = new ArrayList<>();
|
||||
List<String> delList = new ArrayList<>();
|
||||
List<String> standIdList = rowsStand.stream().map(SarStandardsInfo::getId).collect(Collectors.toList());
|
||||
if(!esIdList.isEmpty()){
|
||||
// 差集 (list1 - list2) 新增
|
||||
List<SarStandardsInfo> distinctByUniqueList = rowsStand.stream()
|
||||
.filter(item -> !new ArrayList<>(esIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !distinctByUniqueList.isEmpty()){
|
||||
List<SarStandardsInfo> collect = distinctByUniqueList.stream()
|
||||
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
|
||||
insList.addAll(collect);
|
||||
}else{
|
||||
insList.addAll(distinctByUniqueList);
|
||||
}
|
||||
|
||||
// 差集 (list1 - list2) 新增
|
||||
List<SarStandardsInfo> distinctByUniqueList = rowsStand.stream()
|
||||
.filter(item -> !new ArrayList<>(esIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
insList.addAll(distinctByUniqueList);
|
||||
// 交集 更新
|
||||
List<SarStandardsInfo> intersection = rowsStand.stream()
|
||||
.filter(item -> new ArrayList<>(esIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !intersection.isEmpty()){
|
||||
List<SarStandardsInfo> collect = intersection.stream()
|
||||
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
|
||||
updList.addAll(collect);
|
||||
}else{
|
||||
updList.addAll(intersection);
|
||||
}
|
||||
|
||||
// 交集 更新
|
||||
List<SarStandardsInfo> intersection = rowsStand.stream()
|
||||
.filter(item -> new ArrayList<>(esIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
updList.addAll(intersection);
|
||||
// 差集 (list2 - list1) 删除
|
||||
List<String> delDataList = esIdList.stream().filter(num -> !standIdList.contains(num))
|
||||
.collect(Collectors.toList());
|
||||
// 可以更新IDLIST 删除 ES
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && "DEL".equals(searchCenter.getExecType().toUpperCase())){
|
||||
delList.addAll(searchCenter.getIdList());
|
||||
}else{
|
||||
delList.addAll(delDataList);
|
||||
}
|
||||
|
||||
// 差集 (list2 - list1) 删除
|
||||
List<String> delDataList = esIdList.stream().filter(num -> !standIdList.contains(num))
|
||||
.collect(Collectors.toList());
|
||||
delList.addAll(delDataList);
|
||||
}else {
|
||||
// 新增
|
||||
insList.addAll(rowsStand);
|
||||
}
|
||||
|
||||
if(!updList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "UPD".equals(searchCenter.getExecType().toUpperCase()))){
|
||||
for(SarStandardsInfo sarStandardsInfoEO : updList){
|
||||
countUpdateSuccess++;
|
||||
standFunc(sarStandardsInfoEO);
|
||||
createStandMQService.sendStandMQ(sarStandardsInfoEO,"update");
|
||||
}
|
||||
}
|
||||
|
||||
if(!insList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "ADD".equals(searchCenter.getExecType().toUpperCase()))){
|
||||
for(SarStandardsInfo sarStandardsInfoEO : insList){
|
||||
countAddSuccess++;
|
||||
standFunc(sarStandardsInfoEO);
|
||||
if (sarStandardsInfoEO.getAttrInfoMap() != null) {
|
||||
sarStandardsInfoEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarStandardsInfoEO.getAttrInfoMap()));
|
||||
}
|
||||
createStandMQService.sendStandMQ(sarStandardsInfoEO,"add");
|
||||
}
|
||||
}
|
||||
|
||||
if(!delList.isEmpty() && ("DEL".equals(searchCenter.getExecType().toUpperCase()))){
|
||||
elasticsearchService.deleteBatchId(delList,"stand");
|
||||
elasticsearchService.deleteBatchId(delList,"fulltextserch");
|
||||
logger.info("重置国内外标准:删除-共"+delList.size()+"条数据");
|
||||
}
|
||||
logger.info("重置国内外标准:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(国内外标准共:"+0+"条)删除-共"+delList.size()+"条数据");
|
||||
return Result.success("重置国内外标准:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(国内外标准共:"+0+"条)删除-共"+delList.size()+"条数据");
|
||||
}else {
|
||||
// 新增
|
||||
insList.addAll(rowsStand);
|
||||
logger.info("未查询到标准数据");
|
||||
return Result.error("未查询到标准数据");
|
||||
}
|
||||
|
||||
if(!updList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "UPD".equals(searchCenter.getExecType().toUpperCase()))){
|
||||
for(SarStandardsInfo sarStandardsInfoEO : updList){
|
||||
countUpdateSuccess++;
|
||||
if (sarStandardsInfoEO.getAttrInfoMap() != null) {
|
||||
sarStandardsInfoEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarStandardsInfoEO.getAttrInfoMap()));
|
||||
}
|
||||
|
||||
private void standFunc(SarStandardsInfo sarStandardsInfoEO) throws Exception {
|
||||
attrInfoSearchDetails(sarStandardsInfoEO);
|
||||
FindSarItemsPageReqDTO pageInfo = new FindSarItemsPageReqDTO();
|
||||
pageInfo.setStandId(sarStandardsInfoEO.getId());
|
||||
pageInfo.setFileType("FBGBJBD");
|
||||
|
||||
/**
|
||||
* SarItemVO换为sarItemVOS
|
||||
* List<SarItemVO> sarItemVOS = standItemsDao.querySarItemAndInterpretation(pageInfo);
|
||||
* .collect(Collectors.toMap(SarItemVO::getItemsNum, SarItemVO::getItemsName));
|
||||
*/
|
||||
|
||||
List<SarStandItems> sarItemVOS = standItemsDao.querySarItemAndInterpretation(pageInfo);
|
||||
if (!sarItemVOS.isEmpty()) {
|
||||
Map<String, String> collectMap = sarItemVOS.stream().filter((e) -> e.getItemsNum() != null && e.getItemsName() != null)
|
||||
.collect(Collectors.toMap(SarStandItems::getItemsNum, SarStandItems::getTermsConditions));
|
||||
sarStandardsInfoEO.setMapItems(collectMap);
|
||||
}
|
||||
if (sarStandardsInfoEO.getAttrInfoMap() != null) {
|
||||
sarStandardsInfoEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarStandardsInfoEO.getAttrInfoMap()));
|
||||
}
|
||||
}
|
||||
|
||||
public void attrInfoSearchDetails(SarStandardsInfo row) throws Exception {
|
||||
if (row != null) {
|
||||
String fieldInfo = InitStandAttrUtil.queryField;
|
||||
String collectId = personCollectEOService.queryCollectByUserAndId(row.getId());
|
||||
row.setCollectId(collectId);
|
||||
// 查询属性表数据
|
||||
if (StringUtils.isNotBlank(fieldInfo)) {
|
||||
Map<String, Object> getAttrMap = sarStandAttrInfoEODao.selectStandFieldAndData(fieldInfo, row.getId());
|
||||
if (InitStandAttrUtil.clobFieldList != null && !InitStandAttrUtil.clobFieldList.isEmpty()) {
|
||||
// 遍历修改所有clob类型的值
|
||||
for (String clobField : InitStandAttrUtil.clobFieldList) {
|
||||
Clob clobValue = (Clob) getAttrMap.get(clobField);
|
||||
String fieldValue = FieldConvertUtil.ClobToString(clobValue);
|
||||
getAttrMap.put(clobField, fieldValue);
|
||||
}
|
||||
}
|
||||
|
||||
row.setAttrInfoMap(getAttrMap);
|
||||
}
|
||||
|
||||
Map<String, Object> getAttrMap = row.getAttrInfoMap();
|
||||
if (getAttrMap != null && getAttrMap.size() > 0) {
|
||||
for (Map.Entry<String, Object> entry : getAttrMap.entrySet()) {
|
||||
String name = entry.getKey();
|
||||
String value = "";
|
||||
List<String> valArr = new ArrayList<>();
|
||||
if (entry.getValue() != null && InitStandAttrUtil.selectionFieldList != null && InitStandAttrUtil.selectionFieldList.size() > 0 && InitStandAttrUtil.selectionFieldList.contains(name)) {
|
||||
if (StringUtils.isNotBlank(entry.getValue().toString())) {
|
||||
Object json = new JSONTokener(entry.getValue().toString()).nextValue();
|
||||
if (json instanceof org.json.JSONArray) {
|
||||
valArr = com.alibaba.fastjson.JSONObject.parseArray(entry.getValue().toString(), String.class);
|
||||
} else {
|
||||
value = entry.getValue().toString();
|
||||
valArr = Arrays.asList(value.split(","));
|
||||
}
|
||||
if (!valArr.isEmpty()) {
|
||||
value = dicTypeEODao.getDicNamesByCodes(valArr, "");
|
||||
}
|
||||
}
|
||||
entry.setValue(value);
|
||||
}
|
||||
}
|
||||
createStandMQService.sendStandMQ(sarStandardsInfoEO,"update");
|
||||
}
|
||||
}
|
||||
|
||||
if(!insList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "ADD".equals(searchCenter.getExecType().toUpperCase()))){
|
||||
for(SarStandardsInfo sarStandardsInfoEO : insList){
|
||||
countAddSuccess++;
|
||||
if (sarStandardsInfoEO.getAttrInfoMap() != null) {
|
||||
sarStandardsInfoEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarStandardsInfoEO.getAttrInfoMap()));
|
||||
}
|
||||
createStandMQService.sendStandMQ(sarStandardsInfoEO,"add");
|
||||
}
|
||||
}
|
||||
|
||||
if(!delList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "DEL".equals(searchCenter.getExecType().toUpperCase()))){
|
||||
elasticsearchService.deleteBatchId(delList,"stand");
|
||||
elasticsearchService.deleteBatchId(delList,"fulltextserch");
|
||||
}
|
||||
logger.info("重置国内外标准:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(国内外标准共:"+0+"条)删除-共"+delList.size()+"条数据");
|
||||
return Result.success("重置国内外标准:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(国内外标准共:"+0+"条)删除-共"+delList.size()+"条数据");
|
||||
}
|
||||
|
||||
@Async
|
||||
@@ -247,66 +386,183 @@ public class ResetSearchCenterService {
|
||||
|
||||
int countUpdateSuccess = 0;
|
||||
int countAddSuccess = 0;
|
||||
sarLawsInfoEOPage.setPageSize(searchCenter.getCountStand());
|
||||
List<SarLawsStandInfo> rowsStand = iSarLawsStandInfoService.getSarStandardsInfoPage(sarLawsInfoEOPage);
|
||||
List<SarLawsStandInfo> insList = new ArrayList<>();
|
||||
List<SarLawsStandInfo> updList = new ArrayList<>();
|
||||
List<String> delList = new ArrayList<>();
|
||||
List<String> standIdList = rowsStand.stream().map(SarLawsStandInfo::getId).collect(Collectors.toList());
|
||||
QueryWrapper qw2 = new QueryWrapper();
|
||||
qw2.eq("VALID_FLAG","0");
|
||||
int count2 = iSarLawsStandInfoService.count(qw2);
|
||||
if(count2 > 0){
|
||||
sarLawsInfoEOPage.setPageSize(count2);
|
||||
List<SarLawsStandInfo> rowsStand = iSarLawsStandInfoService.getSarStandardsInfoPage(sarLawsInfoEOPage);
|
||||
List<SarLawsStandInfo> insList = new ArrayList<>();
|
||||
List<SarLawsStandInfo> updList = new ArrayList<>();
|
||||
List<String> delList = new ArrayList<>();
|
||||
List<String> standIdList = rowsStand.stream().map(SarLawsStandInfo::getId).collect(Collectors.toList());
|
||||
|
||||
if(!esIdList.isEmpty()){
|
||||
if(!esIdList.isEmpty()){
|
||||
|
||||
// 差集 (list1 - list2) 新增
|
||||
List<SarLawsStandInfo> distinctByUniqueList = rowsStand.stream()
|
||||
.filter(item -> !new ArrayList<>(esIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
insList.addAll(distinctByUniqueList);
|
||||
// 差集 (list1 - list2) 新增
|
||||
List<SarLawsStandInfo> distinctByUniqueList = rowsStand.stream()
|
||||
.filter(item -> !new ArrayList<>(esIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !distinctByUniqueList.isEmpty()){
|
||||
List<SarLawsStandInfo> collect = distinctByUniqueList.stream()
|
||||
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
|
||||
insList.addAll(collect);
|
||||
}else{
|
||||
insList.addAll(distinctByUniqueList);
|
||||
}
|
||||
// 交集 更新
|
||||
List<SarLawsStandInfo> intersection = rowsStand.stream()
|
||||
.filter(item -> new ArrayList<>(esIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !intersection.isEmpty()){
|
||||
List<SarLawsStandInfo> collect = intersection.stream()
|
||||
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
|
||||
updList.addAll(collect);
|
||||
}else{
|
||||
updList.addAll(intersection);
|
||||
}
|
||||
|
||||
// 交集 更新
|
||||
List<SarLawsStandInfo> intersection = rowsStand.stream()
|
||||
.filter(item -> new ArrayList<>(esIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
updList.addAll(intersection);
|
||||
// 差集 (list2 - list1) 删除
|
||||
List<String> delDataList = esIdList.stream().filter(num -> !standIdList.contains(num))
|
||||
.collect(Collectors.toList());
|
||||
// 可以更新IDLIST 删除 ES
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && "DEL".equals(searchCenter.getExecType().toUpperCase())){
|
||||
delList.addAll(searchCenter.getIdList());
|
||||
}else{
|
||||
delList.addAll(delDataList);
|
||||
}
|
||||
|
||||
// 差集 (list2 - list1) 删除
|
||||
List<String> delDataList = esIdList.stream().filter(num -> !standIdList.contains(num))
|
||||
.collect(Collectors.toList());
|
||||
delList.addAll(delDataList);
|
||||
}else {
|
||||
// 新增
|
||||
insList.addAll(rowsStand);
|
||||
}
|
||||
|
||||
if(!updList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "UPD".equals(searchCenter.getExecType().toUpperCase()))){
|
||||
for(SarLawsStandInfo sarLawsInfoEO : updList){
|
||||
countUpdateSuccess++;
|
||||
lawsAttrInfoShowSearchDetails(sarLawsInfoEO);
|
||||
createStandMQService.sendLawsMQ(sarLawsInfoEO,"update");
|
||||
}
|
||||
}
|
||||
|
||||
if(!insList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "ADD".equals(searchCenter.getExecType().toUpperCase()))){
|
||||
for(SarLawsStandInfo sarLawsInfoEO : insList){
|
||||
countAddSuccess++;
|
||||
lawsAttrInfoShowSearchDetails(sarLawsInfoEO);
|
||||
FindSarItemsPageReqDTO pageInfo = new FindSarItemsPageReqDTO();
|
||||
pageInfo.setStandId(sarLawsInfoEO.getId());
|
||||
pageInfo.setFileType("FBGBJBD");
|
||||
|
||||
/**
|
||||
* SarItemVO换为sarItemVOS
|
||||
* List<SarItemVO> sarItemVOS = standItemsDao.querySarItemAndInterpretation(pageInfo);
|
||||
* .collect(Collectors.toMap(SarItemVO::getItemsNum, SarItemVO::getItemsName));
|
||||
*/
|
||||
|
||||
List<SarLawsItems> sarItemVOS = sarLawsItemsDao.querySarItemAndInterpretation(pageInfo);
|
||||
if(!sarItemVOS.isEmpty()){
|
||||
Map<String,String> collectMap = sarItemVOS.stream().filter((e) -> e.getItemsNum() != null && e.getItemsName() != null)
|
||||
.collect(Collectors.toMap(SarLawsItems::getItemsNum, SarLawsItems::getTermsConditions));
|
||||
sarLawsInfoEO.setMapItems(collectMap);
|
||||
}
|
||||
if (sarLawsInfoEO.getAttrInfoMap() != null) {
|
||||
sarLawsInfoEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarLawsInfoEO.getAttrInfoMap()));
|
||||
}
|
||||
if (sarLawsInfoEO.getAttrInfoMap() != null) {
|
||||
sarLawsInfoEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarLawsInfoEO.getAttrInfoMap()));
|
||||
}
|
||||
createStandMQService.sendLawsMQ(sarLawsInfoEO,"add");
|
||||
}
|
||||
}
|
||||
|
||||
if(!delList.isEmpty() && ("DEL".equals(searchCenter.getExecType().toUpperCase()))){
|
||||
elasticsearchService.deleteBatchId(delList,"laws");
|
||||
elasticsearchService.deleteBatchId(delList,"fulltextserch");
|
||||
logger.info("重置国内外政策:删除-共"+delList.size()+"条数据");
|
||||
}
|
||||
|
||||
logger.info("重置国内外政策:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(国内外政策共:"+rowsStand.size()+"条)数据");
|
||||
return Result.success("");
|
||||
}else {
|
||||
// 新增
|
||||
insList.addAll(rowsStand);
|
||||
logger.info("未查询到国内外政策数据");
|
||||
return Result.error("未查询到国内外政策数据");
|
||||
}
|
||||
|
||||
if(!updList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "UPD".equals(searchCenter.getExecType().toUpperCase()))){
|
||||
for(SarLawsStandInfo sarLawsInfoEO : updList){
|
||||
countUpdateSuccess++;
|
||||
if (sarLawsInfoEO.getAttrInfoMap() != null) {
|
||||
sarLawsInfoEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarLawsInfoEO.getAttrInfoMap()));
|
||||
}
|
||||
|
||||
public void lawsAttrInfoSearchDetails(SarLawsStandInfo row) throws Exception {
|
||||
String fieldInfo = InitStandAttrUtil.queryFieldLaws;
|
||||
String collectId = personCollectEOService.queryCollectByUserAndId(row.getId());
|
||||
row.setCollectId(collectId);
|
||||
// 查询属性表数据
|
||||
if (org.apache.commons.lang.StringUtils.isNotBlank(fieldInfo)) {
|
||||
Map<String, Object> getAttrMap = sarLawsAttrInfoDao.selectLawsFieldAndData(fieldInfo, row.getId());
|
||||
if (InitStandAttrUtil.clobFieldList != null && !InitStandAttrUtil.clobFieldList.isEmpty()) {
|
||||
// 遍历修改所有clob类型的值
|
||||
for (String clobField : InitStandAttrUtil.clobFieldList) {
|
||||
Clob clobValue = (Clob) getAttrMap.get(clobField);
|
||||
String fieldValue = FieldConvertUtil.ClobToString(clobValue);
|
||||
getAttrMap.put(clobField, fieldValue);
|
||||
}
|
||||
}
|
||||
|
||||
if (getAttrMap != null && !getAttrMap.isEmpty()) {
|
||||
row.setAttrInfoCaseMap(transformUpperCase(getAttrMap));
|
||||
}
|
||||
|
||||
// row.setAttrInfoMap(getAttrMap);
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Object> transformUpperCase(Map<String, Object> orgMap) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
||||
for (Map.Entry<String, Object> entry : orgMap.entrySet()) {
|
||||
String newKey = entry.getKey().toLowerCase();
|
||||
resultMap.put(newKey, orgMap.get(entry.getKey()));
|
||||
if (entry.getValue() != null && InitStandAttrUtil.fileFieldListLaws != null && !InitStandAttrUtil.fileFieldListLaws.isEmpty() && InitStandAttrUtil.fileFieldListLaws.contains(entry.getKey())) {
|
||||
String value = entry.getValue().toString();
|
||||
if (org.apache.commons.lang.StringUtils.isNotBlank(value)) {
|
||||
List<AttFileEO> fileObj = attFileEOService.getMultiFileInfos(value);
|
||||
if(!fileObj.isEmpty()){
|
||||
resultMap.put(newKey + "Name", fileObj.get(0).getOldFileName());
|
||||
}
|
||||
}
|
||||
createStandMQService.sendLawsMQ(sarLawsInfoEO,"update");
|
||||
}
|
||||
}
|
||||
|
||||
if(!insList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "ADD".equals(searchCenter.getExecType().toUpperCase()))){
|
||||
for(SarLawsStandInfo sarLawsInfoEO : insList){
|
||||
countAddSuccess++;
|
||||
if (sarLawsInfoEO.getAttrInfoMap() != null) {
|
||||
sarLawsInfoEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarLawsInfoEO.getAttrInfoMap()));
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
public void lawsAttrInfoShowSearchDetails(SarLawsStandInfo row) throws Exception {
|
||||
if (row != null) {
|
||||
lawsAttrInfoSearchDetails(row);
|
||||
Map<String, Object> getAttrMap = row.getAttrInfoCaseMap();
|
||||
if (getAttrMap != null && getAttrMap.size() > 0) {
|
||||
for (Map.Entry<String, Object> entry : getAttrMap.entrySet()) {
|
||||
String name = entry.getKey().toUpperCase();
|
||||
String value = "";
|
||||
List<String> valArr = new ArrayList<>();
|
||||
if (entry.getValue() != null && InitStandAttrUtil.selectionFieldListLaws != null && InitStandAttrUtil.selectionFieldListLaws.size() > 0 && InitStandAttrUtil.selectionFieldListLaws.contains(name)) {
|
||||
if(org.apache.commons.lang.StringUtils.isNotBlank(entry.getValue().toString())){
|
||||
Object json= new JSONTokener(entry.getValue().toString()).nextValue();
|
||||
if(json instanceof org.json.JSONArray){
|
||||
valArr = com.alibaba.fastjson.JSONObject.parseArray(entry.getValue().toString(),String.class);
|
||||
}else {
|
||||
value = entry.getValue().toString();
|
||||
valArr = Arrays.asList(value.split(","));
|
||||
}
|
||||
if(!valArr.isEmpty()){
|
||||
value = dicTypeEODao.getDicNamesByCodes(valArr,"");
|
||||
}
|
||||
}
|
||||
entry.setValue(value);
|
||||
}
|
||||
}
|
||||
createStandMQService.sendLawsMQ(sarLawsInfoEO,"add");
|
||||
}
|
||||
}
|
||||
|
||||
if(!delList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "DEL".equals(searchCenter.getExecType().toUpperCase()))){
|
||||
elasticsearchService.deleteBatchId(delList,"laws");
|
||||
elasticsearchService.deleteBatchId(delList,"fulltextserch");
|
||||
}
|
||||
|
||||
logger.info("重置国内外政策:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(国内外政策共:"+rowsStand.size()+"条)删除-共"+delList.size()+"条数据");
|
||||
return Result.success("重置国内外政策:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(国内外政策共:"+rowsStand.size()+"条)删除-共"+delList.size()+"条数据");
|
||||
}
|
||||
|
||||
private void idListFunc(SarLawsStandInfoPage sarLawsInfoEOPage, SearchCenter searchCenter) {
|
||||
@@ -340,66 +596,145 @@ public class ResetSearchCenterService {
|
||||
int countUpdateSuccess = 0;
|
||||
int countAddSuccess = 0;
|
||||
sarBussionessStandEOPage.setMenuId("0");
|
||||
sarBussionessStandEOPage.setPageSize(searchCenter.getCountStand());
|
||||
|
||||
List<SarBussionessStand> rowsStand = iSarBussionessStandService.getSarBussionStandPage(sarBussionessStandEOPage);
|
||||
List<SarBussionessStand> insList = new ArrayList<>();
|
||||
List<SarBussionessStand> updList = new ArrayList<>();
|
||||
List<String> delList = new ArrayList<>();
|
||||
List<String> standIdList = rowsStand.stream().map(SarBussionessStand::getId).collect(Collectors.toList());
|
||||
QueryWrapper qw3 = new QueryWrapper();
|
||||
qw3.eq("VALID_FLAG","0");
|
||||
int count3 = iSarBussionessStandService.count(qw3);
|
||||
|
||||
if(!esIdList.isEmpty()){
|
||||
if(count3 > 0){
|
||||
sarBussionessStandEOPage.setPageSize(count3);
|
||||
|
||||
// 差集 (list1 - list2) 新增
|
||||
List<SarBussionessStand> distinctByUniqueList = rowsStand.stream()
|
||||
.filter(item -> !new ArrayList<>(esIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
insList.addAll(distinctByUniqueList);
|
||||
List<SarBussionessStand> rowsStand = iSarBussionessStandService.getSarBussionStandPage(sarBussionessStandEOPage);
|
||||
List<SarBussionessStand> insList = new ArrayList<>();
|
||||
List<SarBussionessStand> updList = new ArrayList<>();
|
||||
List<String> delList = new ArrayList<>();
|
||||
List<String> standIdList = rowsStand.stream().map(SarBussionessStand::getId).collect(Collectors.toList());
|
||||
|
||||
// 交集 更新
|
||||
List<SarBussionessStand> intersection = rowsStand.stream()
|
||||
.filter(item -> new ArrayList<>(esIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
updList.addAll(intersection);
|
||||
if(!esIdList.isEmpty()){
|
||||
|
||||
// 差集 (list2 - list1) 删除
|
||||
List<String> delDataList = esIdList.stream().filter(num -> !standIdList.contains(num))
|
||||
.collect(Collectors.toList());
|
||||
delList.addAll(delDataList);
|
||||
// 差集 (list1 - list2) 新增
|
||||
List<SarBussionessStand> distinctByUniqueList = rowsStand.stream()
|
||||
.filter(item -> !new ArrayList<>(esIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !distinctByUniqueList.isEmpty()){
|
||||
List<SarBussionessStand> collect = distinctByUniqueList.stream()
|
||||
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
|
||||
insList.addAll(collect);
|
||||
}else{
|
||||
insList.addAll(distinctByUniqueList);
|
||||
}
|
||||
|
||||
// 交集 更新
|
||||
List<SarBussionessStand> intersection = rowsStand.stream()
|
||||
.filter(item -> new ArrayList<>(esIdList)
|
||||
.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && !intersection.isEmpty()){
|
||||
List<SarBussionessStand> collect = intersection.stream()
|
||||
.filter(item -> searchCenter.getIdList().contains(item.getId())).collect(Collectors.toList());
|
||||
updList.addAll(collect);
|
||||
}else{
|
||||
updList.addAll(intersection);
|
||||
}
|
||||
|
||||
// 差集 (list2 - list1) 删除
|
||||
List<String> delDataList = esIdList.stream().filter(num -> !standIdList.contains(num))
|
||||
.collect(Collectors.toList());
|
||||
// 可以更新IDLIST 删除 ES
|
||||
if(searchCenter.getIdList() != null && !searchCenter.getIdList().isEmpty() && "DEL".equals(searchCenter.getExecType().toUpperCase())){
|
||||
delList.addAll(searchCenter.getIdList());
|
||||
}else{
|
||||
delList.addAll(delDataList);
|
||||
}
|
||||
}else {
|
||||
// 新增
|
||||
insList.addAll(rowsStand);
|
||||
}
|
||||
|
||||
if(!updList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "UPD".equals(searchCenter.getExecType().toUpperCase()))){
|
||||
for(SarBussionessStand sarBussionessStandEO : updList){
|
||||
countUpdateSuccess++;
|
||||
bussAttrInfoShowSearchDetails(sarBussionessStandEO);
|
||||
if (sarBussionessStandEO.getAttrInfoMap() != null) {
|
||||
sarBussionessStandEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarBussionessStandEO.getAttrInfoMap()));
|
||||
}
|
||||
createStandMQService.sendBussStandMQ(sarBussionessStandEO,"update");
|
||||
}
|
||||
}
|
||||
|
||||
if(!insList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "ADD".equals(searchCenter.getExecType().toUpperCase()))){
|
||||
for(SarBussionessStand sarBussionessStandEO : insList){
|
||||
countAddSuccess++;
|
||||
bussAttrInfoShowSearchDetails(sarBussionessStandEO);
|
||||
if (sarBussionessStandEO.getAttrInfoMap() != null) {
|
||||
sarBussionessStandEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarBussionessStandEO.getAttrInfoMap()));
|
||||
}
|
||||
createStandMQService.sendBussStandMQ(sarBussionessStandEO,"add");
|
||||
}
|
||||
}
|
||||
|
||||
if(!delList.isEmpty() && ("DEL".equals(searchCenter.getExecType().toUpperCase()))){
|
||||
elasticsearchService.deleteBatchId(delList,"bussstand");
|
||||
elasticsearchService.deleteBatchId(delList,"fulltextserch");
|
||||
logger.info("重置企标:删除-共"+delList.size()+"条数据");
|
||||
}
|
||||
logger.info("重置企标:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(企标共:"+rowsStand.size()+"条)数据");
|
||||
return Result.success("");
|
||||
}else {
|
||||
// 新增
|
||||
insList.addAll(rowsStand);
|
||||
logger.info("未查询到企标数据");
|
||||
return Result.error("未查询到企标数据");
|
||||
}
|
||||
|
||||
if(!updList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "UPD".equals(searchCenter.getExecType().toUpperCase()))){
|
||||
for(SarBussionessStand sarBussionessStandEO : updList){
|
||||
countUpdateSuccess++;
|
||||
if (sarBussionessStandEO.getAttrInfoMap() != null) {
|
||||
sarBussionessStandEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarBussionessStandEO.getAttrInfoMap()));
|
||||
}
|
||||
|
||||
public void bussAttrInfoShowSearchDetails(SarBussionessStand row) throws Exception {
|
||||
if (row != null) {
|
||||
bussAttrInfoSearchDetails(row);
|
||||
Map<String, Object> getAttrMap = row.getAttrInfoCaseMap();
|
||||
if (getAttrMap != null && getAttrMap.size() > 0) {
|
||||
for (Map.Entry<String, Object> entry : getAttrMap.entrySet()) {
|
||||
String name = entry.getKey().toUpperCase();
|
||||
String value = "";
|
||||
List<String> valArr = new ArrayList<>();
|
||||
if (entry.getValue() != null && InitStandAttrUtil.selectionFieldListBuss != null && InitStandAttrUtil.selectionFieldListBuss.size() > 0 && InitStandAttrUtil.selectionFieldListBuss.contains(name)) {
|
||||
if(org.apache.commons.lang.StringUtils.isNotBlank(entry.getValue().toString())){
|
||||
Object json= new JSONTokener(entry.getValue().toString()).nextValue();
|
||||
if(json instanceof org.json.JSONArray){
|
||||
valArr = com.alibaba.fastjson.JSONObject.parseArray(entry.getValue().toString(),String.class);
|
||||
}else {
|
||||
value = entry.getValue().toString();
|
||||
valArr = Arrays.asList(value.split(","));
|
||||
}
|
||||
if(!valArr.isEmpty()){
|
||||
value = dicTypeEODao.getDicNamesByCodes(valArr,"");
|
||||
}
|
||||
}
|
||||
entry.setValue(value);
|
||||
}
|
||||
}
|
||||
createStandMQService.sendBussStandMQ(sarBussionessStandEO,"update");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!insList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "ADD".equals(searchCenter.getExecType().toUpperCase()))){
|
||||
for(SarBussionessStand sarBussionessStandEO : insList){
|
||||
countAddSuccess++;
|
||||
if (sarBussionessStandEO.getAttrInfoMap() != null) {
|
||||
sarBussionessStandEO.setSarStandAttrEOStr(JSONObject.toJSONString(sarBussionessStandEO.getAttrInfoMap()));
|
||||
public void bussAttrInfoSearchDetails(SarBussionessStand row) throws Exception {
|
||||
String fieldInfo = InitStandAttrUtil.queryFieldBuss;
|
||||
String collectId = personCollectEOService.queryCollectByUserAndId(row.getId());
|
||||
row.setCollectId(collectId);
|
||||
// 查询属性表数据
|
||||
if (org.apache.commons.lang.StringUtils.isNotBlank(fieldInfo)) {
|
||||
Map<String, Object> getAttrMap = sarBussStandAttrInfoEODao.selectStandFieldAndData(fieldInfo, row.getId());
|
||||
if (InitStandAttrUtil.clobFieldList != null && !InitStandAttrUtil.clobFieldList.isEmpty()) {
|
||||
// 遍历修改所有clob类型的值
|
||||
for (String clobField : InitStandAttrUtil.clobFieldList) {
|
||||
Clob clobValue = (Clob) getAttrMap.get(clobField);
|
||||
String fieldValue = FieldConvertUtil.ClobToString(clobValue);
|
||||
getAttrMap.put(clobField, fieldValue);
|
||||
}
|
||||
createStandMQService.sendBussStandMQ(sarBussionessStandEO,"add");
|
||||
}
|
||||
}
|
||||
|
||||
if(!delList.isEmpty() && ("ALL".equals(searchCenter.getExecType().toUpperCase()) || "DEL".equals(searchCenter.getExecType().toUpperCase()))){
|
||||
elasticsearchService.deleteBatchId(delList,"bussstand");
|
||||
elasticsearchService.deleteBatchId(delList,"fulltextserch");
|
||||
row.setAttrInfoMap(getAttrMap);
|
||||
}
|
||||
logger.info("重置企标:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(企标共:"+rowsStand.size()+"条)删除-共"+delList.size()+"条数据");
|
||||
return Result.success("重置企标:新增-"+ countAddSuccess + "条 更新-"+countUpdateSuccess+"条(企标共:"+rowsStand.size()+"条)删除-共"+delList.size()+"条数据");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -1404,7 +1404,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
}
|
||||
|
||||
public void attrInfoSearchDetails(SarBussionessStand row,String type) throws Exception {
|
||||
String fieldInfo = InitStandAttrUtil.queryField;
|
||||
String fieldInfo = InitStandAttrUtil.queryFieldBuss;
|
||||
String collectId = personCollectEOService.queryCollectByUserAndId(row.getId());
|
||||
row.setCollectId(collectId);
|
||||
// 查询属性表数据
|
||||
@@ -1414,7 +1414,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
String sarStandAttrEOStr = row.getSarStandAttrEOStr();
|
||||
getAttrMap = JSONObject.fromObject(sarStandAttrEOStr);
|
||||
}else {
|
||||
getAttrMap = sarStandAttrInfoEODao.selectStandFieldAndData(fieldInfo, row.getId());
|
||||
getAttrMap = sarBussStandAttrInfoEODao.selectStandFieldAndData(fieldInfo, row.getId());
|
||||
}
|
||||
if (InitStandAttrUtil.clobFieldList != null && !InitStandAttrUtil.clobFieldList.isEmpty()) {
|
||||
// 遍历修改所有clob类型的值
|
||||
|
||||
+18
-4
@@ -100,6 +100,7 @@ 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.poifs.filesystem.FileMagic;
|
||||
import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
import org.json.JSONTokener;
|
||||
@@ -112,6 +113,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.sql.Clob;
|
||||
@@ -3007,15 +3009,26 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
|
||||
// 判断文件是docx还是PDF
|
||||
if (null != attFileEO.getFileSuffix() && (attFileEO.getFileSuffix().equals("docx") || attFileEO.getFileSuffix().equals("doc") || attFileEO.getFileSuffix().equals("DOC") || attFileEO.getFileSuffix().equals("DOCX") || attFileEO.getFileSuffix().equals("ppt") || attFileEO.getFileSuffix().equals("pptx"))) {
|
||||
if (attFileEO.getFileSuffix().equals("doc") || attFileEO.getFileSuffix().equals("docx") || attFileEO.getFileSuffix().equals("DOC") || attFileEO.getFileSuffix().equals("DOCX")) {
|
||||
FileInputStream fis = new FileInputStream(readFilePath);
|
||||
WordExtractor wordExtractor = new WordExtractor(fis);
|
||||
String txt = wordExtractor.getText();
|
||||
content.append(txt);
|
||||
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(new File(readFilePath)));
|
||||
if (FileMagic.valueOf(bis) == FileMagic.OOXML) {
|
||||
XWPFDocument doc = new XWPFDocument(bis);
|
||||
XWPFWordExtractor extractor = new XWPFWordExtractor(doc);
|
||||
String txt = extractor.getText();
|
||||
content.append(txt);
|
||||
extractor.close();
|
||||
}else {
|
||||
WordExtractor wordExtractor = new WordExtractor(bis);
|
||||
String txt = wordExtractor.getText();
|
||||
content.append(txt);
|
||||
wordExtractor.close();
|
||||
}
|
||||
bis.close();
|
||||
} else {
|
||||
OPCPackage opcPackage = XWPFDocument.openPackage(readFilePath);
|
||||
XWPFWordExtractor extractor = new XWPFWordExtractor(opcPackage);
|
||||
String txt = extractor.getText();
|
||||
content.append(txt);
|
||||
opcPackage.close();
|
||||
}
|
||||
} else {
|
||||
PDDocument document = PDDocument.load(new File(readFilePath));
|
||||
@@ -3028,6 +3041,7 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
|
||||
// String[] lines = pdfFileInText.split("\\r?\\n");
|
||||
content.append(pdfFileInText);
|
||||
}
|
||||
document.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("搜索中心新增数据读取文档内容时失败");
|
||||
|
||||
Reference in New Issue
Block a user