|
@@ -3,6 +3,7 @@ package com.example.xiaoshiweixinback.service.importPatent;
|
|
import com.example.xiaoshiweixinback.business.utils.FileUtils;
|
|
import com.example.xiaoshiweixinback.business.utils.FileUtils;
|
|
import com.example.xiaoshiweixinback.business.utils.FormatUtil;
|
|
import com.example.xiaoshiweixinback.business.utils.FormatUtil;
|
|
import com.example.xiaoshiweixinback.domain.es.Patent;
|
|
import com.example.xiaoshiweixinback.domain.es.Patent;
|
|
|
|
+import com.example.xiaoshiweixinback.domain.es.PatentClassify;
|
|
import com.example.xiaoshiweixinback.domain.es.PatentVector;
|
|
import com.example.xiaoshiweixinback.domain.es.PatentVector;
|
|
import com.example.xiaoshiweixinback.entity.dto.patent.UploadPatentWebDTO;
|
|
import com.example.xiaoshiweixinback.entity.dto.patent.UploadPatentWebDTO;
|
|
import com.example.xiaoshiweixinback.service.common.FileManagerService;
|
|
import com.example.xiaoshiweixinback.service.common.FileManagerService;
|
|
@@ -12,6 +13,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@@ -35,16 +37,27 @@ public class GetPatentPictureFromWebService {
|
|
File file = FileUtils.getPictureFileByUrl(pictureUrl);
|
|
File file = FileUtils.getPictureFileByUrl(pictureUrl);
|
|
String guid = FormatUtil.getPictureFormat(uploadPatentWebDTO.getStarPatentVO().getApplicationNo());
|
|
String guid = FormatUtil.getPictureFormat(uploadPatentWebDTO.getStarPatentVO().getApplicationNo());
|
|
fileManagerService.uploadFileWithGuid(file, guid);
|
|
fileManagerService.uploadFileWithGuid(file, guid);
|
|
|
|
+ PatentVector patentVectorOrg = esService.getVectorByIndex(patent.getAppNo(),0);
|
|
|
|
+ if(patentVectorOrg!=null){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
PatentVector patentVector = new PatentVector();
|
|
PatentVector patentVector = new PatentVector();
|
|
patentVector.setAppNo(patent.getAppNo());
|
|
patentVector.setAppNo(patent.getAppNo());
|
|
patentVector.setTitle(patent.getTitle());
|
|
patentVector.setTitle(patent.getTitle());
|
|
patentVector.setRightHolder(patent.getRightHolder());
|
|
patentVector.setRightHolder(patent.getRightHolder());
|
|
|
|
+ patentVector.setAppDate(patent.getAppDate());
|
|
|
|
+ patentVector.setAbstractStr(patent.getAbstractStr());
|
|
|
|
+ patentVector.setAppCountry(patent.getAppCountry());
|
|
|
|
+ PatentClassify patentClassify =new PatentClassify();
|
|
|
|
+ patentClassify.setLevel1(uploadPatentWebDTO.getStarPatentVO().getMainIpc());
|
|
|
|
+ patentVector.setLoc(Arrays.asList(patentClassify));
|
|
patentVector.setImageIndex(0);
|
|
patentVector.setImageIndex(0);
|
|
|
|
+ patentVector.setGuid(guid);
|
|
List<String> stringList = getVectorService.getVectorByFile(file);
|
|
List<String> stringList = getVectorService.getVectorByFile(file);
|
|
List<Float> floats =new ArrayList<>();
|
|
List<Float> floats =new ArrayList<>();
|
|
stringList.forEach(item->{
|
|
stringList.forEach(item->{
|
|
Float a =Float.parseFloat(item);
|
|
Float a =Float.parseFloat(item);
|
|
- floats.add(a);
|
|
|
|
|
|
+ floats.add(a);
|
|
|
|
|
|
});
|
|
});
|
|
org.apache.commons.io.FileUtils.deleteQuietly(file);
|
|
org.apache.commons.io.FileUtils.deleteQuietly(file);
|