|
@@ -23,16 +23,20 @@ import com.example.xiaoshiweixinback.domain.Product;
|
|
|
import com.example.xiaoshiweixinback.domain.es.PatentVector;
|
|
|
import com.example.xiaoshiweixinback.entity.dto.esPicture.EsPictureNoDTO;
|
|
|
import com.example.xiaoshiweixinback.entity.dto.esPicture.EsPatentVectorDTO;
|
|
|
+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.EsPatentVectorVo;
|
|
|
import com.example.xiaoshiweixinback.mapper.ProductMapper;
|
|
|
+import com.example.xiaoshiweixinback.service.SearchRecordService;
|
|
|
import com.example.xiaoshiweixinback.service.importPatent.FormatQueryService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Propagation;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.io.File;
|
|
@@ -55,6 +59,9 @@ public class EsDenseVectorService {
|
|
|
private GetVectorService getVectorService;
|
|
|
|
|
|
@Autowired
|
|
|
+ private SearchRecordService searchRecordService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private ProductMapper productMapper;
|
|
|
|
|
|
/**
|
|
@@ -64,6 +71,7 @@ public class EsDenseVectorService {
|
|
|
* @return
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
|
|
|
public Records getPatentVectors(EsPatentVectorDTO dto,File file) throws Exception {
|
|
|
Long pageNum = dto.getPageNum();
|
|
|
Long pageSize = dto.getPageSize();
|
|
@@ -142,7 +150,18 @@ public class EsDenseVectorService {
|
|
|
records.setCurrent(pageNum);
|
|
|
records.setSize(pageSize);
|
|
|
records.setData(vectorVos);
|
|
|
- records.setTotal(total <= vectorVos.size() ? total : vectorVos.size());
|
|
|
+ long count = total <= vectorVos.size() ? total : vectorVos.size();
|
|
|
+ records.setTotal(count);
|
|
|
+
|
|
|
+ //添加检索历史
|
|
|
+ AddSearchRecordDTO recordDTO = new AddSearchRecordDTO();
|
|
|
+ recordDTO.setProductId(dto.getProductId());
|
|
|
+ recordDTO.setDescription(dto.getDescription());
|
|
|
+ recordDTO.setGuid(file.getPath());
|
|
|
+ recordDTO.setSearchCondition(condition);
|
|
|
+ recordDTO.setAllNum(Integer.parseInt(String.valueOf(count)));
|
|
|
+ recordDTO.setSearchTime(new Date());
|
|
|
+ searchRecordService.addSearchRecord(recordDTO);
|
|
|
return records;
|
|
|
}
|
|
|
|