EsServiceTests.java 1.8 KB

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