From 89ebff2b2d96a66fd732d8ecb209d155fa69e946 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Thu, 07 Jul 2022 18:27:03 +0800
Subject: [PATCH] 20220606
---
src/test/java/com/xcong/farmer/cms/KssframeworkApplicationTests.java | 39 +++++++++++++++++++++++++++++++++++++++
1 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/src/test/java/com/xcong/farmer/cms/KssframeworkApplicationTests.java b/src/test/java/com/xcong/farmer/cms/KssframeworkApplicationTests.java
index 87f25ee..a8bd719 100644
--- a/src/test/java/com/xcong/farmer/cms/KssframeworkApplicationTests.java
+++ b/src/test/java/com/xcong/farmer/cms/KssframeworkApplicationTests.java
@@ -1,10 +1,14 @@
package com.xcong.farmer.cms;
import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
import com.xcong.farmer.cms.common.response.Result;
+import com.xcong.farmer.cms.common.utils.FileUtils;
import com.xcong.farmer.cms.configurations.properties.CmsProperties;
+import com.xcong.farmer.cms.modules.system.dto.WebArticleInPageDto;
import com.xcong.farmer.cms.modules.system.entity.CmsTemplateEntity;
import com.xcong.farmer.cms.modules.system.mapper.CmsTemplateMapper;
+import com.xcong.farmer.cms.modules.system.util.LoginUserUtil;
import com.xcong.farmer.cms.modules.test.dao.TestUserDao;
import com.xcong.farmer.cms.modules.test.entity.TestUserEntity;
import org.jsoup.Jsoup;
@@ -20,7 +24,9 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
+import java.util.ArrayList;
import java.util.Date;
+import java.util.List;
@SpringBootTest
class KssframeworkApplicationTests {
@@ -80,4 +86,37 @@
System.out.println(content);
}
+ @Test
+ public void path(){
+ Long id = 6L;
+ CmsTemplateEntity cmsTemplateEntity = cmsTemplateMapper.selectById(id);
+ String templatePath = cmsProperties.getTemplatePath();
+ String pathName = FileUtils.path(templatePath, cmsTemplateEntity.getPath());
+ System.out.println(templatePath);
+ System.out.println(pathName);
+ byte[] bytes = new byte[0];
+ try {
+ bytes = Files.readAllBytes(Paths.get(pathName));
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.out.println("未找到模板");
+ }
+
+ String content = new String(bytes, StandardCharsets.UTF_8);
+ System.out.println(content);
+ }
+
+ @Test
+ public void dateTest(){
+ String columnIdStr = "1,2,3";
+ if(StrUtil.isNotEmpty(columnIdStr)){
+ long[] columnIdLongs = StrUtil.splitToLong(columnIdStr, StrUtil.COMMA);
+ List<Long> columnList = new ArrayList<>();
+ for(long columnIdLong : columnIdLongs){
+ columnList.add(columnIdLong);
+ }
+ System.out.println(columnList);
+ }
+ }
+
}
--
Gitblit v1.9.1