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

This commit is contained in:
wangzhijiang
2022-09-02 17:41:11 +08:00
4 changed files with 83 additions and 55 deletions
@@ -555,15 +555,15 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
Map<String, Object> map31 = new HashMap<>();
Map<String, Object> map41 = new HashMap<>();
if("serial_number".equals(field)){
map31.put("boost",1);
map31.put("boost",10);
}else if("title".equals(field)){
map31.put("boost",1);
map31.put("boost",10);
}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("boost",10);
}
map31.put("value", selectValue);
map21.put(field + ".keyword", map31);
@@ -575,15 +575,15 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
Map<String, Object> map32 = new HashMap<>();
Map<String, Object> map42 = new HashMap<>();
if("serial_number".equals(field)){
map32.put("boost",1);
map32.put("boost",10);
}else if("title".equals(field)){
map32.put("boost",1);
map32.put("boost",10);
}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("boost",10);
}
map32.put("query", selectValue);
map22.put(field, map32);
@@ -593,8 +593,21 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
// match分词匹配查询
// 情况举例:用户可能他知道开头的前缀几个字,知道中间的几个字
Map<String, Object> map23 = new HashMap<>();
Map<String, Object> map33 = new HashMap<>();
Map<String, Object> map43 = new HashMap<>();
map23.put(field, selectValue);
if("serial_number".equals(field)){
map33.put("boost",10);
}else if("title".equals(field)){
map33.put("boost",10);
}else if("file_text".equals(field)){
map33.put("boost",0.01);
}else if("content".equals(field)){
map33.put("boost",0.01);
}else if("file_name".equals(field)){
map33.put("boost",10);
}
map33.put("query", selectValue);
map23.put(field, map33);
map43.put("match", map23);
queryMapJson.add(map43);
@@ -1519,7 +1532,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
Map<String, Object> map31 = new HashMap<>();
Map<String, Object> map41 = new HashMap<>();
if("title".equals(field)){
map31.put("boost",1);
map31.put("boost",10);
}else if("content".equals(field)){
map31.put("boost",0.01);
}
@@ -1533,7 +1546,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
Map<String, Object> map32 = new HashMap<>();
Map<String, Object> map42 = new HashMap<>();
if("title".equals(field)){
map32.put("boost",1);
map32.put("boost",10);
}else if("content".equals(field)){
map32.put("boost",0.01);
}
@@ -1545,8 +1558,15 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
// match分词匹配查询
// 情况举例:用户可能他知道开头的前缀几个字,知道中间的几个字
Map<String, Object> map23 = new HashMap<>();
Map<String, Object> map33 = new HashMap<>();
Map<String, Object> map43 = new HashMap<>();
map23.put(field, selectValue);
if("title".equals(field)){
map33.put("boost",10);
}else if("content".equals(field)){
map33.put("boost",0.01);
}
map33.put("query", selectValue);
map23.put(field, map33);
map43.put("match", map23);
queryMapJson.add(map43);
@@ -251,7 +251,7 @@ public class LawsMonthlyReportSearchServiceImpl implements ILawsMonthlyReportSea
if("title".equals(field)){
map31.put("boost",10);
}else if("content".equals(field)){
map31.put("boost",2);
map31.put("boost",0.01);
}
map31.put("value", selectValue);
map21.put(field + ".keyword", map31);
@@ -265,7 +265,7 @@ public class LawsMonthlyReportSearchServiceImpl implements ILawsMonthlyReportSea
if("title".equals(field)){
map32.put("boost",10);
}else if("content".equals(field)){
map32.put("boost",2);
map32.put("boost",0.01);
}
map32.put("query", selectValue);
map22.put(field, map32);
@@ -280,11 +280,10 @@ public class LawsMonthlyReportSearchServiceImpl implements ILawsMonthlyReportSea
if("title".equals(field)){
map33.put("boost",10);
}else if("content".equals(field)){
map33.put("boost",2);
map33.put("boost",0.01);
}
map33.put("query", selectValue);
map23.put(field, map33);
map23.put(field, selectValue);
map43.put("match", map23);
queryMapJson.add(map43);
+26 -21
View File
@@ -191,7 +191,7 @@
searchQuery() {
if (this.isDefault) {
let startTime = moment(new Date()).format('YYYY-MM-DD')
let endTime = this.haflYear()
let endTime = this.getNowdate()
if (this.queryParam['WarnTime'].length == 0) {
this.queryParam['WarnTime'] = [startTime, endTime]
}
@@ -203,7 +203,8 @@
this.queryParam = {}
if (this.isDefault) {
let startTime = moment(new Date()).format('YYYY-MM-DD')
let endTime = this.haflYear()
let endTime = this.getNowdate()
console.log(endTime)
this.queryParam['WarnTime'] = [startTime, endTime]
this.queryParam = { ...this.queryParam }
}
@@ -225,26 +226,30 @@
}
})
},
haflYear() {
//获取当前时间
var curDate = (new Date()).getTime()
// 将半年的时间单位换算成毫秒
var halfYear = 365 / 2 * 24 * 3600 * 1000
// 半年前的时间(毫秒单位)
var pastResult = curDate + halfYear
// 日期函数,定义起点为半年前
var pastDate = new Date(pastResult)
var pastYear = pastDate.getFullYear()
var pastMonth = pastDate.getMonth() + 1
var pastDay = pastDate.getDate()
if (pastMonth >= 1 && pastMonth <= 9) {
pastMonth = '0' + pastMonth
getNowdate(){
var date_now = new Date()//获取当前时间
var year = date_now.getFullYear()//获取当前时间的年份
var month = date_now.getMonth()//获取当前时间的月份
var day = date_now.getDate()//获取当前时间的日
var days = new Date(year,month,0)//将获取到的年月赋值给days
days = days.getDate()//获取当前年月的日
var year2 = year
var month2 = parseInt(month+7)//获取当前月份的1一个月以后的月份
if(month2 > 12){
year2 = parseInt(year2) + 1
month2 = parseInt(month2) % 12
}//考虑到12月要是获取一个月以后,就是一月,年份需要加一 ,一年没有13月,所以%12,取得来年1月
var day2 = day
var days2 = new Date(year2,month2,0)
days2 = days2.getDate()
if(day2>days2){
day2 = days2
}//获取了当前年份的日和6个月以后的日,为的就是判断如果前一个月是有31号,后一个月没有,就将一个月以后的日期取到,赋值给day2
if(month2 < 10){
month2 = '0' + month2
}
if (pastDay >= 0 && pastDay <= 9) {
pastDay = '0' + pastDay
}
var endDate = pastYear + '-' + pastMonth + '-' + (pastDay + 1)
return endDate
var time = year2 + '-' + month2 + '-' + day2
return time
},
dateChange(item) {
this.queryParam[item] = moment(this.queryParam[item]).format('YYYY-MM-DD')
@@ -273,32 +273,36 @@
},
clearSelected() {
let startTime = moment(new Date()).format('YYYY-MM-DD')
let endTime = this.haflYear()
let endTime = this.getNowdate()
this.searchParmes['WarnTime'] = [startTime, endTime]
this.searchParmes = { ...this.searchParmes }
this.pageNo = 1
this.getList()
},
haflYear() {
//获取当前时间
var curDate = (new Date()).getTime()
// 将半年的时间单位换算成毫秒
var halfYear = 365 / 2 * 24 * 3600 * 1000
// 半年前的时间(毫秒单位)
var pastResult = curDate + halfYear
// 日期函数,定义起点为半年前
var pastDate = new Date(pastResult)
var pastYear = pastDate.getFullYear()
var pastMonth = pastDate.getMonth() + 1
var pastDay = pastDate.getDate()
if (pastMonth >= 1 && pastMonth <= 9) {
pastMonth = '0' + pastMonth
getNowdate(){
var date_now = new Date()//获取当前时间
var year = date_now.getFullYear()//获取当前时间的年份
var month = date_now.getMonth()//获取当前时间的月份
var day = date_now.getDate()//获取当前时间的日
var days = new Date(year,month,0)//将获取到的年月赋值给days
days = days.getDate()//获取当前年月的日
var year2 = year
var month2 = parseInt(month+7)//获取当前月份的1一个月以后的月份
if(month2 > 12){
year2 = parseInt(year2) + 1
month2 = parseInt(month2) % 12
}//考虑到12月要是获取一个月以后,就是一月,年份需要加一 ,一年没有13月,所以%12,取得来年1月
var day2 = day
var days2 = new Date(year2,month2,0)
days2 = days2.getDate()
if(day2>days2){
day2 = days2
}//获取了当前年份的日和6个月以后的日,为的就是判断如果前一个月是有31号,后一个月没有,就将一个月以后的日期取到,赋值给day2
if(month2 < 10){
month2 = '0' + month2
}
if (pastDay >= 0 && pastDay <= 9) {
pastDay = '0' + pastDay
}
var endDate = pastYear + '-' + pastMonth + '-' + (pastDay + 1)
return endDate
var time = year2 + '-' + month2 + '-' + day2
return time
},
pageOnChange(page) {
this.pageNo = page