Merge remote-tracking branch 'origin/dev_third_stage' into dev_third_stage

This commit is contained in:
zyx.net
2022-08-26 17:59:39 +08:00
20 changed files with 223 additions and 142 deletions
@@ -966,3 +966,8 @@ ADD COLUMN `related_areas_en` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4
ADD COLUMN `source_cn` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '来源中文' AFTER `related_areas_en`, ADD COLUMN `source_cn` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '来源中文' AFTER `related_areas_en`,
ADD COLUMN `time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '日期' AFTER `source_cn`, ADD COLUMN `time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '日期' AFTER `source_cn`,
ADD COLUMN `source_en` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '来源英文' AFTER `time`; ADD COLUMN `source_en` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '来源英文' AFTER `time`;
-- 法规技术评估 条款项评估结果表增加字段。 2022-08-26
ALTER TABLE `laws_weilai`.`laws_technology_evaluation_item_result`
ADD COLUMN `feedback_time` datetime NULL COMMENT '反馈时间' AFTER `laws_technology_evaluation_id`;
@@ -8,8 +8,8 @@ package com.jero.modules.document.enums;
public enum SearchEnum { public enum SearchEnum {
INDEX_NAME_DOCUMENT("文档库索引名称","documentLibrary"), INDEX_NAME_DOCUMENT("文档库索引名称","documentLibrary"),
TYPE_NAME_DOCUMENT("文档库类型","document"), TYPE_NAME_DOCUMENT("文档库类型","document"),
INDEX_NAME_LAWS_MONTHLY_REPORT("法规月报索引名称","lawsMonthlyReportManage"), INDEX_NAME_LAWS_MONTHLY_REPORT("法规月报索引名称","lawsmonthlyreportmanage"),
TYPE_NAME_LAWS_MONTHLY_REPORT("法规月报类型名称","lawsMonthlyReport"), TYPE_NAME_LAWS_MONTHLY_REPORT("法规月报类型名称","lawsmonthlyreport"),
FULL_TEXT_SEARCH("全部中文","fulltextsearchcn"), FULL_TEXT_SEARCH("全部中文","fulltextsearchcn"),
FULL_TEXT_SEARCH_CN("全部中文","fulltextsearchcn"), FULL_TEXT_SEARCH_CN("全部中文","fulltextsearchcn"),
FULL_TEXT_SEARCH_EN("全部英文","fulltextsearchen"), FULL_TEXT_SEARCH_EN("全部英文","fulltextsearchen"),
@@ -135,6 +135,11 @@ public class LawsTechnologyEvaluationItemResultEO implements Serializable {
@ApiModelProperty(value = "发起人反馈") @ApiModelProperty(value = "发起人反馈")
private java.lang.String sponsorFeedback; private java.lang.String sponsorFeedback;
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "反馈时间")
private java.util.Date feedbackTime;
/**法规技术评估表id*/ /**法规技术评估表id*/
@ApiModelProperty(value = "法规技术评估表id") @ApiModelProperty(value = "法规技术评估表id")
private java.lang.String lawsTechnologyEvaluationId; private java.lang.String lawsTechnologyEvaluationId;
@@ -222,7 +222,7 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
public void esFullText(ProblemKnowledgeBaseEO problemKnowledgeBaseEO,StringBuilder sbCn,StringBuilder sbEn,String cut,String fileText,List<DictModel> targetMarketList){ public void esFullText(ProblemKnowledgeBaseEO problemKnowledgeBaseEO,StringBuilder sbCn,StringBuilder sbEn,String cut,String fileText,List<DictModel> targetMarketList){
if(StringUtils.equals(cut,CutEnum.CN.getValue())){ if(StringUtils.equals(cut,CutEnum.CN.getValue())){
if(StringUtils.isNotEmpty(problemKnowledgeBaseEO.getShowPermissions())){ /*if(StringUtils.isNotEmpty(problemKnowledgeBaseEO.getShowPermissions())){
String textByValue = ShowPermissionsEnum.getTextByValue(problemKnowledgeBaseEO.getShowPermissions(), cut); String textByValue = ShowPermissionsEnum.getTextByValue(problemKnowledgeBaseEO.getShowPermissions(), cut);
sbCn.append("展示权限" + ":" + textByValue + " "); sbCn.append("展示权限" + ":" + textByValue + " ");
}else { }else {
@@ -233,7 +233,7 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
sbCn.append("标题" + ":" + problemKnowledgeBaseEO.getTitle() + " "); sbCn.append("标题" + ":" + problemKnowledgeBaseEO.getTitle() + " ");
}else { }else {
sbCn.append("标题" + ":" + "-- "); sbCn.append("标题" + ":" + "-- ");
} }*/
if(StringUtils.isNotEmpty(problemKnowledgeBaseEO.getProblemTypeName())){ if(StringUtils.isNotEmpty(problemKnowledgeBaseEO.getProblemTypeName())){
sbCn.append("问题分类" + ":" + problemKnowledgeBaseEO.getProblemTypeName() + " "); sbCn.append("问题分类" + ":" + problemKnowledgeBaseEO.getProblemTypeName() + " ");
@@ -272,10 +272,10 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
if(StringUtils.isNotEmpty(problemKnowledgeBaseEO.getContent())){ if(StringUtils.isNotEmpty(problemKnowledgeBaseEO.getContent())){
sbCn.append("</br>"); sbCn.append("</br>");
sbCn.append("内容" + ":" + problemKnowledgeBaseEO.getContent() + " "); sbCn.append("正文" + ":" + problemKnowledgeBaseEO.getContent() + " ");
}else { }else {
sbCn.append("</br>"); sbCn.append("</br>");
sbCn.append("内容" + ":" + "-- "); sbCn.append("正文" + ":" + "-- ");
} }
if(StringUtils.isNotEmpty(fileText)){ if(StringUtils.isNotEmpty(fileText)){
@@ -285,7 +285,7 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
} }
}else if(StringUtils.equals(cut,CutEnum.EN.getValue())){ }else if(StringUtils.equals(cut,CutEnum.EN.getValue())){
if(StringUtils.isNotEmpty(problemKnowledgeBaseEO.getShowPermissions())){ /*if(StringUtils.isNotEmpty(problemKnowledgeBaseEO.getShowPermissions())){
String textByValue = ShowPermissionsEnum.getTextByValue(problemKnowledgeBaseEO.getShowPermissions(), cut); String textByValue = ShowPermissionsEnum.getTextByValue(problemKnowledgeBaseEO.getShowPermissions(), cut);
sbEn.append("Display permission" + ":" + textByValue + " "); sbEn.append("Display permission" + ":" + textByValue + " ");
}else { }else {
@@ -296,7 +296,7 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
sbEn.append("Title" + ":" + problemKnowledgeBaseEO.getTitle() + " "); sbEn.append("Title" + ":" + problemKnowledgeBaseEO.getTitle() + " ");
}else { }else {
sbEn.append("Title" + ":" + "-- "); sbEn.append("Title" + ":" + "-- ");
} }*/
if(StringUtils.isNotEmpty(problemKnowledgeBaseEO.getProblemTypeName())){ if(StringUtils.isNotEmpty(problemKnowledgeBaseEO.getProblemTypeName())){
sbEn.append("Problem classification" + ":" + problemKnowledgeBaseEO.getProblemTypeName() + " "); sbEn.append("Problem classification" + ":" + problemKnowledgeBaseEO.getProblemTypeName() + " ");
@@ -335,10 +335,10 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
if(StringUtils.isNotEmpty(problemKnowledgeBaseEO.getContent())){ if(StringUtils.isNotEmpty(problemKnowledgeBaseEO.getContent())){
sbEn.append("</br>"); sbEn.append("</br>");
sbEn.append("Content" + ":" + problemKnowledgeBaseEO.getContent() + " "); sbEn.append("Text" + ":" + problemKnowledgeBaseEO.getContent() + " ");
}else { }else {
sbEn.append("</br>"); sbEn.append("</br>");
sbEn.append("Content" + ":" + "-- "); sbEn.append("Text" + ":" + "-- ");
} }
if(StringUtils.isNotEmpty(fileText)){ if(StringUtils.isNotEmpty(fileText)){
@@ -191,20 +191,20 @@ public class LawsMonthlyReportManageEOServiceImpl extends ServiceImpl<LawsMonthl
List<Map<String, Object>> mapListTempEn = new ArrayList<>(); List<Map<String, Object>> mapListTempEn = new ArrayList<>();
//文件相关封装中文的全文内容(es) 非搜索条件下的:flag---SEARCH_FLAG //文件相关封装中文的全文内容(es) 非搜索条件下的:flag---SEARCH_FLAG
putMap(id, "法规月报", putMap(id, "法规月报",
fileText, monthlyReportManageEO.getName(), fileText, fileText, monthlyReportManageEO.getName(),
ossFile.getFileName(), ossFile.getId(), issueTime, CutEnum.CN.getValue(), stringMapCn, SEARCH_FLAG); ossFile.getFileName(), ossFile.getId(), issueTime, CutEnum.CN.getValue(), stringMapCn, SEARCH_FLAG);
//文件相关封装英文的全文内容(es) 搜索条件下的: flag---null //文件相关封装英文的全文内容(es)
putMap(id, "monthly report", putMap(id, "monthly report",
fileText, monthlyReportManageEO.getName(), fileText, fileText, monthlyReportManageEO.getName(),
ossFile.getFileName(), ossFile.getId(), issueTime, CutEnum.EN.getValue(), stringMapEn, SEARCH_FLAG); ossFile.getFileName(), ossFile.getId(), issueTime, CutEnum.EN.getValue(), stringMapEn, SEARCH_FLAG);
//文件相关封装中文的全文内容(es) //文件相关封装中文的全文内容(es) 搜索条件下的: flag---null
putMap(id + monthlyReportManageEO.getFileId(), "法规月报", putMap(id + monthlyReportManageEO.getFileId(), "法规月报",
fileText, monthlyReportManageEO.getName(), fileText, fileText, monthlyReportManageEO.getName(),
ossFile.getFileName(), ossFile.getId(), issueTime, CutEnum.CN.getValue(), stringMapCnForSearch, null); ossFile.getFileName(), ossFile.getId(), issueTime, CutEnum.CN.getValue(), stringMapCnForSearch, null);
//文件相关封装英文的全文内容(es) //文件相关封装英文的全文内容(es)
putMap(id + monthlyReportManageEO.getFileId(), "monthly report", putMap(id + monthlyReportManageEO.getFileId(), "monthly report",
fileText, monthlyReportManageEO.getName(), fileText, fileText, monthlyReportManageEO.getName(),
ossFile.getFileName(), ossFile.getId(), issueTime, CutEnum.EN.getValue(), stringMapEnForSearch, null); ossFile.getFileName(), ossFile.getId(), issueTime, CutEnum.EN.getValue(), stringMapEnForSearch, null);
mapListTempCn.add(stringMapCn); mapListTempCn.add(stringMapCn);
@@ -247,7 +247,7 @@ public class LawsMonthlyReportManageEOServiceImpl extends ServiceImpl<LawsMonthl
} }
} }
private void putMap(String id, String moduleType, private void putMap(String id, String moduleType,
String content, String title , String fileText, String content, String title ,
String fileName, String fileId, Date issueTime, String cut, String fileName, String fileId, Date issueTime, String cut,
Map<String, Object> stringMap, Map<String, Object> stringMap,
String flag){ String flag){
@@ -256,7 +256,6 @@ public class LawsMonthlyReportManageEOServiceImpl extends ServiceImpl<LawsMonthl
stringMap.put("module_type_flag", ModuleTypeFlagEnum.LAWS_MONTHLY_REPORT.getValue()); // 默认法规月报标识 stringMap.put("module_type_flag", ModuleTypeFlagEnum.LAWS_MONTHLY_REPORT.getValue()); // 默认法规月报标识
stringMap.put("content", content); stringMap.put("content", content);
stringMap.put("title", title); stringMap.put("title", title);
stringMap.put("file_text", fileText);
stringMap.put("file_name", fileName); stringMap.put("file_name", fileName);
stringMap.put("file_id", fileId); stringMap.put("file_id", fileId);
stringMap.put("create_time", issueTime); stringMap.put("create_time", issueTime);
@@ -33,6 +33,7 @@ import com.jero.modules.system.entity.SysCategory;
import com.jero.modules.system.entity.SysDictItem; import com.jero.modules.system.entity.SysDictItem;
import com.jero.modules.system.service.impl.SysCategoryServiceImpl; import com.jero.modules.system.service.impl.SysCategoryServiceImpl;
import com.jero.modules.system.service.impl.SysDictItemServiceImpl; import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@@ -49,6 +50,7 @@ import java.util.stream.Collectors;
* @date 2022/3/14 10:03 * @date 2022/3/14 10:03
* @auth zhn * @auth zhn
*/ */
@Slf4j
@Component @Component
public class DocumentSearchServiceImpl implements IDocumentSearchService { public class DocumentSearchServiceImpl implements IDocumentSearchService {
@Autowired @Autowired
@@ -446,39 +448,23 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
Map<String,Object> mapHighlight1 = new HashMap<>(); Map<String,Object> mapHighlight1 = new HashMap<>();
//封装首次的条件 //封装首次的条件
if (StringUtils.isNotBlank(selectValue)) { if (StringUtils.isNotBlank(selectValue)) {
selectValue = selectValue.toLowerCase();
for (String field : fieldList) { for (String field : fieldList) {
Map<String, Object> map2 = new HashMap<>(); getQueryMapJsonFullText(queryMapJson, selectValue, field);
Map<String, Object> map3 = new HashMap<>();
Map<String, Object> map4 = new HashMap<>();
if("serial_number".equals(field)){
map3.put("boost",1);
}else if("title".equals(field)){
map3.put("boost",1);
}else if("file_text".equals(field)){
map3.put("boost",0.01);
}else if("content".equals(field)){
map3.put("boost",0.01);
}else if("file_name".equals(field)){
map3.put("boost",1);
}
// 特殊处理编号字段
if (field.equals("serial_number")){
// map2放最内层
map2.put(field, "*" + selectValue + "*");
// map4放query
map4.put("wildcard",map2);
} else {
map3.put("query",selectValue);
// map3.put("minimum_should_match",2);
map2.put(field, map3);
map4.put("match",map2);
}
queryMapJson.add(map4);
//高亮 //高亮
if(!"flag".equals(field)){ if(!"flag".equals(field)){
highlight(mapHighlight, field); highlight(mapHighlight, field);
} else {
// query_string查询
Map<String, Object> map25 = new HashMap<>();
Map<String, Object> map45 = new HashMap<>();
map25.put("query", selectValue);
map25.put("allow_leading_wildcard", false); //禁用了前置通配符
map45.put("query_string", map25);
queryMapJson.add(map45);
} }
} }
mapHighlight1.put("fields",mapHighlight); mapHighlight1.put("fields",mapHighlight);
@@ -489,39 +475,23 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
} }
//封装二次的条件 //封装二次的条件
if (StringUtils.isNotBlank(selectValueTwo)) { if (StringUtils.isNotBlank(selectValueTwo)) {
selectValueTwo = selectValueTwo.toLowerCase();
for (String field : fieldList) { for (String field : fieldList) {
Map<String, Object> queryMap = new HashMap<>(); getQueryMapJsonFullText(queryMapJsonTwo, selectValueTwo, field);
Map<String, Object> map2 = new HashMap<>();
Map<String, Object> map3 = new HashMap<>();
if("serial_number".equals(field)){
map3.put("boost",1);
}else if("title".equals(field)){
map3.put("boost",1);
}else if("file_text".equals(field)){
map3.put("boost",0.01);
}else if("content".equals(field)){
map3.put("boost",0.01);
}else if("file_name".equals(field)){
map3.put("boost",1);
}
//特殊处理编号字段
if (field.equals("serial_number")){
// map2放最内层
map2.put(field, "*" + selectValueTwo + "*");
// map4放query
queryMap.put("wildcard",map2);
} else {
map3.put("query",selectValueTwo);
// map3.put("minimum_should_match",2);
map2.put(field, map3);
queryMap.put("match", map2);
}
queryMapJsonTwo.add(queryMap);
//高亮 //高亮
if(!"flag".equals(field)){ if(!"flag".equals(field)){
highlight(mapHighlight, field); highlight(mapHighlight, field);
} else {
// query_string查询
Map<String, Object> map25 = new HashMap<>();
Map<String, Object> map45 = new HashMap<>();
map25.put("query", selectValue);
map25.put("allow_leading_wildcard", false); //禁用了前置通配符
map45.put("query_string", map25);
queryMapJson.add(map45);
} }
} }
mapHighlight1.put("fields",mapHighlight); mapHighlight1.put("fields",mapHighlight);
@@ -546,7 +516,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
} }
JSONObject sort = new JSONObject(); JSONObject sort = new JSONObject();
if(StringUtils.isEmpty(selectValue)){ if(StringUtils.isEmpty(selectValue) || StringUtils.equals(selectValue,SEARCH_FLAG)){
Map<String,Object> createTime = new HashMap<>(); Map<String,Object> createTime = new HashMap<>();
Map<String,Object> createTime1 = new HashMap<>(); Map<String,Object> createTime1 = new HashMap<>();
createTime.put("order","desc"); createTime.put("order","desc");
@@ -559,6 +529,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
score1.put("_score",score); score1.put("_score",score);
sort.putAll(score1); sort.putAll(score1);
} }
log.info("搜索中心-全部索引,排序方式为:" + sort.toJSONString());
// Map<String,Object> mapSort = new HashMap<>(); // Map<String,Object> mapSort = new HashMap<>();
// Map<String,Object> mapSortTemp = new HashMap<>(); // Map<String,Object> mapSortTemp = new HashMap<>();
@@ -573,6 +544,65 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
return page; return page;
} }
private void getQueryMapJsonFullText(JSONArray queryMapJson, String selectValue, String field) {
// 前缀匹配 缺点是前缀一定不能断开
//情况举例:用户只记得前面那段字
Map<String, Object> map21 = new HashMap<>();
Map<String, Object> map31 = new HashMap<>();
Map<String, Object> map41 = new HashMap<>();
if("serial_number".equals(field)){
map31.put("boost",1);
}else if("title".equals(field)){
map31.put("boost",1);
}else if("file_text".equals(field)){
map31.put("boost",0.01);
}else if("content".equals(field)){
map31.put("boost",0.01);
}else if("file_name".equals(field)){
map31.put("boost",1);
}
map31.put("value", selectValue);
map21.put(field + ".keyword", map31);
map41.put("prefix", map21);
queryMapJson.add(map41);
// match_phrase_prefix 词组匹配查询,允许最后词组与文中的任意分词前缀匹配
Map<String, Object> map22 = new HashMap<>();
Map<String, Object> map32 = new HashMap<>();
Map<String, Object> map42 = new HashMap<>();
if("serial_number".equals(field)){
map32.put("boost",1);
}else if("title".equals(field)){
map32.put("boost",1);
}else if("file_text".equals(field)){
map32.put("boost",0.01);
}else if("content".equals(field)){
map32.put("boost",0.01);
}else if("file_name".equals(field)){
map32.put("boost",1);
}
map32.put("query", selectValue);
map22.put(field, map32);
map42.put("match_phrase_prefix", map22);
queryMapJson.add(map42);
// match分词匹配查询
// 情况举例:用户可能他知道开头的前缀几个字,知道中间的几个字
Map<String, Object> map23 = new HashMap<>();
Map<String, Object> map43 = new HashMap<>();
map23.put(field, selectValue);
map43.put("match", map23);
queryMapJson.add(map43);
// wildcard模糊查询
//情况举例:用户只记得中间那段字
Map<String, Object> map24 = new HashMap<>();
Map<String, Object> map44 = new HashMap<>();
map24.put(field, "*" + selectValue + "*");
map44.put("wildcard",map24);
queryMapJson.add(map44);
}
@NotNull @NotNull
private IPage getiPage(String selectValue, String selectValueTwo, JSONArray queryMapJson,Map<String,Object> highlightMap, private IPage getiPage(String selectValue, String selectValueTwo, JSONArray queryMapJson,Map<String,Object> highlightMap,
JSONArray should, Integer pageNo, Integer pageSize, String paragraphFlag, JSONArray should, Integer pageNo, Integer pageSize, String paragraphFlag,
@@ -1256,7 +1286,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
queryMapJsonAll.add(jsonObjectThree); queryMapJsonAll.add(jsonObjectThree);
} }
JSONObject sort = new JSONObject(); JSONObject sort = new JSONObject();
if(StringUtils.isEmpty(selectValue)){ if(StringUtils.isEmpty(selectValue) || StringUtils.equals(selectValue,SEARCH_FLAG)){
Map<String,Object> createTime = new HashMap<>(); Map<String,Object> createTime = new HashMap<>();
Map<String,Object> createTime1 = new HashMap<>(); Map<String,Object> createTime1 = new HashMap<>();
createTime.put("order","desc"); createTime.put("order","desc");
@@ -77,35 +77,28 @@ public class LawsMonthlyReportSearchServiceImpl implements ILawsMonthlyReportSea
Map<String,Object> mapHighlight1 = new HashMap<>(); Map<String,Object> mapHighlight1 = new HashMap<>();
//封装首次的条件 //封装首次的条件
if (StringUtils.isNotBlank(selectValue)) { if (StringUtils.isNotBlank(selectValue)) {
selectValue = selectValue.toLowerCase();
for (String field : fieldList) { for (String field : fieldList) {
Map<String, Object> map2 = new HashMap<>(); getQueryMapJson(queryMapJson, selectValue, field);
Map<String, Object> map3 = new HashMap<>();
Map<String, Object> map4 = new HashMap<>();
if("title".equals(field)){
map3.put("boost",1);
}else if("content".equals(field)){
map3.put("boost",0.01);
}
// 标题字段 通配符模糊匹配
if (field.equals("title")){
// map2放最内层
map2.put(field, "*" + selectValue + "*");
// map4放query
map4.put("wildcard",map2);
} else {
map3.put("query", selectValue);
map2.put(field, map3);
map4.put("match", map2);
}
queryMapJson.add(map4);
//高亮 //高亮
if(!"flag".equals(field)){ if(!"flag".equals(field)){
highlight(mapHighlight, field); highlight(mapHighlight, field);
} else {
// query_string查询
Map<String, Object> map25 = new HashMap<>();
Map<String, Object> map45 = new HashMap<>();
map25.put("query", selectValue);
map25.put("fields", fieldList.toArray());
map25.put("allow_leading_wildcard", false); //禁用了前置通配符
map45.put("query_string", map25);
queryMapJson.add(map45);
} }
} }
mapHighlight1.put("fields",mapHighlight); mapHighlight1.put("fields",mapHighlight);
} }
if(CollectionUtils.isNotEmpty(queryMapJson)){ if(CollectionUtils.isNotEmpty(queryMapJson)){
JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapJson); JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapJson);
@@ -113,33 +106,22 @@ public class LawsMonthlyReportSearchServiceImpl implements ILawsMonthlyReportSea
} }
//封装二次的条件 //封装二次的条件
if (StringUtils.isNotBlank(selectValueTwo)) { if (StringUtils.isNotBlank(selectValueTwo)) {
selectValueTwo = selectValueTwo.toLowerCase();
for (String field : fieldList) { for (String field : fieldList) {
Map<String, Object> queryMap = new HashMap<>(); getQueryMapJson(queryMapJsonTwo, selectValueTwo, field);
Map<String, Object> map2 = new HashMap<>();
Map<String, Object> map3 = new HashMap<>();
if("title".equals(field)){
map3.put("boost",1);
}else if("content".equals(field)){
map3.put("boost",0.01);
}
// 标题字段 通配符模糊匹配
if (field.equals("title")){
// map2放最内层
map2.put(field, "*" + selectValueTwo + "*");
// map4放query
queryMap.put("wildcard",map2);
} else {
map3.put("query", selectValueTwo);
// map3.put("minimum_should_match",2);
map2.put(field, map3);
queryMap.put("match", map2);
}
queryMapJsonTwo.add(queryMap);
//高亮 //高亮
if(!"flag".equals(field)){ if(!"flag".equals(field)){
highlight(mapHighlight, field); highlight(mapHighlight, field);
} else {
// query_string查询
Map<String, Object> map25 = new HashMap<>();
Map<String, Object> map45 = new HashMap<>();
map25.put("query", selectValue);
map25.put("allow_leading_wildcard", false);
map45.put("query_string", map25);
queryMapJsonTwo.add(map45);
} }
} }
mapHighlight1.put("fields",mapHighlight); mapHighlight1.put("fields",mapHighlight);
@@ -227,11 +209,6 @@ public class LawsMonthlyReportSearchServiceImpl implements ILawsMonthlyReportSea
} }
mapSource.put(key,fieldConyent); mapSource.put(key,fieldConyent);
} }
//如果这一条数据中有高亮字段值,但是file_text中没有高亮值, 则赋空值,否则列表中会展示所有的文件内容, 赋空后,则展示基础数据
String fileText = (String) mapSource.get("file_text");
if(StringUtils.isNotBlank(fileText) && !fileText.contains("<text class='highlight-class'>")){
mapSource.put("file_text","");
}
} }
mapList.add(mapSource); mapList.add(mapSource);
} }
@@ -258,10 +235,57 @@ public class LawsMonthlyReportSearchServiceImpl implements ILawsMonthlyReportSea
list1.add("</text>"); list1.add("</text>");
mapTemp.put("pre_tags", list); mapTemp.put("pre_tags", list);
mapTemp.put("post_tags", list1); mapTemp.put("post_tags", list1);
mapTemp.put("fragment_size", 550);//高亮字段内容长度,去除html样式标签,统计字数,设置为200 mapTemp.put("fragment_size", 500);//高亮字段内容长度,去除html样式标签,统计字数,设置为200
mapTemp.put("number_of_fragments", 1);//高亮内容默认分为5段, 此处设置为一段 mapTemp.put("number_of_fragments", 1);//高亮内容默认分为5段, 此处设置为一段
mapTemp.put("type", "plain"); mapTemp.put("type", "plain");
mapHighlight.put(key, mapTemp); mapHighlight.put(key, mapTemp);
} }
private void getQueryMapJson(JSONArray queryMapJson, String selectValue, String field) {
// 前缀匹配 缺点是前缀一定不能断开
//情况举例:用户只记得前面那段字
Map<String, Object> map21 = new HashMap<>();
Map<String, Object> map31 = new HashMap<>();
Map<String, Object> map41 = new HashMap<>();
if("title".equals(field)){
map31.put("boost",1);
}else if("content".equals(field)){
map31.put("boost",0.01);
}
map31.put("value", selectValue);
map21.put(field + ".keyword", map31);
map41.put("prefix", map21);
queryMapJson.add(map41);
// match_phrase_prefix 词组匹配查询,允许最后词组与文中的任意分词前缀匹配
Map<String, Object> map22 = new HashMap<>();
Map<String, Object> map32 = new HashMap<>();
Map<String, Object> map42 = new HashMap<>();
if("title".equals(field)){
map32.put("boost",1);
}else if("content".equals(field)){
map32.put("boost",0.01);
}
map32.put("query", selectValue);
map22.put(field, map32);
map42.put("match_phrase_prefix", map22);
queryMapJson.add(map42);
// match分词匹配查询
// 情况举例:用户可能他知道开头的前缀几个字,知道中间的几个字
Map<String, Object> map23 = new HashMap<>();
Map<String, Object> map43 = new HashMap<>();
map23.put(field, selectValue);
map43.put("match", map23);
queryMapJson.add(map43);
// wildcard模糊查询
//情况举例:用户只记得中间那段字
Map<String, Object> map24 = new HashMap<>();
Map<String, Object> map44 = new HashMap<>();
map24.put(field, "*" + selectValue + "*");
map44.put("wildcard",map24);
queryMapJson.add(map44);
}
} }
@@ -332,7 +332,12 @@
if (res.success) { if (res.success) {
this.confirmLoading = false this.confirmLoading = false
this.$message.success(this.$t('OperationSuccessful')) this.$message.success(this.$t('OperationSuccessful'))
eventBUs.$emit('searchReset') if (this.formInline.id) {
eventBUs.$emit('searchGetData')
} else {
eventBUs.$emit('searchReset')
}
this.$emit('addFormClick') this.$emit('addFormClick')
} else { } else {
this.confirmLoading = false this.confirmLoading = false
@@ -115,7 +115,7 @@
this.visible = false this.visible = false
this.visibleTree = false this.visibleTree = false
this.$emit('clearSelected') this.$emit('clearSelected')
eventBUs.$emit('searchReset') eventBUs.$emit('searchGetData')
} else { } else {
this.$message.warning(this.$t('operationFailed')) this.$message.warning(this.$t('operationFailed'))
} }
@@ -188,7 +188,7 @@
.drawer-bootom-button { .drawer-bootom-button {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
z-index:100; z-index: 100;
width: 100%; width: 100%;
border-top: 1px solid #e8e8e8; border-top: 1px solid #e8e8e8;
padding: 10px 16px; padding: 10px 16px;
@@ -333,7 +333,7 @@
value.id = this.getUUID() value.id = this.getUUID()
value.currentUserName = this.userInfo().username value.currentUserName = this.userInfo().username
Object.keys(value).forEach(res => { Object.keys(value).forEach(res => {
if (value[res] && value[res] instanceof String) { if (value[res] && typeof value[res] == 'string') {
value[res] = value[res].replace(/\"/g, '“') value[res] = value[res].replace(/\"/g, '“')
value[res] = value[res].replace(/\'/g, '‘') value[res] = value[res].replace(/\'/g, '‘')
} }
@@ -364,7 +364,7 @@
let handlingTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss') let handlingTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
value.handlingTime = handlingTime value.handlingTime = handlingTime
Object.keys(value).forEach(res => { Object.keys(value).forEach(res => {
if (value[res] && value[res] instanceof String) { if (value[res] && typeof value[res] == 'string') {
value[res] = value[res].replace(/\"/g, '“') value[res] = value[res].replace(/\"/g, '“')
value[res] = value[res].replace(/\'/g, '‘') value[res] = value[res].replace(/\'/g, '‘')
} }
@@ -217,7 +217,7 @@
}, },
{ {
title: this.$t('feedbackTime'), title: this.$t('feedbackTime'),
dataIndex: 'updateTime', dataIndex: 'feedbackTime',
align: 'center', align: 'center',
ellipsis: true, ellipsis: true,
width: 160 width: 160
@@ -537,7 +537,7 @@
if (value[res] && value[res] instanceof Array) { if (value[res] && value[res] instanceof Array) {
value[res] = value[res].join(',') value[res] = value[res].join(',')
} }
if (value[res] && value[res] instanceof String) { if (value[res] && typeof value[res] == 'string') {
value[res] = value[res].replace(/\"/g, '“') value[res] = value[res].replace(/\"/g, '“')
value[res] = value[res].replace(/\'/g, '‘') value[res] = value[res].replace(/\'/g, '‘')
} }
@@ -579,7 +579,7 @@
}, },
completeTask(value, taskId) { completeTask(value, taskId) {
Object.keys(value).forEach(res => { Object.keys(value).forEach(res => {
if (value[res] && value[res] instanceof String) { if (value[res] && typeof value[res] == 'string') {
value[res] = value[res].replace(/\"/g, '“') value[res] = value[res].replace(/\"/g, '“')
value[res] = value[res].replace(/\'/g, '‘') value[res] = value[res].replace(/\'/g, '‘')
} }
@@ -184,7 +184,7 @@
if (res.success) { if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful')) _this.$message.success(_this.$t('OperationSuccessful'))
_this.idList = [] _this.idList = []
eventBUs.$emit('searchReset') eventBUs.$emit('searchGetData')
} else { } else {
_this.$message.warning(_this.$t('operationFailed')) _this.$message.warning(_this.$t('operationFailed'))
} }
@@ -233,7 +233,7 @@
getAction(_this.url.deleteBatch, { ids: val.id }).then((res) => { getAction(_this.url.deleteBatch, { ids: val.id }).then((res) => {
if (res.success) { if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful')) _this.$message.success(_this.$t('OperationSuccessful'))
eventBUs.$emit('searchReset') eventBUs.$emit('searchGetData')
} else { } else {
_this.$message.warning(_this.$t('operationFailed')) _this.$message.warning(_this.$t('operationFailed'))
} }
@@ -21,7 +21,7 @@
</template> </template>
<span style="cursor: pointer" <span style="cursor: pointer"
class="text-header-text" class="text-header-text"
v-if="item.serial_number && !item.module_type_flag" v-if="item.serial_number && item.module_type_flag == 'WDK'"
v-html="item.serial_number"></span> v-html="item.serial_number"></span>
<template slot="title"> <template slot="title">
<span v-html="item.title"></span> <span v-html="item.title"></span>
@@ -30,7 +30,7 @@
<template slot="title"> <template slot="title">
<span v-html="item.file_name"></span> <span v-html="item.file_name"></span>
</template> </template>
<span class="text-header-text" v-if="item.file_name && !item.module_type_flag" style="cursor: pointer" <span class="text-header-text" v-if="item.file_name && item.module_type_flag == 'WDK'" style="cursor: pointer"
v-html="item.file_name"></span> v-html="item.file_name"></span>
</a-tooltip> </a-tooltip>
<!-- <a-tooltip placement="topLeft" :mouseEnterDelay="0.5">--> <!-- <a-tooltip placement="topLeft" :mouseEnterDelay="0.5">-->
@@ -98,6 +98,7 @@
import { getAction, postAction } from '@/api/manage' import { getAction, postAction } from '@/api/manage'
import uploadFile from '@/components/uploadFile/file' import uploadFile from '@/components/uploadFile/file'
import viewFileModel from '@/components/viewFileModel/index' import viewFileModel from '@/components/viewFileModel/index'
import moment from 'moment'
export default { export default {
name: 'evaluatorFeedback', name: 'evaluatorFeedback',
@@ -345,9 +346,21 @@
return return
} }
} }
if (this.$route.query.taskDefinitionKey == 'pgrqr'){
let feedbackTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
for (let i = 0; i < this.dataSource.length; i++) {
this.dataSource[i].feedbackTime = feedbackTime
}
}
callBack && callBack(this.dataSource) callBack && callBack(this.dataSource)
}, },
preservationData(callBack) { preservationData(callBack) {
if (this.$route.query.taskDefinitionKey == 'pgrqr'){
let feedbackTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
for (let i = 0; i < this.dataSource.length; i++) {
this.dataSource[i].feedbackTime = feedbackTime
}
}
callBack && callBack(this.dataSource) callBack && callBack(this.dataSource)
}, },
accessoryFileClick(item) { accessoryFileClick(item) {
@@ -313,7 +313,7 @@
let handlingTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss') let handlingTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
value.handlingTime = handlingTime value.handlingTime = handlingTime
Object.keys(value).forEach(res => { Object.keys(value).forEach(res => {
if (value[res] && value[res] instanceof String) { if (value[res] && typeof value[res] == 'string') {
value[res] = value[res].replace(/\"/g, '“') value[res] = value[res].replace(/\"/g, '“')
value[res] = value[res].replace(/\'/g, '‘') value[res] = value[res].replace(/\'/g, '‘')
} }
@@ -267,7 +267,7 @@
let operatorTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss') let operatorTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
value.operatorTime = operatorTime value.operatorTime = operatorTime
Object.keys(value).forEach(res => { Object.keys(value).forEach(res => {
if (value[res] && value[res] instanceof String) { if (value[res] && typeof value[res] == 'string') {
value[res] = value[res].replace(/\"/g, '“') value[res] = value[res].replace(/\"/g, '“')
value[res] = value[res].replace(/\'/g, '‘') value[res] = value[res].replace(/\'/g, '‘')
} }
@@ -176,7 +176,7 @@
let handlingTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss') let handlingTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
value.handlingTime = handlingTime value.handlingTime = handlingTime
Object.keys(value).forEach(res => { Object.keys(value).forEach(res => {
if (value[res] && value[res] instanceof String) { if (value[res] && typeof value[res] == 'string') {
value[res] = value[res].replace(/\"/g, '“') value[res] = value[res].replace(/\"/g, '“')
value[res] = value[res].replace(/\'/g, '‘') value[res] = value[res].replace(/\'/g, '‘')
} }
@@ -346,7 +346,7 @@
let json = Object.assign(this.queryBy, value) let json = Object.assign(this.queryBy, value)
let data = JSON.stringify(json).replace(/\"/g, '\'') let data = JSON.stringify(json).replace(/\"/g, '\'')
Object.keys(value).forEach(res => { Object.keys(value).forEach(res => {
if (value[res] && value[res] instanceof String) { if (value[res] && typeof value[res] == 'string') {
value[res] = value[res].replace(/\"/g, '“') value[res] = value[res].replace(/\"/g, '“')
value[res] = value[res].replace(/\'/g, '‘') value[res] = value[res].replace(/\'/g, '‘')
} }
@@ -1787,7 +1787,7 @@
let handlingTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss') let handlingTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
value.handlingTime = handlingTime value.handlingTime = handlingTime
Object.keys(value).forEach(res => { Object.keys(value).forEach(res => {
if (value[res] && value[res] instanceof String) { if (value[res] && typeof value[res] == 'string') {
value[res] = value[res].replace(/\"/g, '“') value[res] = value[res].replace(/\"/g, '“')
value[res] = value[res].replace(/\'/g, '‘') value[res] = value[res].replace(/\'/g, '‘')
} }