|
@@ -14,10 +14,13 @@ import co.elastic.clients.elasticsearch.core.search.FieldCollapse;
|
|
|
import co.elastic.clients.elasticsearch.core.search.Hit;
|
|
|
import co.elastic.clients.json.JsonData;
|
|
|
import com.example.xiaoshiweixinback.business.common.base.Records;
|
|
|
+import com.example.xiaoshiweixinback.business.common.base.RedisConf;
|
|
|
+import com.example.xiaoshiweixinback.business.redis.RedisService;
|
|
|
import com.example.xiaoshiweixinback.business.utils.BeanUtil;
|
|
|
import com.example.xiaoshiweixinback.business.utils.parseQueryToTree.expressManager;
|
|
|
import com.example.xiaoshiweixinback.business.utils.parseQueryToTree.operateNode;
|
|
|
import com.example.xiaoshiweixinback.business.utils.parseQueryToTree.treeNode;
|
|
|
+import com.example.xiaoshiweixinback.domain.AssoPersonFunction;
|
|
|
import com.example.xiaoshiweixinback.domain.Product;
|
|
|
import com.example.xiaoshiweixinback.domain.es.PatentVector;
|
|
|
import com.example.xiaoshiweixinback.entity.dto.esPicture.EsPictureNoDTO;
|
|
@@ -28,6 +31,7 @@ import com.example.xiaoshiweixinback.entity.vo.esPicture.EsPictureNoVo;
|
|
|
import com.example.xiaoshiweixinback.entity.vo.esPicture.EsPatentVectorVo;
|
|
|
import com.example.xiaoshiweixinback.mapper.ProductMapper;
|
|
|
import com.example.xiaoshiweixinback.service.SearchRecordService;
|
|
|
+import com.example.xiaoshiweixinback.service.VipService;
|
|
|
import com.example.xiaoshiweixinback.service.common.FileManagerService;
|
|
|
import com.example.xiaoshiweixinback.service.common.GetVectorService;
|
|
|
import com.example.xiaoshiweixinback.service.importPatent.FormatQueryService;
|
|
@@ -71,6 +75,12 @@ public class EsDenseVectorService {
|
|
|
@Autowired
|
|
|
private EsPatentService esPatentService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private VipService vipService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private RedisService redisService;
|
|
|
+
|
|
|
/**
|
|
|
* 根据图片排序获取列表
|
|
|
*
|
|
@@ -79,16 +89,20 @@ public class EsDenseVectorService {
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
|
|
|
- public Records getPatentVectors(EsPatentVectorDTO dto,File file) throws Exception {
|
|
|
+ public Records getPatentVectors(EsPatentVectorDTO dto, File file) throws Exception {
|
|
|
Long pageNum = dto.getPageNum();
|
|
|
Long pageSize = dto.getPageSize();
|
|
|
Boolean ifAddSearchRecord = dto.getIfAddSearchRecord();
|
|
|
|
|
|
+ AssoPersonFunction assoPersonFunction = vipService.getAssoPersonFunction("3");
|
|
|
+ if (assoPersonFunction == null) {
|
|
|
+
|
|
|
+ }
|
|
|
SearchRequest.Builder builder = new SearchRequest.Builder();
|
|
|
//设置查询索引
|
|
|
builder.index("patent_vector");
|
|
|
Query q = null;
|
|
|
- String condition = this.appendCondition(dto.getProductId(), dto.getKey(),dto.getAppCountry(),dto.getCompanyName());
|
|
|
+ String condition = this.appendCondition(dto.getProductId(), dto.getKey(), dto.getAppCountry(), dto.getCompanyName());
|
|
|
if (StringUtils.isNotEmpty(condition)) {
|
|
|
//1. 解析检索条件
|
|
|
treeNode tree = expressManager.getInstance().Parse(condition, false);
|
|
@@ -197,6 +211,7 @@ public class EsDenseVectorService {
|
|
|
|
|
|
/**
|
|
|
* 根据专利号获取相关图片
|
|
|
+ *
|
|
|
* @param noDTO
|
|
|
* @return
|
|
|
* @throws IOException
|
|
@@ -229,7 +244,7 @@ public class EsDenseVectorService {
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
- public String appendCondition(Integer productId, String keyword,String appCountry,String companyName) {
|
|
|
+ public String appendCondition(Integer productId, String keyword, String appCountry, String companyName) {
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
|
|
SimpleDateFormat format1 = new SimpleDateFormat("yyyy");
|
|
|
|
|
@@ -301,7 +316,7 @@ public class EsDenseVectorService {
|
|
|
String ccName = "";
|
|
|
for (int i = 0; i < split.length; i++) {
|
|
|
String s = split[i];
|
|
|
- if (split.length -1 != i) {
|
|
|
+ if (split.length - 1 != i) {
|
|
|
ccName = ccName + "\"" + s + "\"" + " OR ";
|
|
|
} else {
|
|
|
ccName = ccName + "\"" + s + "\"";
|