EsServiceTests.java 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package cn.cslg.pas.service;
  2. import cn.cslg.pas.common.utils.FormatUtil;
  3. import cn.cslg.pas.common.utils.RedisUtil;
  4. import cn.cslg.pas.common.vo.PatentWithIdVO;
  5. import cn.cslg.pas.domain.es.Patent;
  6. import cn.cslg.pas.service.business.es.EsService;
  7. import cn.cslg.pas.service.importPatent.SchedulingTaskService;
  8. import org.junit.jupiter.api.Test;
  9. import org.springframework.beans.BeanUtils;
  10. import org.springframework.beans.factory.annotation.Autowired;
  11. import org.springframework.boot.test.context.SpringBootTest;
  12. /**
  13. * @author chenyu
  14. * @date 2023/9/6
  15. */
  16. @SpringBootTest
  17. public class EsServiceTests {
  18. @Autowired
  19. private EsService esService;
  20. @Autowired
  21. private RedisUtil redisUtil;
  22. @Autowired
  23. private SchedulingTaskService importTaskAdd;
  24. @Test
  25. void addPatent() throws Exception {
  26. Patent patent =new Patent();
  27. patent.setPatentNo("CN202023204739.4");
  28. String id = esService.addPatent(patent);
  29. System.out.println(id);
  30. }
  31. @Test
  32. void getPatentByPatentNo() throws Exception {
  33. //根据专利号获得id
  34. PatentWithIdVO patentWithIdVO = esService.getIdByPatentNo("CN201114765Y");
  35. Patent patent =new Patent();
  36. patent.setAgency("张三");
  37. Patent orgPatent =patentWithIdVO.getPatent();
  38. BeanUtils.copyProperties(patent,orgPatent, FormatUtil.getNullPropertyNames(patent));
  39. esService.updateDocument(orgPatent,patentWithIdVO.getId());
  40. System.out.println();
  41. }
  42. @Test
  43. void updatePatent() throws Exception{}
  44. @Test
  45. void addImportTask() throws Exception {
  46. Thread.sleep(1000000);
  47. }
  48. }