From 196bb14112448857a885e32dc4149e308e00b01a Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期四, 15 八月 2024 11:57:15 +0800 Subject: [PATCH] 2024.8.15 各项修正 --- src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt | 61 +++++++++++++++++++++++++++++- 1 files changed, 58 insertions(+), 3 deletions(-) diff --git a/src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt b/src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt index c72ed52..f4fab7a 100644 --- a/src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt +++ b/src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt @@ -1,17 +1,32 @@ package cn.flightfeather.supervision +import cn.flightfeather.supervision.common.docimport.UserExcelRule +import cn.flightfeather.supervision.common.net.JinAnLianTongHttpService import cn.flightfeather.supervision.common.nlp.NlpController +import cn.flightfeather.supervision.common.pdf.PdfUtil +import cn.flightfeather.supervision.infrastructure.utils.DateUtil +import cn.flightfeather.supervision.infrastructure.utils.FileUtil import cn.flightfeather.supervision.websocket.MsgType import cn.flightfeather.supervision.websocket.PersonalServerMsgVo import cn.flightfeather.supervision.websocket.WebSocketMsg import com.google.gson.Gson +import org.apache.commons.codec.digest.DigestUtils +import org.apache.commons.codec.digest.Md5Crypt +import org.fit.pdfdom.PDFDomTreeConfig import org.junit.Test import org.springframework.boot.json.GsonJsonParser +import java.io.File +import java.io.FileInputStream +import java.time.Duration import java.time.LocalDate import java.time.LocalDateTime import java.time.format.DateTimeFormatter import java.util.* import java.util.regex.Pattern +import kotlin.random.Random +import kotlin.random.nextInt +import kotlin.reflect.jvm.internal.impl.load.kotlin.JvmType + /** * @author riku @@ -84,9 +99,10 @@ @Test fun foo6() { - var a = 1667377808L - a*=1000 - println(a) + repeat(20) { + val r = Random.nextInt(100..999) + println(r) + } } @Test @@ -103,4 +119,43 @@ println(st) println(et) } + + @Test + @Throws(Exception::class) + open fun test_convert_pdf_to_html() { + val config = PDFDomTreeConfig.createDefaultConfig() + config.imageHandler = PDFDomTreeConfig.saveToDirectory(File("/target/res/")) + config.fontHandler = config.imageHandler + val html = PdfUtil.parseWithPdfDomTree(FileInputStream("C:\\work\\宸ヤ綔\\瀹堟硶鑷富灏忕▼搴廫\姹戒慨/2 澶ф皵姹℃煋鐗╃患鍚堟帓鏀炬爣鍑嗭紙DB31933鈥�2015锛�.pdf"), 0, 10, config) +// FileUtils.write(File("/mnt/test.html"), htmlOutput, "utf-8") + html?.toByteArray()?.let { FileUtil.uploadFile(it, "/target/", "test.html") } + } + + @Test + fun foo8() { +// val now = Date().time / 1000 + val now = 1667870335 + val key = "${now}e6dc8bb9e1ff0ce973fb92b4af2e4c3f" + val sign = DigestUtils.md5Hex(key) + println(sign) + } + + @Test + fun foo10() { + val clz = UserExcelRule::class.java + val params = mutableListOf<Any>() +// val u = clz.newInstance() +// println(u) + repeat(14) { params.add(it.toString()) } + println(params) +// val n = clz.constructors[0].newInstance("","","","","","","","","","","","","","") + val n = clz.constructors[0].newInstance(*params.toTypedArray()) + println(n) + } + + @Test + fun foo11(){ + val s = DateUtil.getStartMonthByPeriod(5, 12) + println(s) + } } \ No newline at end of file -- Gitblit v1.9.3