|
@@ -15,7 +15,6 @@ import co.elastic.clients.elasticsearch.core.search.Hit;
|
|
import co.elastic.clients.json.JsonData;
|
|
import co.elastic.clients.json.JsonData;
|
|
import com.example.xiaoshiweixinback.business.common.base.Records;
|
|
import com.example.xiaoshiweixinback.business.common.base.Records;
|
|
import com.example.xiaoshiweixinback.business.utils.BeanUtil;
|
|
import com.example.xiaoshiweixinback.business.utils.BeanUtil;
|
|
-import com.example.xiaoshiweixinback.business.utils.ToolUtil;
|
|
|
|
import com.example.xiaoshiweixinback.business.utils.parseQueryToTree.expressManager;
|
|
import com.example.xiaoshiweixinback.business.utils.parseQueryToTree.expressManager;
|
|
import com.example.xiaoshiweixinback.business.utils.parseQueryToTree.operateNode;
|
|
import com.example.xiaoshiweixinback.business.utils.parseQueryToTree.operateNode;
|
|
import com.example.xiaoshiweixinback.business.utils.parseQueryToTree.treeNode;
|
|
import com.example.xiaoshiweixinback.business.utils.parseQueryToTree.treeNode;
|
|
@@ -24,7 +23,6 @@ import com.example.xiaoshiweixinback.domain.es.PatentVector;
|
|
import com.example.xiaoshiweixinback.entity.dto.esPicture.EsPictureNoDTO;
|
|
import com.example.xiaoshiweixinback.entity.dto.esPicture.EsPictureNoDTO;
|
|
import com.example.xiaoshiweixinback.entity.dto.esPicture.EsPatentVectorDTO;
|
|
import com.example.xiaoshiweixinback.entity.dto.esPicture.EsPatentVectorDTO;
|
|
import com.example.xiaoshiweixinback.entity.dto.searchRecord.AddSearchRecordDTO;
|
|
import com.example.xiaoshiweixinback.entity.dto.searchRecord.AddSearchRecordDTO;
|
|
-import com.example.xiaoshiweixinback.entity.product.ProductIdDTO;
|
|
|
|
import com.example.xiaoshiweixinback.entity.vo.esPicture.EsPictureNoVo;
|
|
import com.example.xiaoshiweixinback.entity.vo.esPicture.EsPictureNoVo;
|
|
import com.example.xiaoshiweixinback.entity.vo.esPicture.EsPatentVectorVo;
|
|
import com.example.xiaoshiweixinback.entity.vo.esPicture.EsPatentVectorVo;
|
|
import com.example.xiaoshiweixinback.mapper.ProductMapper;
|
|
import com.example.xiaoshiweixinback.mapper.ProductMapper;
|
|
@@ -41,7 +39,6 @@ import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
-import java.text.ParseException;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -64,6 +61,9 @@ public class EsDenseVectorService {
|
|
@Autowired
|
|
@Autowired
|
|
private ProductMapper productMapper;
|
|
private ProductMapper productMapper;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private FileManagerService fileManagerService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 根据图片排序获取列表
|
|
* 根据图片排序获取列表
|
|
*
|
|
*
|
|
@@ -90,8 +90,10 @@ public class EsDenseVectorService {
|
|
//获取图片向量
|
|
//获取图片向量
|
|
List<Float> imageList = new ArrayList<>();
|
|
List<Float> imageList = new ArrayList<>();
|
|
List<String> stringList = new ArrayList<>();
|
|
List<String> stringList = new ArrayList<>();
|
|
|
|
+ List<String> getGuids = new ArrayList<>();
|
|
if (file != null && file.exists() && file.length() != 0) {
|
|
if (file != null && file.exists() && file.length() != 0) {
|
|
stringList = getVectorService.getVectorByFile(file);
|
|
stringList = getVectorService.getVectorByFile(file);
|
|
|
|
+ getGuids = fileManagerService.uploadFileGetGuid2(Collections.singletonList(file));
|
|
} else if (StringUtils.isNotEmpty(dto.getDescription())) {
|
|
} else if (StringUtils.isNotEmpty(dto.getDescription())) {
|
|
stringList = getVectorService.getVectorByText(dto.getDescription());
|
|
stringList = getVectorService.getVectorByText(dto.getDescription());
|
|
}
|
|
}
|
|
@@ -163,8 +165,8 @@ public class EsDenseVectorService {
|
|
recordDTO.setSearchCondition(dto.getKey());
|
|
recordDTO.setSearchCondition(dto.getKey());
|
|
}
|
|
}
|
|
recordDTO.setDescription(dto.getDescription());
|
|
recordDTO.setDescription(dto.getDescription());
|
|
- if (file != null && file.length() != 0) {
|
|
|
|
- recordDTO.setGuid(file.getPath());
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(getGuids)) {
|
|
|
|
+ recordDTO.setGuid(getGuids.get(0));
|
|
}
|
|
}
|
|
recordDTO.setAllNum(Integer.parseInt(String.valueOf(count)));
|
|
recordDTO.setAllNum(Integer.parseInt(String.valueOf(count)));
|
|
recordDTO.setSearchTime(new Date());
|
|
recordDTO.setSearchTime(new Date());
|