fix:79093

This commit is contained in:
梁琦涛
2023-12-07 15:55:23 +08:00
parent 48569cd955
commit 5967d6249f
3 changed files with 28 additions and 118 deletions
@@ -3,6 +3,7 @@ package com.jero.modules.laws.home.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -55,6 +56,7 @@ import org.springframework.util.ReflectionUtils;
import javax.annotation.Resource;
import java.lang.reflect.Field;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.CompletableFuture;
@@ -661,10 +663,6 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
}
String order = "order";
JSONArray sort = new JSONArray();
Map<String,Object> mDesc = new HashMap<>();
mDesc.put(order,"desc");
Map<String,Object> mAsc = new HashMap<>();
mAsc.put(order,"asc");
Map<String,Object> m1 = new HashMap<>();
Map<String,Object> mDesc1 = new HashMap<>();
@@ -693,7 +691,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
Map<String,Object> m5 = new HashMap<>();
Map<String,Object> mDesc5 = new HashMap<>();
mDesc5.put(order,"desc");
m5.put(CREATE_TIME,mDesc5);
m5.put("create_time_c",mDesc5);
sort.add(m5);
IPage page = getIPage(queryMapJsonAll, mapHighlight1,
pageNo, pageSize, sort);
@@ -944,12 +942,6 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
ForkJoinPool pool = new ForkJoinPool();
CompletableFuture.runAsync(()->{
try{
//判断索引是否存在
boolean flagTemp;
flagTemp = jeroElasticsearchTemplate.indexExists(HomeSearchEnum.INDEX_NAME_DOCUMENT_ZQ.getValue());
if (!flagTemp) {
jeroElasticsearchTemplate.createIndex(HomeSearchEnum.INDEX_NAME_DOCUMENT_ZQ.getValue());
}
switch (resourceType){
case LawsHomeSearchCommon.LAWS_DOMESTIC_STANDARD:
updateLawsDomesticStandardToEs(resourceType,ids,opType);
@@ -1016,10 +1008,10 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
case "5": obj.setStandardStateOrder("2");break;
case "6": obj.setStandardStateOrder("1");break;
case "7": obj.setStandardStateOrder("3");break;
default: obj.setStandardTypeOrder("");break;
default: obj.setStandardStateOrder("4");break;
}
obj.setImplementationDate(getImplementationDate(lawsDomesticStandard.getImplementationDate()));
obj.setCreateTime(getImplementationDate(lawsDomesticStandard.getCreateTime()));
obj.setImplementationDate(lawsDomesticStandard.getImplementationDate());
obj.setCreateTime(lawsDomesticStandard.getCreateTime());
obj.setReleaseDate(lawsDomesticStandard.getReleaseDate());
obj.setStandardClass(lawsDomesticStandard.getStandardClass());
obj.setDynamicType(lawsDomesticStandard.getDynamicType());
@@ -1106,11 +1098,10 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
case "5": obj.setStandardStateOrder("2");break;
case "6": obj.setStandardStateOrder("1");break;
case "7": obj.setStandardStateOrder("3");break;
default: obj.setStandardTypeOrder("");break;
default: obj.setStandardStateOrder("4");break;
}
obj.setImplementationDate(getImplementationDate(lawsOverseasStandard.getImplementationDate()));
obj.setCreateTime(getImplementationDate(lawsOverseasStandard.getCreateTime()));
obj.setImplementationDate(lawsOverseasStandard.getImplementationDate());
obj.setCreateTime(lawsOverseasStandard.getCreateTime());
obj.setReleaseDate(lawsOverseasStandard.getReleaseDate());
obj.setStandardClass(lawsOverseasStandard.getStandardClass());
obj.setApplicableVehicle(lawsOverseasStandard.getApplicableVehicle());
@@ -1194,10 +1185,10 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
case "5": obj.setStandardStateOrder("2");break;
case "6": obj.setStandardStateOrder("1");break;
case "7": obj.setStandardStateOrder("3");break;
default: obj.setStandardTypeOrder("");break;
default: obj.setStandardStateOrder("4");break;
}
obj.setImplementationDate(getImplementationDate(lawsEnterpriseStandard.getImplementationDate()));
obj.setCreateTime(getImplementationDate(lawsEnterpriseStandard.getCreateTime()));
obj.setImplementationDate(lawsEnterpriseStandard.getImplementationDate());
obj.setCreateTime(lawsEnterpriseStandard.getCreateTime());
obj.setReleaseDate(lawsEnterpriseStandard.getReleaseDate());
obj.setStandardState(lawsEnterpriseStandard.getStandardState());
obj.setStandardCode(lawsEnterpriseStandard.getStandardCode());
@@ -1271,8 +1262,9 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
obj.setTitle(lawsNewsFeed.getDynamicHeading());
obj.setResourceType(resourceType);
obj.setStandardTypeOrder("9");
obj.setStandardState("4");
obj.setReleaseDate(lawsNewsFeed.getReleaseTime());
obj.setCreateTime(getImplementationDate(lawsNewsFeed.getCreateTime()));
obj.setCreateTime(lawsNewsFeed.getCreateTime());
updateESLawsNewsFeed(opType, lawsNewsFeed, obj);
}catch (Exception e){
log.error(SYNC_ES_ERR,e.getMessage());
@@ -1330,7 +1322,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
}
}
private void addES(LawsHomeNormalSearchVO obj, String idTemp, StringBuilder fileTextAll) {
private void addES(LawsHomeNormalSearchVO obj, String idTemp, StringBuilder fileTextAll){
Map<String, Object> map = new HashMap<>();
map.put("id", obj.getId());
map.put("title", obj.getTitle());
@@ -1338,8 +1330,6 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
map.put(RESOURCE_TYPE, obj.getResourceType());
map.put("standard_type_order", obj.getStandardTypeOrder());
map.put("standard_state_order", obj.getStandardStateOrder());
map.put(IMPLEMENTATION_DATE,obj.getImplementationDate());
map.put(CREATE_TIME,obj.getCreateTime());
map.put(STANDARD_CLASS, obj.getStandardClass());
map.put(DYNAMIC_TYPE, obj.getDynamicType());
map.put(APPLICABLE_VEHICLE, obj.getApplicableVehicle());
@@ -1348,10 +1338,17 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
map.put(STANDARD_CODE,obj.getStandardCode());
map.put(ENTERPRISE_STANDARD_STATE,obj.getEnterpriseStandardState());
map.put(GRADE_CLASSIFICATION,obj.getGradeClassification());
map.put("release_date",Objects.isNull(obj.getReleaseDate()) ? "" : new SimpleDateFormat(YYYY_MM_DD).format(obj.getReleaseDate()));
map.put("create_time_c",new Date());
map.put("release_date",obj.getReleaseDate());
// 没有时间 强行加入最早时间
try {
map.put(IMPLEMENTATION_DATE,Objects.isNull(obj.getImplementationDate()) ? new SimpleDateFormat(YYYY_MM_DD).parse("1900-01-01") : obj.getImplementationDate());
map.put("create_time_c",Objects.isNull(obj.getCreateTime()) ? new SimpleDateFormat(YYYY_MM_DD).parse("1900-01-01") : obj.getCreateTime());
}catch (Exception e){
log.error("文档库添加es失败",e);
}
map.put("es_create_time",new Date());
//添加es
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(map));
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(map, SerializerFeature.WriteMapNullValue));
try {
jeroElasticsearchTemplate.saveOrUpdate(HomeSearchEnum.INDEX_NAME_DOCUMENT_ZQ.getValue(), HomeSearchEnum.TYPE_NAME_DOCUMENT_ZQ.getValue(), idTemp, jsonObject);
} catch (Exception e) {
@@ -97,9 +97,9 @@ public class LawsHomeNormalSearchVO implements Serializable {
/**
* 实施时间
*/
private String implementationDate;
private Date implementationDate;
/**
* 实施时间
* 入库时间
*/
private String createTime;
private Date createTime;
}