package com.pavis.ai.kwp.ioc; import com.alibaba.fastjson.JSON; import com.pavis.ai.kwp.ioc.common.utils.DateTimeUtils; import com.pavis.ai.kwp.ioc.common.utils.ImageUtils; import com.pavis.ai.kwp.ioc.dto.meta.IrRes; import com.pavis.ai.kwp.ioc.service.CtrService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @Slf4j @RunWith(SpringRunner.class) @SpringBootTest public class KwpIocApplicationTests { @Autowired private CtrService ctrService; @Test public void testCtrService() { try { IrRes res = ctrService.startRequest("6733699117742653440", "https://chilun.bj.bcebos.com/ddp1f196028b3b94c1abd50464b057a557d.png"); log.info("res:{}", JSON.toJSONString(res)); } catch (Exception e) { e.printStackTrace(); } } @Test public void testBase64() throws Exception { String base64 = ImageUtils.imgUrl2Base64("http://ocrproducts.bj.bcebos.com/161234901701820190608140412201"); log.info("base64:{}", base64); } @Test public void testSubstring() { String str = "102:小票类型不匹配,当前小票类型为:other"; log.info("str:{}", str); log.info("str before:{}", StringUtils.substringBefore(str, ":")); log.info("str after:{}", StringUtils.substringAfter(str, ":")); } @Test public void testNonEtTime() { log.info(DateTimeUtils.nonEtDatetime("2020-11-20 10:23:34")); } }