标题检索变更

This commit is contained in:
梁琦涛
2023-12-04 18:25:19 +08:00
parent a4902e6920
commit f859a51cf4
4 changed files with 192 additions and 75 deletions
@@ -91,7 +91,7 @@ public class HomeSearchCheckEsPlanJob implements Job {
if(!CollectionUtils.isEmpty(listLawsNewsFeed)){
m4 = listLawsNewsFeed.size();
}
if(count4 != m4){
if(count4 != m4 || !StringUtils.isBlank(resourceType)){
// 清理数据重新更新
delete(resourceType);
if(!CollectionUtils.isEmpty(listLawsNewsFeed)){
@@ -108,7 +108,7 @@ public class HomeSearchCheckEsPlanJob implements Job {
if(!CollectionUtils.isEmpty(listLawsEnterpriseStandard)){
m3 = listLawsEnterpriseStandard.size();
}
if(count3 != m3){
if(count3 != m3 || !StringUtils.isBlank(resourceType)){
// 清理数据重新更新
delete(resourceType);
if(!CollectionUtils.isEmpty(listLawsEnterpriseStandard)){
@@ -125,7 +125,7 @@ public class HomeSearchCheckEsPlanJob implements Job {
if(!CollectionUtils.isEmpty(listLawsOverseasStandard)){
m2 = listLawsOverseasStandard.size();
}
if(count2 != m2){
if(count2 != m2 || !StringUtils.isBlank(resourceType)){
// 清理数据重新更新
delete(resourceType);
if(!CollectionUtils.isEmpty(listLawsOverseasStandard)){
@@ -143,7 +143,7 @@ public class HomeSearchCheckEsPlanJob implements Job {
if(!CollectionUtils.isEmpty(listLawsDomesticStandard)){
m1 = listLawsDomesticStandard.size();
}
if(count1 != m1){
if(count1 != m1 || !StringUtils.isBlank(resourceType)){
// 清理数据重新更新
delete(resourceType);
if(!CollectionUtils.isEmpty(listLawsDomesticStandard)){
@@ -57,7 +57,7 @@ import org.springframework.util.ReflectionUtils;
import javax.annotation.Resource;
import java.lang.reflect.Field;
import java.time.LocalDate;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ForkJoinPool;
@@ -113,6 +113,8 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
public static final String STANDARD_PROPERTY = "standard_property";
public static final String CONTENT = "content";
public static final String SYNC_ES_ERR = "同步ES数据异常:";
public static final String YYYY_MM_DD = "yyyy-MM-dd";
public static final String IMPLEMENTATION_DATE = "implementation_date";
@@ -151,7 +153,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
queryWrapper.orderByAsc("length(REPLACE(standard_name,'" + lawsHomeNormalSearchDTO.getSearchContent() + "',''))/length(standard_name)");
queryWrapper.orderByAsc("standard_type_order");
queryWrapper.orderByAsc("standard_state_order");
queryWrapper.orderByDesc("implementation_date");
queryWrapper.orderByDesc(IMPLEMENTATION_DATE);
queryWrapper.orderByDesc(CREATE_TIME);
return queryWrapper;
}
@@ -181,26 +183,24 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
List<LawsNewsFeed> listLawsNewsFeed = listLawsNewsFeed(lawsNewsFeedIds);
LambdaQueryWrapper<LawsTag> query = new LambdaQueryWrapper<>();
query.select(LawsTag::getTableName,LawsTag::getDbFieldName,LawsTag::getDbFieldTxt,LawsTag::getDictField,LawsTag::getDictTable,LawsTag::getDictText,LawsTag::getHomeSearchContextOrder);
query.select(LawsTag::getTableName,LawsTag::getDbFieldName,LawsTag::getDbFieldTxt, LawsTag::getDbType,LawsTag::getDictFieldSearch,LawsTag::getDictTableSearch,LawsTag::getDictTextSearch,LawsTag::getHomeSearchContextOrder);
query.in(LawsTag::getTableName, Arrays.asList(LawsHomeSearchCommon.LAWS_DOMESTIC_STANDARD_TABLE_NAME,
LawsHomeSearchCommon.LAWS_OVERSEAS_STANDARD_TABLE_NAME,LawsHomeSearchCommon.LAWS_ENTERPRISE_STANDARD_TABLE_NAME));
query.isNotNull(LawsTag::getHomeSearchContextOrder);
query.orderByAsc(LawsTag::getHomeSearchContextOrder);
List<LawsTag> listLawsTag = lawsTagService.list(query);
List<SysDictItemCore> listSysDict = getSysDictItemCores(listLawsTag);
long l = System.currentTimeMillis();
String yyyyMMdd = "yyyy-MM-dd";
list.parallelStream().forEach(p->{
switch (p.getResourceType()){
case LawsHomeSearchCommon.LAWS_DOMESTIC_STANDARD:
addLawsDomesticStandard(listSysDict,searchContent, searchContentSpan, listLawsDomesticStandard, listLawsTag, yyyyMMdd, p);
addLawsDomesticStandard(searchContent, searchContentSpan, listLawsDomesticStandard, listLawsTag, p);
break;
case LawsHomeSearchCommon.LAWS_OVERSEAS_STANDARD:
addLawsOverseasStandard(listSysDict,searchContent, searchContentSpan, listLawsOverseasStandard, listLawsTag, yyyyMMdd, p);
addLawsOverseasStandard(searchContent, searchContentSpan, listLawsOverseasStandard, listLawsTag, p);
break;
case LawsHomeSearchCommon.LAWS_ENTERPRISE_STANDARD:
addLawsEnterpriseStandard(listSysDict,searchContent, searchContentSpan, listLawsEnterpriseStandard, listLawsTag, yyyyMMdd, p);
addLawsEnterpriseStandard(searchContent, searchContentSpan, listLawsEnterpriseStandard, listLawsTag, p);
break;
default:
addLawsNewsFeed(searchContent, searchContentSpan, listLawsNewsFeed, p);
@@ -215,9 +215,9 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
private List<SysDictItemCore> getSysDictItemCores(List<LawsTag> listLawsTag) {
List<SysDictItemCore> listSysDict = new ArrayList<>();
if(!CollectionUtils.isEmpty(listLawsTag)){
List<LawsTag> listLawsTagDict = listLawsTag.stream().filter(o->!StringUtils.isBlank(o.getDictField()) && StringUtils.isBlank(o.getDictTable())).collect(Collectors.toList());
List<LawsTag> listLawsTagDict = listLawsTag.stream().filter(o->!StringUtils.isBlank(o.getDictFieldSearch()) && StringUtils.isBlank(o.getDictTableSearch())).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(listLawsTagDict)){
List<String> listDict = listLawsTagDict.stream().map(LawsTag::getDictField).collect(Collectors.toList());
List<String> listDict = listLawsTagDict.stream().map(LawsTag::getDictFieldSearch).collect(Collectors.toList());
QueryWrapper<SysDict> querySysDict = new QueryWrapper<>();
querySysDict.in("sys_dict.dict_code",listDict);
listSysDict = lawsHomeSearchMapper.translateManyDict(querySysDict);
@@ -239,7 +239,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
}
}
private void addLawsEnterpriseStandard(List<SysDictItemCore> listSysDict,String searchContent, String searchContentSpan, List<LawsEnterpriseStandard> listLawsEnterpriseStandard, List<LawsTag> listLawsTag, String yyyyMMdd, LawsHomeNormalSearchVO p) {
private void addLawsEnterpriseStandard(String searchContent, String searchContentSpan, List<LawsEnterpriseStandard> listLawsEnterpriseStandard, List<LawsTag> listLawsTag, LawsHomeNormalSearchVO p) {
if(!CollectionUtils.isEmpty(listLawsEnterpriseStandard)){
Optional<LawsEnterpriseStandard> op = listLawsEnterpriseStandard.stream().filter(o-> Objects.equals(o.getId(),p.getId())).findFirst();
if(op.isPresent()){
@@ -247,13 +247,13 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
p.setTitle((obj.getStandardNumber() + " " + obj.getStandardName()).replace(searchContent,searchContentSpan));
p.setReleaseDate(obj.getReleaseDate());
// 生成正文
JSONObject json = JSON.parseObject(JSON.toJSONStringWithDateFormat(obj,yyyyMMdd));
addContent(listSysDict,p,json, obj, LawsHomeSearchCommon.LAWS_ENTERPRISE_STANDARD_TABLE_NAME,listLawsTag);
JSONObject json = JSON.parseObject(JSON.toJSONStringWithDateFormat(obj,YYYY_MM_DD));
addContent(p,json, obj, LawsHomeSearchCommon.LAWS_ENTERPRISE_STANDARD_TABLE_NAME,listLawsTag);
}
}
}
private void addLawsOverseasStandard(List<SysDictItemCore> listSysDict,String searchContent, String searchContentSpan, List<LawsOverseasStandard> listLawsOverseasStandard, List<LawsTag> listLawsTag, String yyyyMMdd, LawsHomeNormalSearchVO p) {
private void addLawsOverseasStandard(String searchContent, String searchContentSpan, List<LawsOverseasStandard> listLawsOverseasStandard, List<LawsTag> listLawsTag, LawsHomeNormalSearchVO p) {
if(!CollectionUtils.isEmpty(listLawsOverseasStandard)){
Optional<LawsOverseasStandard> op = listLawsOverseasStandard.stream().filter(o-> Objects.equals(o.getId(),p.getId())).findFirst();
if(op.isPresent()){
@@ -261,13 +261,13 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
p.setTitle((obj.getStandardNumber() + " " + obj.getStandardName()).replace(searchContent,searchContentSpan));
p.setReleaseDate(obj.getReleaseDate());
// 生成正文
JSONObject json = JSON.parseObject(JSON.toJSONStringWithDateFormat(obj,yyyyMMdd));
addContent(listSysDict,p, json,obj, LawsHomeSearchCommon.LAWS_OVERSEAS_STANDARD_TABLE_NAME,listLawsTag);
JSONObject json = JSON.parseObject(JSON.toJSONStringWithDateFormat(obj,YYYY_MM_DD));
addContent(p, json,obj, LawsHomeSearchCommon.LAWS_OVERSEAS_STANDARD_TABLE_NAME,listLawsTag);
}
}
}
private void addLawsDomesticStandard(List<SysDictItemCore> listSysDict,String searchContent, String searchContentSpan, List<LawsDomesticStandard> listLawsDomesticStandard, List<LawsTag> listLawsTag,String yyyyMMdd, LawsHomeNormalSearchVO p) {
private void addLawsDomesticStandard(String searchContent, String searchContentSpan, List<LawsDomesticStandard> listLawsDomesticStandard, List<LawsTag> listLawsTag, LawsHomeNormalSearchVO p) {
if(!CollectionUtils.isEmpty(listLawsDomesticStandard)){
Optional<LawsDomesticStandard> op = listLawsDomesticStandard.stream().filter(o-> Objects.equals(o.getId(),p.getId())).findFirst();
if(op.isPresent()){
@@ -275,8 +275,8 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
p.setTitle((obj.getStandardNumber() + " " + obj.getStandardName()).replace(searchContent,searchContentSpan));
p.setReleaseDate(obj.getReleaseDate());
// 生成正文
JSONObject json = JSON.parseObject(JSON.toJSONStringWithDateFormat(obj,yyyyMMdd));
addContent(listSysDict,p, json,obj, LawsHomeSearchCommon.LAWS_DOMESTIC_STANDARD_TABLE_NAME,listLawsTag);
JSONObject json = JSON.parseObject(JSON.toJSONStringWithDateFormat(obj,YYYY_MM_DD));
addContent(p, json,obj, LawsHomeSearchCommon.LAWS_DOMESTIC_STANDARD_TABLE_NAME,listLawsTag);
}
}
}
@@ -313,7 +313,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
return listLawsDomesticStandard;
}
private void addContent(List<SysDictItemCore> listSysDict,LawsHomeNormalSearchVO p, JSONObject json,Object object,String tableName, List<LawsTag> listLawsTagAll) {
private void addContent(LawsHomeNormalSearchVO p, JSONObject json,Object object,String tableName, List<LawsTag> listLawsTagAll) {
if (CollectionUtils.isEmpty(listLawsTagAll)) {
return;
}
@@ -324,9 +324,9 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
listLawsTag = listLawsTag.stream().sorted(Comparator.comparing(LawsTag::getHomeSearchContextOrder)).collect(Collectors.toList());
StringBuilder str = new StringBuilder();
for (LawsTag lawsTag : listLawsTag) {
String code = lawsTag.getDictField();
String text = lawsTag.getDictText();
String table = lawsTag.getDictTable();
String code = lawsTag.getDictFieldSearch();
String text = lawsTag.getDictTextSearch();
String table = lawsTag.getDictTableSearch();
String type = lawsTag.getDbType();
String fieldName = lawsTag.getDbFieldName();
String fieldTxt = lawsTag.getDbFieldTxt();
@@ -338,7 +338,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
String textValue = "";
// 需要翻译
if (!StringUtils.isBlank(code) && !StringUtils.isBlank(key)) {
textValue = translateDictValue(listSysDict,code, text, table, key);
textValue = translateDictValue(code, text, table, key);
}else{
// 不需要翻译,直接取值
textValue = getString(object, type, fieldName, textValue);
@@ -362,7 +362,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
continue;
}
if(Objects.equals(type,"Date")){
textValue = LocalDate.parse(String.valueOf(obj)).toString();
textValue = new SimpleDateFormat(YYYY_MM_DD).format(obj);
}else{
textValue = String.valueOf(obj);
}
@@ -380,9 +380,8 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
* @param text 值
* @param table 表名
* @param key 键
* @param listSysDict 字典集合
*/
private String translateDictValue(List<SysDictItemCore> listSysDict,String code, String text, String table, String key) {
private String translateDictValue(String code, String text, String table, String key) {
if(oConvertUtils.isEmpty(key)) {
return null;
}
@@ -393,7 +392,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
if (k.trim().length() == 0) {
continue; //跳过循环
}
tmpValue = getTmpValue(listSysDict,code, text, table, k, tmpValue);
tmpValue = getTmpValue(code, text, table, k);
if (tmpValue != null) {
if (!"".equals(textValue.toString())) {
textValue.append(",");
@@ -407,14 +406,12 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
return textValue.toString();
}
private String getTmpValue(List<SysDictItemCore> listSysDict,String code, String text, String table, String k, String tmpValue) {
private String getTmpValue(String code, String text, String table, String k) {
String tmpValue;
if (!StringUtils.isEmpty(table)){
tmpValue = commonAPI.queryTableDictTextByKey(table,text,code,k.trim());
}else {
List<SysDictItemCore> listNew = listSysDict.stream().filter(o-> Objects.equals(o.getDictCode(),code) && Objects.equals(o.getItemValue(),k.trim())).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(listNew)){
tmpValue = listNew.get(0).getItemText();
}
tmpValue = commonAPI.translateDict(code, k.trim());
}
return tmpValue;
}
@@ -619,31 +616,73 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
all.put("bool",jsonAll);
queryMapJsonAll.add(all);
}
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<>();
mDesc1.put(order,"desc");
m1.put("_score",mDesc1);
sort.add(m1);
JSONObject sort = new JSONObject();
Map<String,Object> issueTimeDesc = new HashMap<>();
Map<String,Object> issueTime = new HashMap<>();
issueTimeDesc.put("order","desc");
issueTime.put(CREATE_TIME,issueTimeDesc);
sort.putAll(issueTime);
IPage page = getIPage(searchContent, queryMapJsonAll, mapHighlight1,
Map<String,Object> m2 = new HashMap<>();
Map<String,Object> mAsc2 = new HashMap<>();
mAsc2.put(order,"asc");
m2.put("standard_type_order.keyword",mAsc2);
sort.add(m2);
Map<String,Object> m3 = new HashMap<>();
Map<String,Object> mAsc3 = new HashMap<>();
mAsc3.put(order,"asc");
m3.put("standard_state_order.keyword",mAsc3);
sort.add(m3);
Map<String,Object> m4 = new HashMap<>();
Map<String,Object> mDesc4 = new HashMap<>();
mDesc4.put(order,"desc");
m4.put(IMPLEMENTATION_DATE,mDesc4);
sort.add(m4);
Map<String,Object> m5 = new HashMap<>();
Map<String,Object> mDesc5 = new HashMap<>();
mDesc5.put(order,"desc");
m5.put(CREATE_TIME,mDesc5);
sort.add(m5);
IPage page = getIPage(queryMapJsonAll, mapHighlight1,
pageNo, pageSize, sort);
getRecords(page);
return page;
}
private void getRecords(IPage page) {
if(!CollectionUtils.isEmpty(page.getRecords())){
// 下划线转驼峰
List<Map<String, Object>> listNew = new ArrayList<>();
List<Map<String, Object>> list = page.getRecords();
list.forEach(p->{
Map<String,Object> map = new HashMap<>();
p.forEach((k,v)->{
String resultStr = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, k);
map.put(resultStr,v);
});
Map<String, Object> map = getStringObjectMap(p);
String releaseDate = "releaseDate";
if(map.containsKey(releaseDate)){
map.put(releaseDate,new SimpleDateFormat(YYYY_MM_DD).format(Long.parseLong(map.get(releaseDate).toString())));
}
listNew.add(map);
});
page.setRecords(listNew);
}
return page;
}
@NotNull
private Map<String, Object> getStringObjectMap(Map<String, Object> p) {
Map<String,Object> map = new HashMap<>();
p.forEach((k,v)->{
String resultStr = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, k);
map.put(resultStr,v);
});
return map;
}
@NotNull
@@ -657,15 +696,11 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
@NotNull
private IPage getIPage(String selectValue,JSONArray queryMapJson,Map<String,Object> highlightMap, Integer pageNo, Integer pageSize,
JSONObject querySort) {
private IPage getIPage(JSONArray queryMapJson,Map<String,Object> highlightMap, Integer pageNo, Integer pageSize,
JSONArray jsonArraySort) {
JSONObject jsonObject;
//基础添加封装
jsonObject = jeroElasticsearchTemplate.buildBoolQuery(queryMapJson, null, null);
JSONArray jsonArraySort = new JSONArray();
if (SEARCH_FLAG.equals(selectValue)) {
jsonArraySort.add(querySort);
}
//1. 条件,分页
JSONObject queryObject = jeroElasticsearchTemplate.buildQuery(null, jsonObject, highlightMap, jsonArraySort, pageNo - 1, pageSize);
//2. 数据查询
@@ -918,22 +953,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
List<LawsDomesticStandard> listLawsDomesticStandard = lawsDomesticStandardService.listByIds(listIdsSub);
CompletableFuture.runAsync(()->{
for (LawsDomesticStandard lawsDomesticStandard : listLawsDomesticStandard) {
try {
LawsHomeNormalSearchVO obj = new LawsHomeNormalSearchVO();
obj.setId(lawsDomesticStandard.getId());
obj.setTitle(lawsDomesticStandard.getStandardNumber() + " " + lawsDomesticStandard.getStandardName());
obj.setResourceType(resourceType);
obj.setReleaseDate(lawsDomesticStandard.getReleaseDate());
obj.setStandardClass(lawsDomesticStandard.getStandardClass());
obj.setDynamicType(lawsDomesticStandard.getDynamicType());
obj.setApplicableVehicle(lawsDomesticStandard.getApplicableVehicle());
obj.setStandardProperty(lawsDomesticStandard.getStandardProperty());
obj.setStandardState(lawsDomesticStandard.getStandardState());
List<OSSFile> listFile = getOssFilesLawsDomesticStandard(lawsDomesticStandard);
updateES(opType, obj, listFile, lawsDomesticStandard.getId());
}catch (Exception e){
log.error(SYNC_ES_ERR,e.getMessage());
}
createData(resourceType, opType, lawsDomesticStandard);
}
},pool);
// 下一批
@@ -942,6 +962,41 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
return false;
}
private void createData(String resourceType, String opType, LawsDomesticStandard lawsDomesticStandard) {
try {
LawsHomeNormalSearchVO obj = new LawsHomeNormalSearchVO();
obj.setId(lawsDomesticStandard.getId());
obj.setTitle(lawsDomesticStandard.getStandardNumber() + " " + lawsDomesticStandard.getStandardName());
obj.setResourceType(resourceType);
switch (lawsDomesticStandard.getStandardClass()){
case "GB": obj.setStandardTypeOrder("1");break;
case "GB/T": obj.setStandardTypeOrder("2");break;
case "JT": obj.setStandardTypeOrder("3");break;
case "QC/T": obj.setStandardTypeOrder("4");break;
case "HJ": obj.setStandardTypeOrder("5");break;
default: obj.setStandardTypeOrder("8");break;
}
switch (lawsDomesticStandard.getStandardState()){
case "5": obj.setStandardStateOrder("2");break;
case "6": obj.setStandardStateOrder("1");break;
case "7": obj.setStandardStateOrder("3");break;
default: obj.setStandardTypeOrder("");break;
}
obj.setImplementationDate(lawsDomesticStandard.getImplementationDate());
obj.setCreateTime(lawsDomesticStandard.getCreateTime());
obj.setReleaseDate(lawsDomesticStandard.getReleaseDate());
obj.setStandardClass(lawsDomesticStandard.getStandardClass());
obj.setDynamicType(lawsDomesticStandard.getDynamicType());
obj.setApplicableVehicle(lawsDomesticStandard.getApplicableVehicle());
obj.setStandardProperty(lawsDomesticStandard.getStandardProperty());
obj.setStandardState(lawsDomesticStandard.getStandardState());
List<OSSFile> listFile = getOssFilesLawsDomesticStandard(lawsDomesticStandard);
updateES(opType, obj, listFile, lawsDomesticStandard.getId());
}catch (Exception e){
log.error(SYNC_ES_ERR,e.getMessage());
}
}
@NotNull
private List<OSSFile> getOssFilesLawsDomesticStandard(LawsDomesticStandard lawsDomesticStandard) {
// 从过程稿件从上到下顺序检索;如果文档里有发布稿,只检索发布稿
@@ -1009,6 +1064,17 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
obj.setId(lawsOverseasStandard.getId());
obj.setTitle(lawsOverseasStandard.getStandardNumber() + " " + lawsOverseasStandard.getStandardName());
obj.setResourceType(resourceType);
obj.setStandardTypeOrder("7");
switch (lawsOverseasStandard.getStandardState()){
case "5": obj.setStandardStateOrder("2");break;
case "6": obj.setStandardStateOrder("1");break;
case "7": obj.setStandardStateOrder("3");break;
default: obj.setStandardTypeOrder("");break;
}
obj.setImplementationDate(lawsOverseasStandard.getImplementationDate());
obj.setCreateTime(lawsOverseasStandard.getCreateTime());
obj.setReleaseDate(lawsOverseasStandard.getReleaseDate());
obj.setStandardClass(lawsOverseasStandard.getStandardClass());
obj.setApplicableVehicle(lawsOverseasStandard.getApplicableVehicle());
@@ -1086,6 +1152,16 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
obj.setId(lawsEnterpriseStandard.getId());
obj.setTitle(lawsEnterpriseStandard.getStandardNumber() + " " + lawsEnterpriseStandard.getStandardName());
obj.setResourceType(resourceType);
obj.setStandardTypeOrder("6");
switch (lawsEnterpriseStandard.getStandardState()){
case "5": obj.setStandardStateOrder("2");break;
case "6": obj.setStandardStateOrder("1");break;
case "7": obj.setStandardStateOrder("3");break;
default: obj.setStandardTypeOrder("");break;
}
obj.setImplementationDate(lawsEnterpriseStandard.getImplementationDate());
obj.setCreateTime(lawsEnterpriseStandard.getCreateTime());
obj.setReleaseDate(lawsEnterpriseStandard.getReleaseDate());
obj.setStandardState(lawsEnterpriseStandard.getStandardState());
obj.setStandardCode(lawsEnterpriseStandard.getStandardCode());
@@ -1153,6 +1229,9 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
obj.setId(lawsNewsFeed.getId());
obj.setTitle(lawsNewsFeed.getDynamicHeading());
obj.setResourceType(resourceType);
obj.setStandardTypeOrder("9");
obj.setReleaseDate(lawsNewsFeed.getReleaseTime());
obj.setCreateTime(lawsNewsFeed.getCreateTime());
updateESLawsNewsFeed(opType, lawsNewsFeed, obj);
}catch (Exception e){
log.error(SYNC_ES_ERR,e.getMessage());
@@ -1216,6 +1295,10 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
map.put("title", obj.getTitle());
map.put(CONTENT, fileTextAll);
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());
@@ -1224,7 +1307,8 @@ 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(CREATE_TIME,new Date());
map.put("release_date",obj.getReleaseDate());
map.put("create_time_c",new Date());
//添加es
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(map));
try {
@@ -85,7 +85,21 @@ public class LawsHomeNormalSearchVO implements Serializable {
private String gradeClassification;
/**
* 如果是国内的情况,排序规则按照:GB、 GBT(GB/T) 、 其他标准 的方式排序
* 国内(GB、GB/T、JT、QC/T、HJ)/企标/海外/其他行业标准/动态
*/
private String standardType;
private String standardTypeOrder;
/**
* 现行有效>即将实施>废止
*/
private String standardStateOrder;
/**
* 实施时间
*/
private Date implementationDate;
/**
* 实施时间
*/
private Date createTime;
}
@@ -394,6 +394,25 @@ public class LawsTag implements Serializable {
@ApiModelProperty(value = "字典id")
private String dictId;
/**
* 字典code(一般检索使用)
*/
@ApiModelProperty(value = "字典code")
private String dictFieldSearch;
/**
* 字典表(一般检索使用)
*/
@ApiModelProperty(value = "字典表")
private String dictTableSearch;
/**
* 字典Text(一般检索使用)
*/
@ApiModelProperty(value = "字典Text")
private String dictTextSearch;
private static final long serialVersionUID = 1L;
/**
* 所属部门