|
@@ -4,9 +4,12 @@ import com.example.xiaoshiweixinback.business.utils.DateUtil;
|
|
import com.example.xiaoshiweixinback.business.utils.FormatUtil;
|
|
import com.example.xiaoshiweixinback.business.utils.FormatUtil;
|
|
import com.example.xiaoshiweixinback.business.utils.parseQueryToTree.expressManager;
|
|
import com.example.xiaoshiweixinback.business.utils.parseQueryToTree.expressManager;
|
|
import com.example.xiaoshiweixinback.business.utils.parseQueryToTree.treeNode;
|
|
import com.example.xiaoshiweixinback.business.utils.parseQueryToTree.treeNode;
|
|
|
|
+import com.example.xiaoshiweixinback.domain.es.ESCustomField;
|
|
import com.example.xiaoshiweixinback.entity.ops.ImagesInfoVO;
|
|
import com.example.xiaoshiweixinback.entity.ops.ImagesInfoVO;
|
|
import com.example.xiaoshiweixinback.entity.ops.PubNo;
|
|
import com.example.xiaoshiweixinback.entity.ops.PubNo;
|
|
|
|
+import com.example.xiaoshiweixinback.entity.vo.patent.PatentWithIdVO;
|
|
import com.example.xiaoshiweixinback.service.common.OPSService;
|
|
import com.example.xiaoshiweixinback.service.common.OPSService;
|
|
|
|
+import com.example.xiaoshiweixinback.service.importPatent.EsService;
|
|
import com.example.xiaoshiweixinback.service.importPatent.excel.GetPatentFromSzService;
|
|
import com.example.xiaoshiweixinback.service.importPatent.excel.GetPatentFromSzService;
|
|
import com.example.xiaoshiweixinback.service.importPatent.excel.ImportProductService;
|
|
import com.example.xiaoshiweixinback.service.importPatent.excel.ImportProductService;
|
|
import org.joda.time.format.FormatUtils;
|
|
import org.joda.time.format.FormatUtils;
|
|
@@ -15,8 +18,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
|
|
|
|
|
+import java.util.Comparator;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@SpringBootTest
|
|
@SpringBootTest
|
|
@@ -30,29 +35,58 @@ class ImportProductTests {
|
|
private GetPatentFromSzService getPatentFromSzService;
|
|
private GetPatentFromSzService getPatentFromSzService;
|
|
@Autowired
|
|
@Autowired
|
|
private OPSService opsService;
|
|
private OPSService opsService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private EsService esService;
|
|
|
|
+
|
|
@Test
|
|
@Test
|
|
void contextLoads() {
|
|
void contextLoads() {
|
|
-
|
|
|
|
|
|
+ try {
|
|
|
|
+ List<PatentWithIdVO> patentWithIdVOS = esService.getPatent();
|
|
|
|
+ System.out.println(patentWithIdVOS.size());
|
|
|
|
+ while (patentWithIdVOS.size() > 0) {
|
|
|
|
+ PatentWithIdVO patentWithIdVO = patentWithIdVOS.get(0);
|
|
|
|
+ PatentWithIdVO patentWithIdVO1 = patentWithIdVOS.stream().filter(item -> item.getPatent().getESCustomField().getProjectId().equals(patentWithIdVO.getPatent().getESCustomField().getProjectId())
|
|
|
|
+ && item.getPatent().getESCustomField().getField().equals(patentWithIdVO.getPatent().getESCustomField().getField())
|
|
|
|
+ && item.getPatent().getPatentJoin().getParent().equals(patentWithIdVO.getPatent().getPatentJoin().getParent()))
|
|
|
|
+ .sorted(Comparator.comparing((PatentWithIdVO tem) -> tem.getPatent().getESCustomField().getCreateTime()).reversed()).findFirst().orElse(null);
|
|
|
|
+ List<PatentWithIdVO> patentWithIdVOs = patentWithIdVOS.stream().filter(item -> item.getPatent().getESCustomField().getProjectId().equals(patentWithIdVO.getPatent().getESCustomField().getProjectId())
|
|
|
|
+ && item.getPatent().getESCustomField().getField().equals(patentWithIdVO.getPatent().getESCustomField().getField())
|
|
|
|
+ && item.getPatent().getPatentJoin().getParent().equals(patentWithIdVO.getPatent().getPatentJoin().getParent()))
|
|
|
|
+ .sorted(Comparator.comparing((PatentWithIdVO tem) -> tem.getPatent().getESCustomField().getCreateTime()).reversed()).collect(Collectors.toList());
|
|
|
|
+ if(patentWithIdVOs.size()>1) {
|
|
|
|
+ System.out.println(patentWithIdVOs);
|
|
|
|
+ }
|
|
|
|
+ if(patentWithIdVO1!=null){
|
|
|
|
+ patentWithIdVOS.removeIf((item -> item.getPatent().getESCustomField().getProjectId().equals(patentWithIdVO.getPatent().getESCustomField().getProjectId())
|
|
|
|
+ && item.getPatent().getESCustomField().getField().equals(patentWithIdVO.getPatent().getESCustomField().getField())
|
|
|
|
+ && item.getPatent().getPatentJoin().getParent().equals(patentWithIdVO.getPatent().getPatentJoin().getParent())));
|
|
|
|
+ patentWithIdVO1.getPatent().getESCustomField().setIfNew(1);
|
|
|
|
+ esService.updatePatent2(patentWithIdVO1.getPatent(),patentWithIdVO1.getId());
|
|
|
|
+ }
|
|
|
|
+ System.out.println(patentWithIdVO1);
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void test1() {
|
|
public void test1() {
|
|
- PubNo pubNo =new PubNo();
|
|
|
|
|
|
+ PubNo pubNo = new PubNo();
|
|
pubNo.setCountry("US");
|
|
pubNo.setCountry("US");
|
|
pubNo.setNumber("D942334");
|
|
pubNo.setNumber("D942334");
|
|
pubNo.setKind("S");
|
|
pubNo.setKind("S");
|
|
|
|
|
|
|
|
|
|
// USD942334S
|
|
// USD942334S
|
|
-try {
|
|
|
|
- List<ImagesInfoVO> imagesInfoVOS =opsService.getImageInfos("USD942334S");
|
|
|
|
- ImagesInfoVO infoVO = imagesInfoVOS.stream().filter(item -> item.getImageType().equals("Drawing")).findFirst().orElse(null);
|
|
|
|
- opsService.getImages(infoVO,"USD942334S");
|
|
|
|
|
|
+ try {
|
|
|
|
+ List<ImagesInfoVO> imagesInfoVOS = opsService.getImageInfos("USD942334S");
|
|
|
|
+ ImagesInfoVO infoVO = imagesInfoVOS.stream().filter(item -> item.getImageType().equals("Drawing")).findFirst().orElse(null);
|
|
|
|
+ opsService.getImages(infoVO, "USD942334S");
|
|
|
|
|
|
- System.out.println(imagesInfoVOS);
|
|
|
|
-}
|
|
|
|
- catch (Exception e){
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
|
|
+ System.out.println(imagesInfoVOS);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|