parent
d790b9c214
commit
cdb77112b3
@ -0,0 +1,43 @@
|
||||
package com.mashibing.search.utils;
|
||||
|
||||
import com.mashibing.common.model.StandardReport;
|
||||
import org.elasticsearch.search.SearchService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-27 16:26
|
||||
*/
|
||||
public class SearchUtils {
|
||||
|
||||
/**
|
||||
* 索引前缀
|
||||
*/
|
||||
public final static String INDEX = "sm_submit_log_";
|
||||
|
||||
/**
|
||||
* 获取年份信息
|
||||
* @return
|
||||
*/
|
||||
public static String getYear(){
|
||||
return LocalDateTime.now().getYear() + "";
|
||||
}
|
||||
|
||||
private static ThreadLocal<StandardReport> reportThreadLocal = new ThreadLocal<>();
|
||||
|
||||
public static void set(StandardReport report){
|
||||
reportThreadLocal.set(report);
|
||||
}
|
||||
|
||||
public static StandardReport get(){
|
||||
return reportThreadLocal.get();
|
||||
}
|
||||
|
||||
public static void remove(){
|
||||
reportThreadLocal.remove();
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in new issue