package cn.cslg.pas.service; import cn.cslg.pas.common.dto.business.ProductMarketDataDTO; import cn.cslg.pas.common.utils.FormatUtil; import cn.cslg.pas.common.utils.RedisUtil; import cn.cslg.pas.common.vo.PatentWithIdVO; import cn.cslg.pas.controller.ProductMarketDataController; import cn.cslg.pas.domain.es.Patent; import cn.cslg.pas.service.business.es.EsService; import cn.cslg.pas.service.importPatent.SchedulingTaskService; import org.junit.jupiter.api.Test; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import java.text.SimpleDateFormat; import java.util.Date; /** * @author chenyu * @date 2023/9/6 */ @SpringBootTest public class EsServiceTests { @Autowired private EsService esService; @Autowired private RedisUtil redisUtil; @Autowired private SchedulingTaskService importTaskAdd; @Test void addPatent() throws Exception { Patent patent =new Patent(); patent.setPatentNo("CN202023204739.4"); String id = esService.addPatent(patent); System.out.println(id); } @Test void getPatentByPatentNo() throws Exception { //根据专利号获得id PatentWithIdVO patentWithIdVO = esService.getIdByPatentNo("CN201114765Y"); Patent patent =new Patent(); patent.setAgency("张三"); Patent orgPatent =patentWithIdVO.getPatent(); BeanUtils.copyProperties(patent,orgPatent, FormatUtil.getNullPropertyNames(patent)); esService.updateDocument(orgPatent,patentWithIdVO.getId()); System.out.println(); } @Test void updatePatent() throws Exception{ } @Test void addImportTask() throws Exception { Thread.sleep(1000000); } }