Compare commits
20 Commits
v5.12.1.sp
...
v5.13.0.sp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
73c52bbd1f | ||
|
|
63773c97a5 | ||
|
|
6b75fe67af | ||
|
|
65aa023c92 | ||
|
|
7f77715cc0 | ||
|
|
c146e0e101 | ||
|
|
11478921a6 | ||
|
|
c5bd0bc597 | ||
|
|
b797bb99d0 | ||
|
|
fc37b649b1 | ||
|
|
fd3a334e32 | ||
|
|
f48a2b2aa8 | ||
|
|
dd7a1bd539 | ||
|
|
0f2c22dbd9 | ||
|
|
b6fff119e0 | ||
|
|
1d3b3a5f9d | ||
|
|
7e6426adea | ||
|
|
daae9f05a6 | ||
|
|
615448c2ce | ||
|
|
5bf6c026f0 |
@@ -4,7 +4,7 @@
|
||||
</p>
|
||||
<h3 align="center" style="margin:30px 0 30px;font-weight:bold;font-size:30px;">快速开发平台 - Spring Boot 3</h3>
|
||||
<p align="center">
|
||||
<a href="https://spring.io/projects/spring-boot" target="__blank"><img alt="SpringBoot-V2.7/3.4" src="https://img.shields.io/badge/SpringBoot-V2.7/3.4-blue.svg"></a>
|
||||
<a href="https://spring.io/projects/spring-boot" target="__blank"><img alt="SpringBoot-V3.5 or 2.7" src="https://img.shields.io/badge/SpringBoot-V3.5 or 2.7-blue.svg"></a>
|
||||
<a href="https://v3.cn.vuejs.org/" target="__blank"><img alt="TypeScript-Vue3" src="https://img.shields.io/badge/TypeScript-Vue3-green.svg"></a>
|
||||
<a href="https://jeesite.com/docs/upgrade/" target="__blank"><img alt="JeeSite-V5.x" src="https://img.shields.io/badge/JeeSite-V5.x-success.svg"></a>
|
||||
<a href="https://gitee.com/thinkgem/jeesite5" target="__blank"><img alt="star" src="https://gitee.com/thinkgem/jeesite5/badge/star.svg?theme=dark"></a>
|
||||
@@ -97,7 +97,7 @@
|
||||
|
||||
## 技术选型
|
||||
|
||||
* 主框架:Spring Boot 3.4、Spring Framework 6、Apache Shiro 2、J2Cache
|
||||
* 主框架:Spring Boot 3.5、Spring Framework 6、Apache Shiro 2、J2Cache
|
||||
* 持久层:Apache MyBatis 3.5、Hibernate Validator 8、Alibaba Druid 1.2
|
||||
* 分离版:Node.js、TypeScript、Vue3、Vite、Ant Design Vue、Vue Vben Admin
|
||||
* 经典版:Beetl 3.10(HTML)、jQuery 3.7、Bootstrap 3.3、AdminLTE 2.4
|
||||
@@ -111,9 +111,9 @@
|
||||
|
||||
## 更多介绍
|
||||
|
||||
* 架构特点:<https://jeesite.com/docs/feature/>
|
||||
* 内置功能:<https://jeesite.com/docs/function/>
|
||||
* 目录结构:<https://jeesite.com/docs/catalog/>
|
||||
* 架构特点:<https://jeesite.com/docs/feature/>
|
||||
* 参数配置:<https://jeesite.com/docs/config/>
|
||||
* 开发规范:<https://jeesite.com/docs/standard/>
|
||||
* 代码生成:<https://jeesite.com/docs/code-gen/>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-parent</artifactId>
|
||||
<version>5.12.1.springboot3-SNAPSHOT</version>
|
||||
<version>5.13.0.springboot3-SNAPSHOT</version>
|
||||
<relativePath>../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.util.regex.Pattern;
|
||||
* 4. JDK 提供的 URLEncoder
|
||||
* 5. XSS、SQL、orderBy 过滤器
|
||||
* @author calvin、ThinkGem
|
||||
* @version 2022-2-17
|
||||
* @version 2025-7-9
|
||||
*/
|
||||
public class EncodeUtils {
|
||||
|
||||
@@ -191,7 +191,7 @@ public class EncodeUtils {
|
||||
// 预编译XSS过滤正则表达式
|
||||
private static final List<Pattern> xssPatterns = ListUtils.newArrayList(
|
||||
Pattern.compile("(<\\s*(script|link|style|iframe)([\\s\\S]*?)(>|<\\/\\s*\\1\\s*>))|(</\\s*(script|link|style|iframe)\\s*>)", Pattern.CASE_INSENSITIVE),
|
||||
Pattern.compile("\\s*(href|src)\\s*=\\s*(\"\\s*(javascript|vbscript):[^\"]+\"|'\\s*(javascript|vbscript):[^']+'|(javascript|vbscript):[^\\s]+)\\s*(?=>)", Pattern.CASE_INSENSITIVE),
|
||||
Pattern.compile("\\s*(href|src)\\s*=\\s*(\"\\s*(javascript|vbscript|data):[^\"]+\"|'\\s*(javascript|vbscript|data):[^']+'|(javascript|vbscript|data):[^\\s]+)\\s*(?=>)", Pattern.CASE_INSENSITIVE),
|
||||
Pattern.compile("\\s*/?\\s*on[a-zA-Z]+\\s*=\\s*(['\"]?)(.*?)\\1(?=\\s|>|/>)", Pattern.CASE_INSENSITIVE),
|
||||
Pattern.compile("(eval\\((.*?)\\)|expression\\((.*?)\\))", Pattern.CASE_INSENSITIVE),
|
||||
Pattern.compile("^(javascript:|vbscript:)", Pattern.CASE_INSENSITIVE)
|
||||
|
||||
@@ -24,20 +24,20 @@ public class CommandUtils {
|
||||
public static String execute(String command, String charsetName) throws IOException {
|
||||
Process process = Runtime.getRuntime().exec(command);
|
||||
// 记录dos命令的返回信息
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
// 获取返回信息的流
|
||||
InputStream in = process.getInputStream();
|
||||
Reader reader = new InputStreamReader(in, charsetName);
|
||||
BufferedReader bReader = new BufferedReader(reader);
|
||||
String res = bReader.readLine();
|
||||
while (res != null) {
|
||||
stringBuffer.append(res);
|
||||
stringBuffer.append("\n");
|
||||
sb.append(res);
|
||||
sb.append("\n");
|
||||
res = bReader.readLine();
|
||||
}
|
||||
bReader.close();
|
||||
reader.close();
|
||||
return stringBuffer.toString();
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,26 +4,21 @@
|
||||
*/
|
||||
package com.jeesite.common.image;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Random;
|
||||
|
||||
import org.patchca.background.BackgroundFactory;
|
||||
import org.patchca.color.ColorFactory;
|
||||
import org.patchca.filter.predefined.CurvesRippleFilterFactory;
|
||||
import org.patchca.filter.predefined.DiffuseRippleFilterFactory;
|
||||
import org.patchca.filter.predefined.DoubleRippleFilterFactory;
|
||||
import org.patchca.filter.predefined.MarbleRippleFilterFactory;
|
||||
import org.patchca.filter.predefined.WobbleRippleFilterFactory;
|
||||
import org.patchca.filter.predefined.*;
|
||||
import org.patchca.font.RandomFontFactory;
|
||||
import org.patchca.service.ConfigurableCaptchaService;
|
||||
import org.patchca.text.renderer.BestFitTextRenderer;
|
||||
import org.patchca.utils.encoder.EncoderHelper;
|
||||
import org.patchca.word.RandomWordFactory;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* 验证码工具
|
||||
* @author ThinkGem
|
||||
@@ -31,7 +26,7 @@ import org.patchca.word.RandomWordFactory;
|
||||
*/
|
||||
public class CaptchaUtils {
|
||||
|
||||
private static Random random = new Random();
|
||||
private static final Random random = new Random();
|
||||
private volatile static ConfigurableCaptchaService ccs;
|
||||
private static WobbleRippleFilterFactory wrff; // 摆波纹
|
||||
private static DoubleRippleFilterFactory doff; // 双波纹
|
||||
@@ -135,9 +130,6 @@ public class CaptchaUtils {
|
||||
|
||||
/**
|
||||
* 生成验证码
|
||||
* @param request
|
||||
* @param response
|
||||
* @throws IOException
|
||||
* @return 验证码字符
|
||||
*/
|
||||
public static String generateCaptcha(OutputStream outputStream) throws IOException{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
//import com.drew.metadata.exif.GpsDirectory;
|
||||
//
|
||||
///**
|
||||
// * 图片地理信息获取
|
||||
// * 图片地理信息获取(pom.xml 中打开 com.drewnoakes 依赖)
|
||||
// * @author ThinkGem
|
||||
// */
|
||||
//public class ImageGeo {
|
||||
@@ -45,7 +45,7 @@
|
||||
// if (easting.equalsIgnoreCase("W")) {
|
||||
// lonsign = -1.0d;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// lat = (Math.abs(latpart[0].doubleValue()) + latpart[1].doubleValue() / 60.0d + latpart[2].doubleValue() / 3600.0d) * latsign;
|
||||
// lon = (Math.abs(lonpart[0].doubleValue()) + lonpart[1].doubleValue() / 60.0d + lonpart[2].doubleValue() / 3600.0d) * lonsign;
|
||||
//
|
||||
|
||||
@@ -68,7 +68,7 @@ public class ImageUtils {
|
||||
bilder.toFile(targetFile);
|
||||
}
|
||||
}catch(IOException e){
|
||||
logger.error("图片压缩失败:" + imageFile.getAbsoluteFile(), e);
|
||||
logger.error("图片压缩失败:{}", imageFile.getAbsoluteFile(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ import com.google.zxing.client.j2se.MatrixToImageWriter;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.common.HybridBinarizer;
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
@@ -23,13 +25,14 @@ import java.util.Hashtable;
|
||||
*/
|
||||
public class ZxingUtils {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ZxingUtils.class);
|
||||
|
||||
/**
|
||||
* 条形码编码
|
||||
*
|
||||
* @param contents
|
||||
* @param width
|
||||
* @param height
|
||||
* @param imgPath
|
||||
* @param contents 内容
|
||||
* @param width 宽度
|
||||
* @param height 高度
|
||||
* @param imgPath 图片路径
|
||||
*/
|
||||
public static void encode(String contents, int width, int height, String imgPath) {
|
||||
int codeWidth = 3 + // start guard
|
||||
@@ -42,14 +45,13 @@ public class ZxingUtils {
|
||||
BitMatrix bitMatrix = new MultiFormatWriter().encode(contents, BarcodeFormat.EAN_13, codeWidth, height, null);
|
||||
MatrixToImageWriter.writeToPath(bitMatrix, "png", new File(imgPath).toPath());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 条形码解码
|
||||
*
|
||||
* @param imgPath
|
||||
* @param imgPath 图片路径
|
||||
* @return String
|
||||
*/
|
||||
public static String decode(String imgPath) {
|
||||
@@ -58,25 +60,24 @@ public class ZxingUtils {
|
||||
try {
|
||||
image = ImageIO.read(new File(imgPath));
|
||||
if (image == null) {
|
||||
System.out.println("the decode image may be not exit.");
|
||||
logger.debug("the decode image may be not exit.");
|
||||
}
|
||||
LuminanceSource source = new BufferedImageLuminanceSource(image);
|
||||
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
|
||||
result = new MultiFormatReader().decode(bitmap, null);
|
||||
return result.getText();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 二维码编码
|
||||
*
|
||||
* @param contents
|
||||
* @param width
|
||||
* @param height
|
||||
* @param imgPath
|
||||
* @param contents 内容
|
||||
* @param width 宽度
|
||||
* @param height 高度
|
||||
* @param imgPath 图片路径
|
||||
*/
|
||||
public static void encode2(String contents, int width, int height, String imgPath) {
|
||||
Hashtable<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>();
|
||||
@@ -88,14 +89,13 @@ public class ZxingUtils {
|
||||
BitMatrix bitMatrix = new MultiFormatWriter().encode(contents, BarcodeFormat.QR_CODE, width, height, hints);
|
||||
MatrixToImageWriter.writeToPath(bitMatrix, "png", new File(imgPath).toPath());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 二维码解码
|
||||
*
|
||||
* @param imgPath
|
||||
* @param imgPath 图片路径
|
||||
* @return String
|
||||
*/
|
||||
public static String decode2(String imgPath) {
|
||||
@@ -104,7 +104,7 @@ public class ZxingUtils {
|
||||
try {
|
||||
image = ImageIO.read(new File(imgPath));
|
||||
if (image == null) {
|
||||
System.out.println("the decode image may be not exit.");
|
||||
logger.debug("the decode image may be not exit.");
|
||||
}
|
||||
LuminanceSource source = new BufferedImageLuminanceSource(image);
|
||||
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
|
||||
@@ -113,7 +113,7 @@ public class ZxingUtils {
|
||||
result = new MultiFormatReader().decode(bitmap, hints);
|
||||
return result.getText();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
import javax.activation.MimetypesFileTypeMap;
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@@ -30,7 +32,7 @@ import java.util.zip.ZipOutputStream;
|
||||
* 文件操作工具类
|
||||
* 实现文件的创建、删除、复制、压缩、解压以及目录的创建、删除、复制、压缩解压等功能
|
||||
* @author ThinkGem
|
||||
* @version 2015-3-16
|
||||
* @version 2025-08-08
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
@@ -57,17 +59,16 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
* @param coverlay 如果目标文件已存在,是否覆盖
|
||||
* @return 如果复制成功,则返回true,否则返回false
|
||||
*/
|
||||
public static boolean copyFileCover(String srcFileName,
|
||||
String descFileName, boolean coverlay) {
|
||||
public static boolean copyFileCover(String srcFileName, String descFileName, boolean coverlay) {
|
||||
File srcFile = new File(srcFileName);
|
||||
// 判断源文件是否存在
|
||||
if (!srcFile.exists()) {
|
||||
logger.debug("复制文件失败,源文件 " + srcFileName + " 不存在!");
|
||||
logger.debug("复制文件失败,源文件 {} 不存在!", srcFileName);
|
||||
return false;
|
||||
}
|
||||
// 判断源文件是否是合法的文件
|
||||
else if (!srcFile.isFile()) {
|
||||
logger.debug("复制文件失败," + srcFileName + " 不是一个文件!");
|
||||
logger.debug("复制文件失败,{} 不是一个文件!", srcFileName);
|
||||
return false;
|
||||
}
|
||||
File descFile = new File(descFileName);
|
||||
@@ -77,11 +78,11 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
if (coverlay) {
|
||||
logger.debug("目标文件已存在,准备删除!");
|
||||
if (!FileUtils.delFile(descFileName)) {
|
||||
logger.debug("删除目标文件 " + descFileName + " 失败!");
|
||||
logger.debug("删除目标文件 {} 失败!", descFileName);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
logger.debug("复制文件失败,目标文件 " + descFileName + " 已存在!");
|
||||
logger.debug("复制文件失败,目标文件 {} 已存在!", descFileName);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@@ -95,45 +96,26 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 准备复制文件
|
||||
// 读取的位数
|
||||
int readByte = 0;
|
||||
InputStream ins = null;
|
||||
OutputStream outs = null;
|
||||
try {
|
||||
try (
|
||||
// 打开源文件
|
||||
ins = new FileInputStream(srcFile);
|
||||
InputStream ins = Files.newInputStream(srcFile.toPath());
|
||||
// 打开目标文件的输出流
|
||||
outs = new FileOutputStream(descFile);
|
||||
byte[] buf = new byte[1024];
|
||||
OutputStream outs = Files.newOutputStream(descFile.toPath());
|
||||
) {
|
||||
// 读取的位数
|
||||
int readByte = 0;
|
||||
// 一次读取1024个字节,当readByte为-1时表示文件已经读取完毕
|
||||
byte[] buf = new byte[1024];
|
||||
while ((readByte = ins.read(buf)) != -1) {
|
||||
// 将读取的字节流写入到输出流
|
||||
outs.write(buf, 0, readByte);
|
||||
}
|
||||
logger.debug("复制单个文件 " + srcFileName + " 到" + descFileName
|
||||
+ "成功!");
|
||||
logger.debug("复制单个文件 {} 到{}成功!", srcFileName, descFileName);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
logger.debug("复制文件失败:" + e.getMessage());
|
||||
logger.debug("复制文件失败:{}", e.getMessage());
|
||||
return false;
|
||||
} finally {
|
||||
// 关闭输入输出流,首先关闭输出流,然后再关闭输入流
|
||||
if (outs != null) {
|
||||
try {
|
||||
outs.close();
|
||||
} catch (IOException oute) {
|
||||
oute.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (ins != null) {
|
||||
try {
|
||||
ins.close();
|
||||
} catch (IOException ine) {
|
||||
ine.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,8 +126,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
* @return 如果复制成功返回true,否则返回false
|
||||
*/
|
||||
public static boolean copyDirectory(String srcDirName, String descDirName) {
|
||||
return FileUtils.copyDirectoryCover(srcDirName, descDirName,
|
||||
false);
|
||||
return FileUtils.copyDirectoryCover(srcDirName, descDirName, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,17 +136,16 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
* @param coverlay 如果目标目录存在,是否覆盖
|
||||
* @return 如果复制成功返回true,否则返回false
|
||||
*/
|
||||
public static boolean copyDirectoryCover(String srcDirName,
|
||||
String descDirName, boolean coverlay) {
|
||||
public static boolean copyDirectoryCover(String srcDirName, String descDirName, boolean coverlay) {
|
||||
File srcDir = new File(srcDirName);
|
||||
// 判断源目录是否存在
|
||||
if (!srcDir.exists()) {
|
||||
logger.debug("复制目录失败,源目录 " + srcDirName + " 不存在!");
|
||||
logger.debug("复制目录失败,源目录 {} 不存在!", srcDirName);
|
||||
return false;
|
||||
}
|
||||
// 判断源目录是否是目录
|
||||
else if (!srcDir.isDirectory()) {
|
||||
logger.debug("复制目录失败," + srcDirName + " 不是一个目录!");
|
||||
logger.debug("复制目录失败,{} 不是一个目录!", srcDirName);
|
||||
return false;
|
||||
}
|
||||
// 如果目标文件夹名不以文件分隔符结尾,自动添加文件分隔符
|
||||
@@ -180,11 +160,11 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
// 允许覆盖目标目录
|
||||
logger.debug("目标目录已存在,准备删除!");
|
||||
if (!FileUtils.delFile(descDirNames)) {
|
||||
logger.debug("删除目录 " + descDirNames + " 失败!");
|
||||
logger.debug("删除目录 {} 失败!", descDirNames);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
logger.debug("目标目录复制失败,目标目录 " + descDirNames + " 已存在!");
|
||||
logger.debug("目标目录复制失败,目标目录 {} 已存在!", descDirNames);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@@ -200,32 +180,31 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
boolean flag = true;
|
||||
// 列出源目录下的所有文件名和子目录名
|
||||
File[] files = srcDir.listFiles();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
// 如果是一个单个文件,则直接复制
|
||||
if (files[i].isFile()) {
|
||||
flag = FileUtils.copyFile(files[i].getAbsolutePath(),
|
||||
descDirName + files[i].getName());
|
||||
// 如果拷贝文件失败,则退出循环
|
||||
if (!flag) {
|
||||
break;
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
// 如果是一个单个文件,则直接复制
|
||||
if (file.isFile()) {
|
||||
flag = FileUtils.copyFile(file.getAbsolutePath(), descDirName + file.getName());
|
||||
// 如果拷贝文件失败,则退出循环
|
||||
if (!flag) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 如果是子目录,则继续复制目录
|
||||
if (files[i].isDirectory()) {
|
||||
flag = FileUtils.copyDirectory(files[i]
|
||||
.getAbsolutePath(), descDirName + files[i].getName());
|
||||
// 如果拷贝目录失败,则退出循环
|
||||
if (!flag) {
|
||||
break;
|
||||
// 如果是子目录,则继续复制目录
|
||||
if (file.isDirectory()) {
|
||||
flag = FileUtils.copyDirectory(file.getAbsolutePath(), descDirName + file.getName());
|
||||
// 如果拷贝目录失败,则退出循环
|
||||
if (!flag) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag) {
|
||||
logger.debug("复制目录 " + srcDirName + " 到 " + descDirName + " 失败!");
|
||||
logger.debug("复制目录 {} 到 {} 失败!", srcDirName, descDirName);
|
||||
return false;
|
||||
}
|
||||
logger.debug("复制目录 " + srcDirName + " 到 " + descDirName + " 成功!");
|
||||
logger.debug("复制目录 {} 到 {} 成功!", srcDirName, descDirName);
|
||||
return true;
|
||||
|
||||
}
|
||||
@@ -238,7 +217,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
*/
|
||||
public static String readFileToString(String classResourcePath){
|
||||
try (InputStream in = new ClassPathResource(classResourcePath).getInputStream()){
|
||||
return IOUtils.toString(in, EncodeUtils.UTF_8);
|
||||
return IOUtils.toString(in, StandardCharsets.UTF_8);
|
||||
} catch (IOException e) {
|
||||
logger.warn("Error file convert: {}", e.getMessage());
|
||||
}
|
||||
@@ -246,16 +225,14 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 删除文件,可以删除单个文件或文件夹
|
||||
*
|
||||
* @param fileName 被删除的文件名
|
||||
* @return 如果删除成功,则返回true,否是返回false
|
||||
*/
|
||||
public static boolean delFile(String fileName) {
|
||||
File file = new File(fileName);
|
||||
if (!file.exists()) {
|
||||
logger.debug(fileName + " 文件不存在!");
|
||||
logger.debug("{} 文件不存在!", fileName);
|
||||
return true;
|
||||
} else {
|
||||
if (file.isFile()) {
|
||||
@@ -267,9 +244,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 删除单个文件
|
||||
*
|
||||
* @param fileName 被删除的文件名
|
||||
* @return 如果删除成功,则返回true,否则返回false
|
||||
*/
|
||||
@@ -277,22 +252,20 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
File file = new File(fileName);
|
||||
if (file.exists() && file.isFile()) {
|
||||
if (file.delete()) {
|
||||
logger.debug("删除文件 " + fileName + " 成功!");
|
||||
logger.debug("删除文件 {} 成功!", fileName);
|
||||
return true;
|
||||
} else {
|
||||
logger.debug("删除文件 " + fileName + " 失败!");
|
||||
logger.debug("删除文件 {} 失败!", fileName);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
logger.debug(fileName + " 文件不存在!");
|
||||
logger.debug("{} 文件不存在!", fileName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 删除目录及目录下的文件
|
||||
*
|
||||
* @param dirName 被删除的目录所在的文件路径
|
||||
* @return 如果目录删除成功,则返回true,否则返回false
|
||||
*/
|
||||
@@ -309,36 +282,36 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
boolean flag = true;
|
||||
// 列出全部文件及子目录
|
||||
File[] files = dirFile.listFiles();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
// 删除子文件
|
||||
if (files[i].isFile()) {
|
||||
flag = FileUtils.deleteFile(files[i].getAbsolutePath());
|
||||
// 如果删除文件失败,则退出循环
|
||||
if (!flag) {
|
||||
break;
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
// 删除子文件
|
||||
if (file.isFile()) {
|
||||
flag = FileUtils.deleteFile(file.getAbsolutePath());
|
||||
// 如果删除文件失败,则退出循环
|
||||
if (!flag) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 删除子目录
|
||||
else if (files[i].isDirectory()) {
|
||||
flag = FileUtils.deleteDirectory(files[i]
|
||||
.getAbsolutePath());
|
||||
// 如果删除子目录失败,则退出循环
|
||||
if (!flag) {
|
||||
break;
|
||||
// 删除子目录
|
||||
else if (file.isDirectory()) {
|
||||
flag = FileUtils.deleteDirectory(file.getAbsolutePath());
|
||||
// 如果删除子目录失败,则退出循环
|
||||
if (!flag) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag) {
|
||||
logger.debug("删除目录失败!");
|
||||
return false;
|
||||
}
|
||||
// 删除当前目录
|
||||
if (dirFile.delete()) {
|
||||
logger.debug("删除目录 " + dirName + " 成功!");
|
||||
logger.debug("删除目录 {} 成功!", dirName);
|
||||
return true;
|
||||
} else {
|
||||
logger.debug("删除目录 " + dirName + " 失败!");
|
||||
logger.debug("删除目录 {} 失败!", dirName);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -352,11 +325,11 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
public static boolean createFile(String descFileName) {
|
||||
File file = new File(descFileName);
|
||||
if (file.exists()) {
|
||||
logger.debug("文件 " + descFileName + " 已存在!");
|
||||
logger.debug("文件 {} 已存在!", descFileName);
|
||||
return false;
|
||||
}
|
||||
if (descFileName.endsWith(File.separator)) {
|
||||
logger.debug(descFileName + " 为目录,不能创建目录!");
|
||||
logger.debug("{} 为目录,不能创建目录!", descFileName);
|
||||
return false;
|
||||
}
|
||||
if (!file.getParentFile().exists()) {
|
||||
@@ -366,22 +339,19 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 创建文件
|
||||
try {
|
||||
if (file.createNewFile()) {
|
||||
logger.debug(descFileName + " 文件创建成功!");
|
||||
logger.debug("{} 文件创建成功!", descFileName);
|
||||
return true;
|
||||
} else {
|
||||
logger.debug(descFileName + " 文件创建失败!");
|
||||
logger.debug("{} 文件创建失败!", descFileName);
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.debug(descFileName + " 文件创建失败!");
|
||||
logger.debug("{} 文件创建失败!", descFileName, e);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -396,15 +366,15 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
}
|
||||
File descDir = new File(descDirNames);
|
||||
if (descDir.exists()) {
|
||||
logger.debug("目录 " + descDirNames + " 已存在!");
|
||||
logger.debug("目录 {} 已存在!", descDirNames);
|
||||
return false;
|
||||
}
|
||||
// 创建目录
|
||||
if (descDir.mkdirs()) {
|
||||
logger.debug("目录 " + descDirNames + " 创建成功!");
|
||||
logger.debug("目录 {} 创建成功!", descDirNames);
|
||||
return true;
|
||||
} else {
|
||||
logger.debug("目录 " + descDirNames + " 创建失败!");
|
||||
logger.debug("目录 {} 创建失败!", descDirNames);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -417,9 +387,9 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
public static void writeToFile(String fileName, String content, boolean append) {
|
||||
try {
|
||||
FileUtils.write(new File(fileName), content, EncodeUtils.UTF_8, append);
|
||||
logger.debug("文件 " + fileName + " 写入成功!");
|
||||
logger.debug("文件 {} 写入成功!", fileName);
|
||||
} catch (IOException e) {
|
||||
logger.debug("文件 " + fileName + " 写入失败! " + e.getMessage());
|
||||
logger.debug("文件 {} 写入失败!", fileName, e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -430,9 +400,9 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
public static void writeToFile(String fileName, String content, String encoding, boolean append) {
|
||||
try {
|
||||
FileUtils.write(new File(fileName), content, encoding, append);
|
||||
logger.debug("文件 " + fileName + " 写入成功!");
|
||||
logger.debug("文件 {} 写入成功!", fileName);
|
||||
} catch (IOException e) {
|
||||
logger.debug("文件 " + fileName + " 写入失败! " + e.getMessage());
|
||||
logger.debug("文件 {} 写入失败!", fileName, e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,12 +417,11 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
return;
|
||||
}
|
||||
byte[] data = EncodeUtils.decodeBase64(base64);
|
||||
|
||||
File file = new File(fileName);
|
||||
try {
|
||||
FileUtils.writeByteArrayToFile(file, data);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("文件 {} 写入失败!", fileName, e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -470,33 +439,30 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
public static void zipFiles(String srcDirName, String fileName, String descFileName) {
|
||||
// 判断目录是否存在
|
||||
if (srcDirName == null) {
|
||||
logger.debug("文件压缩失败,目录 " + srcDirName + " 不存在!");
|
||||
logger.debug("文件压缩失败,目录 {} 不存在!", srcDirName);
|
||||
return;
|
||||
}
|
||||
File fileDir = new File(srcDirName);
|
||||
if (!fileDir.exists() || !fileDir.isDirectory()) {
|
||||
logger.debug("文件压缩失败,目录 " + srcDirName + " 不存在!");
|
||||
logger.debug("文件压缩失败,目录 {} 不存在!", srcDirName);
|
||||
return;
|
||||
}
|
||||
String dirPath = fileDir.getAbsolutePath();
|
||||
File descFile = new File(descFileName);
|
||||
try {
|
||||
ZipOutputStream zouts = new ZipOutputStream(new FileOutputStream(descFile));
|
||||
try (ZipOutputStream outs = new ZipOutputStream(new FileOutputStream(descFile));) {
|
||||
if ("*".equals(fileName) || StringUtils.EMPTY.equals(fileName)) {
|
||||
FileUtils.zipDirectoryToZipFile(dirPath, fileDir, zouts);
|
||||
FileUtils.zipDirectoryToZipFile(dirPath, fileDir, outs);
|
||||
} else {
|
||||
File file = new File(fileDir, fileName);
|
||||
if (file.isFile()) {
|
||||
FileUtils.zipFilesToZipFile(dirPath, file, zouts);
|
||||
FileUtils.zipFilesToZipFile(dirPath, file, outs);
|
||||
} else {
|
||||
FileUtils.zipDirectoryToZipFile(dirPath, file, zouts);
|
||||
FileUtils.zipDirectoryToZipFile(dirPath, file, outs);
|
||||
}
|
||||
}
|
||||
zouts.close();
|
||||
logger.debug(descFileName + " 文件压缩成功!");
|
||||
logger.debug("{} 文件压缩成功!", descFileName);
|
||||
} catch (Exception e) {
|
||||
logger.debug("文件压缩失败:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
logger.error("文件压缩失败!", e);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -510,10 +476,11 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
String descFileNames = descFileName;
|
||||
if (!descFileNames.endsWith(File.separator)) {
|
||||
descFileNames = descFileNames + File.separator;
|
||||
}
|
||||
try {
|
||||
}
|
||||
try (
|
||||
// 根据ZIP文件创建ZipFile对象
|
||||
ZipFile zipFile = new ZipFile(zipFileName);
|
||||
) {
|
||||
ZipEntry entry = null;
|
||||
String entryName = null;
|
||||
String descFileDir = null;
|
||||
@@ -537,21 +504,21 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
new File(descFileDir).getParentFile().mkdirs();
|
||||
}
|
||||
File file = new File(descFileDir);
|
||||
// 打开文件输出流
|
||||
OutputStream os = new FileOutputStream(file);
|
||||
// 从ZipFile对象中打开entry的输入流
|
||||
InputStream is = zipFile.getInputStream(entry);
|
||||
while ((readByte = is.read(buf)) != -1) {
|
||||
os.write(buf, 0, readByte);
|
||||
try (
|
||||
// 打开文件输出流
|
||||
OutputStream os = new FileOutputStream(file);
|
||||
// 从ZipFile对象中打开entry的输入流
|
||||
InputStream is = zipFile.getInputStream(entry);
|
||||
) {
|
||||
while ((readByte = is.read(buf)) != -1) {
|
||||
os.write(buf, 0, readByte);
|
||||
}
|
||||
}
|
||||
os.close();
|
||||
is.close();
|
||||
}
|
||||
zipFile.close();
|
||||
logger.debug("文件解压成功!");
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
logger.debug("文件解压失败:" + e.getMessage());
|
||||
logger.error("文件解压失败!", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -566,25 +533,26 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
if (fileDir.isDirectory()) {
|
||||
File[] files = fileDir.listFiles();
|
||||
// 空的文件夹
|
||||
if (files.length == 0) {
|
||||
if (files != null && files.length == 0) {
|
||||
// 目录信息
|
||||
ZipEntry entry = new ZipEntry(getEntryName(dirPath, fileDir));
|
||||
try {
|
||||
zouts.putNextEntry(entry);
|
||||
zouts.closeEntry();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("压缩失败!", e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
if (files[i].isFile()) {
|
||||
// 如果是文件,则调用文件压缩方法
|
||||
FileUtils.zipFilesToZipFile(dirPath, files[i], zouts);
|
||||
} else {
|
||||
// 如果是目录,则递归调用
|
||||
FileUtils.zipDirectoryToZipFile(dirPath, files[i], zouts);
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
if (file.isFile()) {
|
||||
// 如果是文件,则调用文件压缩方法
|
||||
FileUtils.zipFilesToZipFile(dirPath, file, zouts);
|
||||
} else {
|
||||
// 如果是目录,则递归调用
|
||||
FileUtils.zipDirectoryToZipFile(dirPath, file, zouts);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -597,17 +565,16 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
* @param zouts 输出流
|
||||
*/
|
||||
public static void zipFilesToZipFile(String dirPath, File file, ZipOutputStream zouts) {
|
||||
FileInputStream fin = null;
|
||||
ZipEntry entry = null;
|
||||
// 创建复制缓冲区
|
||||
byte[] buf = new byte[4096];
|
||||
int readByte = 0;
|
||||
if (file.isFile()) {
|
||||
try {
|
||||
try (
|
||||
// 创建一个文件输入流
|
||||
fin = new FileInputStream(file);
|
||||
FileInputStream fin = new FileInputStream(file);
|
||||
) {
|
||||
// 创建一个ZipEntry
|
||||
entry = new ZipEntry(getEntryName(dirPath, file));
|
||||
ZipEntry entry = new ZipEntry(getEntryName(dirPath, file));
|
||||
// 存储信息到压缩文件
|
||||
zouts.putNextEntry(entry);
|
||||
// 复制字节到压缩文件
|
||||
@@ -615,10 +582,9 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
zouts.write(buf, 0, readByte);
|
||||
}
|
||||
zouts.closeEntry();
|
||||
fin.close();
|
||||
logger.debug("添加文件 " + file.getAbsolutePath() + " 到zip文件中!");
|
||||
logger.debug("添加文件 {} 到zip文件中!", file.getAbsolutePath());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("添加文件失败!", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -627,7 +593,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
* 获取待压缩文件在ZIP文件中entry的名字,即相对于跟目录的相对路径名
|
||||
* @param dirPath 目录名
|
||||
* @param file entry文件名
|
||||
* @return
|
||||
* @return entry名字
|
||||
*/
|
||||
private static String getEntryName(String dirPath, File file) {
|
||||
String dirPaths = dirPath;
|
||||
@@ -842,8 +808,8 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
|
||||
/**
|
||||
* 根据图片Base64获取文件扩展名
|
||||
* @param imageBase64
|
||||
* @return
|
||||
* @param imageBase64 图片编码内容
|
||||
* @return 图片文件的扩展名
|
||||
* @author ThinkGem
|
||||
*/
|
||||
public static String getFileExtensionByImageBase64(String imageBase64){
|
||||
@@ -861,33 +827,28 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
|
||||
/**
|
||||
* 获取工程源文件所在路径
|
||||
* @return
|
||||
*/
|
||||
public static String getProjectPath(){
|
||||
String projectPath = "";
|
||||
try {
|
||||
File file = ResourceUtils.getResource("").getFile();
|
||||
if (file != null){
|
||||
while(true){
|
||||
File f = new File(path(file.getPath() + "/src/main"));
|
||||
if (f.exists()){
|
||||
break;
|
||||
}
|
||||
f = new File(path(file.getPath() + "/target/classes"));
|
||||
if (f.exists()){
|
||||
break;
|
||||
}
|
||||
File p = file.getParentFile();
|
||||
if (p != null){
|
||||
file = p;
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
while (true) {
|
||||
File f = new File(path(file.getPath() + "/src/main"));
|
||||
if (f.exists()) {
|
||||
break;
|
||||
}
|
||||
f = new File(path(file.getPath() + "/target/classes"));
|
||||
if (f.exists()) {
|
||||
break;
|
||||
}
|
||||
File p = file.getParentFile();
|
||||
if (p != null) {
|
||||
file = p;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
projectPath = file.toString();
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
// 忽略异常
|
||||
projectPath = file.toString();
|
||||
} catch (IOException e) {
|
||||
// 忽略异常
|
||||
}
|
||||
@@ -900,33 +861,28 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
|
||||
|
||||
/**
|
||||
* 获取工程源文件所在路径
|
||||
* @return
|
||||
*/
|
||||
public static String getWebappPath(){
|
||||
String webappPath = "";
|
||||
try {
|
||||
File file = ResourceUtils.getResource("").getFile();
|
||||
if (file != null){
|
||||
while(true){
|
||||
File f = new File(path(file.getPath() + "/WEB-INF/classes"));
|
||||
if (f.exists()){
|
||||
break;
|
||||
}
|
||||
f = new File(path(file.getPath() + "/src/main/webapp"));
|
||||
if (f.exists()){
|
||||
return f.getPath();
|
||||
}
|
||||
File p = file.getParentFile();
|
||||
if (p != null){
|
||||
file = p;
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
while (true) {
|
||||
File f = new File(path(file.getPath() + "/WEB-INF/classes"));
|
||||
if (f.exists()) {
|
||||
break;
|
||||
}
|
||||
f = new File(path(file.getPath() + "/src/main/webapp"));
|
||||
if (f.exists()) {
|
||||
return f.getPath();
|
||||
}
|
||||
File p = file.getParentFile();
|
||||
if (p != null) {
|
||||
file = p;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
webappPath = file.toString();
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
// 忽略异常
|
||||
webappPath = file.toString();
|
||||
} catch (IOException e) {
|
||||
// 忽略异常
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
*/
|
||||
package com.jeesite.common.io;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -15,71 +18,70 @@ import java.io.InputStream;
|
||||
/**
|
||||
* 数据流工具类
|
||||
* @author ThinkGem
|
||||
* @version 2025-08-08
|
||||
*/
|
||||
public class IOUtils extends org.apache.commons.io.IOUtils {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(IOUtils.class);
|
||||
|
||||
/**
|
||||
* 根据文件路径创建文件输入流处理 以字节为单位(非 unicode )
|
||||
* @param filePath
|
||||
* @return
|
||||
* @param filePath 文件路径
|
||||
* @return 文件流
|
||||
*/
|
||||
public static FileInputStream getFileInputStream(String filePath) {
|
||||
FileInputStream fileInputStream = null;
|
||||
try {
|
||||
fileInputStream = new FileInputStream(filePath);
|
||||
} catch (FileNotFoundException e) {
|
||||
System.out.println("错误信息:文件不存在");
|
||||
e.printStackTrace();
|
||||
logger.error("文件不存在!", e);
|
||||
}
|
||||
return fileInputStream;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文件对象创建文件输入流处理 以字节为单位(非 unicode )
|
||||
* @param file
|
||||
* @return
|
||||
* @param file 文件对象
|
||||
* @return 文件流
|
||||
*/
|
||||
public static FileInputStream getFileInputStream(File file) {
|
||||
FileInputStream fileInputStream = null;
|
||||
try {
|
||||
fileInputStream = new FileInputStream(file);
|
||||
} catch (FileNotFoundException e) {
|
||||
System.out.println("错误信息:文件不存在");
|
||||
e.printStackTrace();
|
||||
logger.error("文件不存在!", e);
|
||||
}
|
||||
return fileInputStream;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文件对象创建文件输出流处理 以字节为单位(非 unicode )
|
||||
* @param file
|
||||
* @param file 文件对象
|
||||
* @param append true:文件以追加方式打开,false:则覆盖原文件的内容
|
||||
* @return
|
||||
* @return 文件流
|
||||
*/
|
||||
public static FileOutputStream getFileOutputStream(File file, boolean append) {
|
||||
FileOutputStream fileOutputStream = null;
|
||||
try {
|
||||
fileOutputStream = new FileOutputStream(file, append);
|
||||
} catch (FileNotFoundException e) {
|
||||
System.out.println("错误信息:文件不存在");
|
||||
e.printStackTrace();
|
||||
logger.error("文件不存在!", e);
|
||||
}
|
||||
return fileOutputStream;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文件路径创建文件输出流处理 以字节为单位(非 unicode )
|
||||
* @param filePath
|
||||
* @param filePath 文件路径
|
||||
* @param append true:文件以追加方式打开,false:则覆盖原文件的内容
|
||||
* @return
|
||||
* @return 文件流
|
||||
*/
|
||||
public static FileOutputStream getFileOutputStream(String filePath, boolean append) {
|
||||
FileOutputStream fileOutputStream = null;
|
||||
try {
|
||||
fileOutputStream = new FileOutputStream(filePath, append);
|
||||
} catch (FileNotFoundException e) {
|
||||
System.out.println("错误信息:文件不存在");
|
||||
e.printStackTrace();
|
||||
logger.error("文件不存在!", e);
|
||||
}
|
||||
return fileOutputStream;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.util.regex.Pattern;
|
||||
* 相同的属性在最后载入的文件中的值将会覆盖之前的值,
|
||||
* 取不到从System.getProperty()获取。
|
||||
* @author ThinkGem
|
||||
* @version 2017-12-30
|
||||
* @version 2025-4-17
|
||||
*/
|
||||
public class PropertiesUtils {
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.util.Date;
|
||||
/**
|
||||
* 日期工具类, 继承org.apache.commons.lang.time.DateUtils类
|
||||
* @author ThinkGem
|
||||
* @version 2017-1-4
|
||||
* @version 2025-08-08
|
||||
*/
|
||||
public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
|
||||
@@ -179,8 +179,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
|
||||
/**
|
||||
* 获取过去的天数
|
||||
* @param date
|
||||
* @return
|
||||
* @param date 日期
|
||||
*/
|
||||
public static long pastDays(Date date) {
|
||||
long t = System.currentTimeMillis()-date.getTime();
|
||||
@@ -189,8 +188,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
|
||||
/**
|
||||
* 获取过去的小时
|
||||
* @param date
|
||||
* @return
|
||||
* @param date 日期
|
||||
*/
|
||||
public static long pastHour(Date date) {
|
||||
long t = System.currentTimeMillis()-date.getTime();
|
||||
@@ -199,8 +197,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
|
||||
/**
|
||||
* 获取过去的分钟
|
||||
* @param date
|
||||
* @return
|
||||
* @param date 日期
|
||||
*/
|
||||
public static long pastMinutes(Date date) {
|
||||
long t = System.currentTimeMillis()-date.getTime();
|
||||
@@ -209,15 +206,13 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
|
||||
/**
|
||||
* 获取两个日期之间的天数
|
||||
*
|
||||
* @param before
|
||||
* @param after
|
||||
* @return
|
||||
* @param before 开始日期
|
||||
* @param after 结束日期
|
||||
*/
|
||||
public static double getDistanceOfTwoDate(Date before, Date after) {
|
||||
long beforeTime = before.getTime();
|
||||
long afterTime = after.getTime();
|
||||
return (afterTime - beforeTime) / (1000 * 60 * 60 * 24);
|
||||
return (double) (afterTime - beforeTime) / (1000 * 60 * 60 * 24);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -250,8 +245,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
|
||||
/**
|
||||
* 获取日期是当年的第几周
|
||||
* @param date
|
||||
* @return
|
||||
* @param date 日期
|
||||
*/
|
||||
public static int getWeekOfYear(Date date){
|
||||
Calendar cal = Calendar.getInstance(LocaleUtils.getTimeZone(), LocaleUtils.getLocale());
|
||||
@@ -262,7 +256,6 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
/**
|
||||
* 获取一天的开始时间(如:2015-11-3 00:00:00.000)
|
||||
* @param date 日期
|
||||
* @return
|
||||
*/
|
||||
public static Date getOfDayFirst(Date date) {
|
||||
if (date == null){
|
||||
@@ -280,7 +273,6 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
/**
|
||||
* 获取一天的最后时间(如:2015-11-3 23:59:59.999)
|
||||
* @param date 日期
|
||||
* @return
|
||||
*/
|
||||
public static Date getOfDayLast(Date date) {
|
||||
if (date == null){
|
||||
@@ -297,7 +289,6 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
|
||||
/**
|
||||
* 获取服务器启动时间
|
||||
* @return
|
||||
*/
|
||||
public static Date getServerStartDate(){
|
||||
long time = ManagementFactory.getRuntimeMXBean().getStartTime();
|
||||
|
||||
@@ -19,8 +19,7 @@ public class ExceptionUtils {
|
||||
|
||||
/**
|
||||
* 在request中获取异常类
|
||||
* @param request
|
||||
* @return
|
||||
* @param request 请求对象
|
||||
*/
|
||||
public static Throwable getThrowable(HttpServletRequest request){
|
||||
Throwable ex = null;
|
||||
|
||||
@@ -79,7 +79,6 @@ public class NumberUtils extends org.apache.commons.lang3.math.NumberUtils {
|
||||
|
||||
/**
|
||||
* 格式化双精度,保留两个小数
|
||||
* @return
|
||||
*/
|
||||
public static String formatDouble(Double b) {
|
||||
BigDecimal bg = new BigDecimal(b);
|
||||
@@ -88,7 +87,6 @@ public class NumberUtils extends org.apache.commons.lang3.math.NumberUtils {
|
||||
|
||||
/**
|
||||
* 百分比计算
|
||||
* @return
|
||||
*/
|
||||
public static String formatScale(double one, long total) {
|
||||
BigDecimal bg = new BigDecimal(one * 100 / total);
|
||||
@@ -97,8 +95,6 @@ public class NumberUtils extends org.apache.commons.lang3.math.NumberUtils {
|
||||
|
||||
/**
|
||||
* 格式化数值类型
|
||||
* @param data
|
||||
* @param pattern
|
||||
*/
|
||||
public static String formatNumber(Object data, String pattern) {
|
||||
if (data == null){
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.List;
|
||||
*/
|
||||
public class VideoUtils {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(VideoUtils.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(VideoUtils.class);
|
||||
private static String ffmpegFile; // ffmpeg.exe所放的路径
|
||||
private static String mencoderFile; // mencoder.exe所放的路径
|
||||
private static String qtFaststartFile; // qt-faststart.exe所放的路径
|
||||
@@ -111,10 +111,10 @@ public class VideoUtils {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
statusTemp = false;
|
||||
log.error("视频剪切图片失败", e);
|
||||
logger.error("视频剪切图片失败", e);
|
||||
}
|
||||
}
|
||||
log.debug("视频剪切图片" + (statusTemp ? "成功" : "失败") + ",用时:" + TimeUtils.formatTime(System.currentTimeMillis() - startTime));
|
||||
logger.debug("视频剪切图片" + (statusTemp ? "成功" : "失败") + ",用时:" + TimeUtils.formatTime(System.currentTimeMillis() - startTime));
|
||||
return statusTemp;
|
||||
}
|
||||
|
||||
@@ -128,19 +128,19 @@ public class VideoUtils {
|
||||
int type = checkContentType();
|
||||
String tempFile = outputFile + ".tmp";
|
||||
if (statusTemp && type == 0) {
|
||||
log.debug("使用ffmpage进行视频转换");
|
||||
logger.debug("使用ffmpage进行视频转换");
|
||||
statusTemp = processFfmpeg(inputFile, tempFile);
|
||||
} else if (statusTemp && type == 1) {
|
||||
log.debug("使用mencoder进行视频转换");
|
||||
logger.debug("使用mencoder进行视频转换");
|
||||
statusTemp = processMencoder(inputFile, tempFile);
|
||||
}
|
||||
if (statusTemp){
|
||||
log.debug("将mp4视频的元数据信息转到视频第一帧");
|
||||
logger.debug("将mp4视频的元数据信息转到视频第一帧");
|
||||
statusTemp = processQtFaststart(tempFile, outputFile);
|
||||
}
|
||||
log.debug("删除临时文件");
|
||||
logger.debug("删除临时文件");
|
||||
FileUtils.deleteFile(tempFile);
|
||||
log.debug("视频转换" + (statusTemp ? "成功" : "失败") + ",用时:" + TimeUtils.formatTime(System.currentTimeMillis() - startTime));
|
||||
logger.debug("视频转换{},用时:{}", statusTemp ? "成功" : "失败", TimeUtils.formatTime(System.currentTimeMillis() - startTime));
|
||||
return statusTemp;
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ public class VideoUtils {
|
||||
public boolean checkfile(String inputFile) {
|
||||
File file = new File(inputFile);
|
||||
if (!file.isFile() || !file.exists()) {
|
||||
log.warn("文件不存在!");
|
||||
logger.warn("文件不存在!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -279,18 +279,18 @@ public class VideoUtils {
|
||||
*/
|
||||
private boolean process(List<String> command) {
|
||||
try {
|
||||
log.debug(StringUtils.join(command, StringUtils.SPACE));
|
||||
logger.debug(StringUtils.join(command, StringUtils.SPACE));
|
||||
// Process process = new ProcessBuilder(command).redirectErrorStream(true).start();
|
||||
Process process = Runtime.getRuntime().exec(command.toArray(new String[command.size()]));
|
||||
Process process = Runtime.getRuntime().exec(command.toArray(new String[0]));
|
||||
new PrintErrorReader(process.getErrorStream()).start();
|
||||
new PrintInputStream(process.getInputStream()).start();
|
||||
process.waitFor();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
if (StringUtils.contains(e.getMessage(), "CreateProcess error=2")){
|
||||
log.error("缺少视频转换工具,请配置video.ffmpegFile相关参数。" + e.getMessage());
|
||||
logger.error("缺少视频转换工具,请配置video.ffmpegFile相关参数。{}", e.getMessage());
|
||||
}else{
|
||||
log.error(e.getMessage(), e);
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -406,10 +406,10 @@ public class VideoUtils {
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(__is));
|
||||
String line = null;
|
||||
while ((line = br.readLine()) != null) {
|
||||
log.debug(line);
|
||||
logger.debug(line);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -427,10 +427,10 @@ public class VideoUtils {
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(__is));
|
||||
String line = null;
|
||||
while ((line = br.readLine()) != null) {
|
||||
log.error(line);
|
||||
logger.error(line);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.jeesite.common.io.PropertiesUtils;
|
||||
|
||||
/**
|
||||
* 发送电子邮件
|
||||
* @author ThinkGem
|
||||
*/
|
||||
public class EmailUtils {
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
*/
|
||||
package com.jeesite.common.msg;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@@ -5,6 +9,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* 发送短信(请实现send方法)
|
||||
* @author ThinkGem
|
||||
*/
|
||||
public class SmsUtils {
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
*/
|
||||
package com.jeesite.common.network;
|
||||
|
||||
import com.jeesite.common.codec.EncodeUtils;
|
||||
@@ -6,12 +10,15 @@ import com.jeesite.common.lang.StringUtils;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* IP 地址工具
|
||||
* @author ThinkGem
|
||||
*/
|
||||
public class IpUtils {
|
||||
|
||||
/**
|
||||
* 获取客户端IP地址
|
||||
* @param request
|
||||
* @return
|
||||
* @param request 请求对象
|
||||
*/
|
||||
public static String getRemoteAddr(HttpServletRequest request) {
|
||||
if (request == null) {
|
||||
@@ -38,8 +45,7 @@ public class IpUtils {
|
||||
|
||||
/**
|
||||
* 是否是本地地址
|
||||
* @param ip
|
||||
* @return
|
||||
* @param ip 地址
|
||||
*/
|
||||
public static boolean isLocalAddr(String ip){
|
||||
return StringUtils.inString(ip, "127.0.0.1", "0:0:0:0:0:0:0:1");
|
||||
@@ -47,13 +53,12 @@ public class IpUtils {
|
||||
|
||||
/**
|
||||
* 判断IP地址为内网IP还是公网IP
|
||||
*
|
||||
* <br>
|
||||
* tcp/ip协议中,专门保留了三个IP地址区域作为私有地址,其地址范围如下:
|
||||
* 10.0.0.0/8:10.0.0.0~10.255.255.255
|
||||
* 172.16.0.0/12:172.16.0.0~172.31.255.255
|
||||
* 192.168.0.0/16:192.168.0.0~192.168.255.255
|
||||
*
|
||||
* @param ip
|
||||
* @param ip 地址
|
||||
* @return
|
||||
*/
|
||||
public static boolean isInternalAddr(String ip) {
|
||||
|
||||
@@ -4,18 +4,22 @@
|
||||
*/
|
||||
package com.jeesite.common.network;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
/**
|
||||
* MAC地址工具
|
||||
*
|
||||
* @author ThinkGem
|
||||
* @version 2014-6-18
|
||||
*/
|
||||
public class MacUtils {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(MacUtils.class);
|
||||
|
||||
/**
|
||||
* 获取当前操作系统名称. return 操作系统名称 例如:windows,Linux,Unix等.
|
||||
*/
|
||||
@@ -25,7 +29,6 @@ public class MacUtils {
|
||||
|
||||
/**
|
||||
* 获取Unix网卡的mac地址.
|
||||
*
|
||||
* @return mac地址
|
||||
*/
|
||||
public static String getUnixMACAddress() {
|
||||
@@ -33,39 +36,31 @@ public class MacUtils {
|
||||
BufferedReader bufferedReader = null;
|
||||
Process process = null;
|
||||
try {
|
||||
/**
|
||||
* Unix下的命令,一般取eth0作为本地主网卡 显示信息中包含有mac地址信息
|
||||
*/
|
||||
// Unix下的命令,一般取eth0作为本地主网卡 显示信息中包含有mac地址信息
|
||||
process = Runtime.getRuntime().exec("ifconfig eth0");
|
||||
bufferedReader = new BufferedReader(new InputStreamReader(
|
||||
process.getInputStream()));
|
||||
String line = null;
|
||||
int index = -1;
|
||||
while ((line = bufferedReader.readLine()) != null) {
|
||||
/**
|
||||
* 寻找标示字符串[hwaddr]
|
||||
*/
|
||||
// 寻找标示字符串[hwaddr]
|
||||
index = line.toLowerCase().indexOf("hwaddr");
|
||||
/**
|
||||
* 找到了
|
||||
*/
|
||||
// 找到了
|
||||
if (index != -1) {
|
||||
/**
|
||||
* 取出mac地址并去除2边空格
|
||||
*/
|
||||
// 取出mac地址并去除2边空格
|
||||
mac = line.substring(index + "hwaddr".length() + 1).trim();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
if (bufferedReader != null) {
|
||||
bufferedReader.close();
|
||||
}
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
// ignore
|
||||
}
|
||||
bufferedReader = null;
|
||||
process = null;
|
||||
@@ -84,9 +79,7 @@ public class MacUtils {
|
||||
BufferedReader bufferedReader = null;
|
||||
Process process = null;
|
||||
try {
|
||||
/**
|
||||
* linux下的命令,一般取eth0作为本地主网卡 显示信息中包含有mac地址信息
|
||||
*/
|
||||
// linux下的命令,一般取eth0作为本地主网卡 显示信息中包含有mac地址信息
|
||||
process = Runtime.getRuntime().exec("ifconfig eth0");
|
||||
bufferedReader = new BufferedReader(new InputStreamReader(
|
||||
process.getInputStream()));
|
||||
@@ -94,26 +87,22 @@ public class MacUtils {
|
||||
int index = -1;
|
||||
while ((line = bufferedReader.readLine()) != null) {
|
||||
index = line.toLowerCase().indexOf("硬件地址");
|
||||
/**
|
||||
* 找到了
|
||||
*/
|
||||
// 找到了
|
||||
if (index != -1) {
|
||||
/**
|
||||
* 取出mac地址并去除2边空格
|
||||
*/
|
||||
// 取出mac地址并去除2边空格
|
||||
mac = line.substring(index + 4).trim();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
if (bufferedReader != null) {
|
||||
bufferedReader.close();
|
||||
}
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
// ignore
|
||||
}
|
||||
bufferedReader = null;
|
||||
process = null;
|
||||
@@ -129,7 +118,6 @@ public class MacUtils {
|
||||
|
||||
/**
|
||||
* 获取widnows网卡的mac地址.
|
||||
*
|
||||
* @return mac地址
|
||||
*/
|
||||
public static String getWindowsMACAddress() {
|
||||
@@ -137,37 +125,31 @@ public class MacUtils {
|
||||
BufferedReader bufferedReader = null;
|
||||
Process process = null;
|
||||
try {
|
||||
/**
|
||||
* windows下的命令,显示信息中包含有mac地址信息
|
||||
*/
|
||||
// windows下的命令,显示信息中包含有mac地址信息
|
||||
process = Runtime.getRuntime().exec("ipconfig /all");
|
||||
bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
String line = null;
|
||||
int index = -1;
|
||||
while ((line = bufferedReader.readLine()) != null) {
|
||||
/**
|
||||
* 寻找标示字符串[physical address 或 物理地址]
|
||||
*/
|
||||
// 寻找标示字符串[physical address 或 物理地址]
|
||||
if (line.split("-").length == 6){
|
||||
index = line.indexOf(":");
|
||||
if (index != -1) {
|
||||
/**
|
||||
* 取出mac地址并去除2边空格
|
||||
*/
|
||||
// 取出mac地址并去除2边空格
|
||||
mac = line.substring(index + 1).trim();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
if (bufferedReader != null) {
|
||||
bufferedReader.close();
|
||||
}
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
// ignore
|
||||
}
|
||||
bufferedReader = null;
|
||||
process = null;
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.Map;
|
||||
/**
|
||||
* 反射工具类. 提供调用getter/setter方法, 访问私有变量, 调用私有方法, 获取泛型类型Class, 被AOP过的真实类等工具函数.
|
||||
* @author calvin、ThinkGem
|
||||
* @version 2023-2-6
|
||||
* @version 2025-08-08
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class ReflectUtils {
|
||||
@@ -112,7 +112,7 @@ public class ReflectUtils {
|
||||
if (field == null) {
|
||||
//throw new IllegalArgumentException("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 ");
|
||||
if (obj != null) {
|
||||
logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 ");
|
||||
logger.debug("在 [{}] 中,没有找到 [{}] 字段 ", obj.getClass(), fieldName);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -132,7 +132,7 @@ public class ReflectUtils {
|
||||
Field field = getAccessibleField(obj, fieldName);
|
||||
if (field == null) {
|
||||
//throw new IllegalArgumentException("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 ");
|
||||
logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 ");
|
||||
logger.debug("在 [{}] 中,没有找到 [{}] 字段 ", obj.getClass(), fieldName);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@@ -157,9 +157,7 @@ public class ReflectUtils {
|
||||
Method method = getAccessibleMethod(obj, methodName, parameterTypes);
|
||||
if (method == null) {
|
||||
//throw new IllegalArgumentException("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 ");
|
||||
if (obj != null) {
|
||||
logger.debug("在 [" + (obj.getClass() == Class.class ? obj : obj.getClass()) + "] 中,没有找到 [" + methodName + "] 方法 ");
|
||||
}
|
||||
logger.debug("在 [{}] 中,没有找到 [{}] 方法 ", obj.getClass() == Class.class ? obj : obj.getClass(), methodName);
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
@@ -182,7 +180,7 @@ public class ReflectUtils {
|
||||
if (method == null) {
|
||||
// 如果为空不报错,直接返回空。 throw new IllegalArgumentException("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 ");
|
||||
if (obj != null) {
|
||||
logger.debug("在 [" + (obj.getClass() == Class.class ? obj : obj.getClass()) + "] 中,没有找到 [" + methodName + "] 方法 ");
|
||||
logger.debug("在 [{}] 中,没有找到 [{}] 方法 ", obj.getClass() == Class.class ? obj : obj.getClass(), methodName);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -252,7 +250,7 @@ public class ReflectUtils {
|
||||
args[i] = DateUtil.getJavaDate((Double) args[i]);
|
||||
}
|
||||
}else{
|
||||
System.out.println(cs[i] + " " + args[i]);
|
||||
logger.debug("class: {}, args: {}", cs[i], args[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -405,17 +403,16 @@ public class ReflectUtils {
|
||||
public static Class getClassGenricType(final Class clazz, final int index) {
|
||||
Type genType = clazz.getGenericSuperclass();
|
||||
if (!(genType instanceof ParameterizedType)) {
|
||||
logger.debug(clazz.getSimpleName() + "'s superclass not ParameterizedType");
|
||||
logger.debug("{}'s superclass not ParameterizedType", clazz.getSimpleName());
|
||||
return Object.class;
|
||||
}
|
||||
Type[] params = ((ParameterizedType) genType).getActualTypeArguments();
|
||||
if (index >= params.length || index < 0) {
|
||||
logger.debug("Index: " + index + ", Size of " + clazz.getSimpleName() + "'s Parameterized Type: "
|
||||
+ params.length);
|
||||
logger.debug("Index: {}, Size of {}'s Parameterized Type: {}", index, clazz.getSimpleName(), params.length);
|
||||
return Object.class;
|
||||
}
|
||||
if (!(params[index] instanceof Class)) {
|
||||
logger.debug(clazz.getSimpleName() + " not set the actual class on superclass generic parameter");
|
||||
logger.debug("{} not set the actual class on superclass generic parameter", clazz.getSimpleName());
|
||||
return Object.class;
|
||||
}
|
||||
return (Class) params[index];
|
||||
@@ -429,7 +426,7 @@ public class ReflectUtils {
|
||||
throw new RuntimeException("Instance must not be null");
|
||||
}
|
||||
Class clazz = instance.getClass();
|
||||
if (clazz != null && clazz.getName().contains(CGLIB_CLASS_SEPARATOR)) {
|
||||
if (clazz.getName().contains(CGLIB_CLASS_SEPARATOR)) {
|
||||
Class<?> superClass = clazz.getSuperclass();
|
||||
if (superClass != null && !Object.class.equals(superClass)) {
|
||||
return superClass;
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
*/
|
||||
package com.jeesite.common.text;
|
||||
|
||||
import net.sourceforge.pinyin4j.PinyinHelper;
|
||||
@@ -6,6 +10,8 @@ import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
|
||||
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
|
||||
import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType;
|
||||
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -14,10 +20,12 @@ import java.util.regex.Pattern;
|
||||
* @author ThinkGem
|
||||
*/
|
||||
public class PinyinUtils {
|
||||
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(PinyinUtils.class);
|
||||
|
||||
private static class Static{
|
||||
private static Pattern idPatt = Pattern.compile("\\W");
|
||||
private static HanyuPinyinOutputFormat defaultFormat;
|
||||
private static final Pattern idPat = Pattern.compile("\\W");
|
||||
private static final HanyuPinyinOutputFormat defaultFormat;
|
||||
static{
|
||||
defaultFormat = new HanyuPinyinOutputFormat();
|
||||
defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
|
||||
@@ -46,28 +54,28 @@ public class PinyinUtils {
|
||||
if (chinese == null){
|
||||
return null;
|
||||
}
|
||||
StringBuffer pybf = new StringBuffer();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
char[] arr = chinese.toCharArray();
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
if (arr[i] > 128) {
|
||||
for (char c : arr) {
|
||||
if (c > 128) {
|
||||
try {
|
||||
String[] temp = PinyinHelper.toHanyuPinyinStringArray(arr[i], Static.defaultFormat);
|
||||
String[] temp = PinyinHelper.toHanyuPinyinStringArray(c, Static.defaultFormat);
|
||||
if (temp != null && temp.length > 0) {
|
||||
pybf.append(temp[0].charAt(0));
|
||||
}else{
|
||||
pybf.append(String.valueOf(arr[i]));
|
||||
sb.append(temp[0].charAt(0));
|
||||
} else {
|
||||
sb.append(String.valueOf(c));
|
||||
}
|
||||
} catch (BadHanyuPinyinOutputFormatCombination e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
} else {
|
||||
pybf.append(arr[i]);
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
if (isId){
|
||||
return Static.idPatt.matcher(pybf.toString()).replaceAll("").trim();
|
||||
return Static.idPat.matcher(sb.toString()).replaceAll("").trim();
|
||||
}
|
||||
return pybf.toString();
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,28 +98,28 @@ public class PinyinUtils {
|
||||
if (chinese == null){
|
||||
return null;
|
||||
}
|
||||
StringBuffer pybf = new StringBuffer();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
char[] arr = chinese.toCharArray();
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
if (arr[i] > 128) {
|
||||
for (char c : arr) {
|
||||
if (c > 128) {
|
||||
try {
|
||||
String[] ss = PinyinHelper.toHanyuPinyinStringArray(arr[i], Static.defaultFormat);
|
||||
if (ss != null && ss.length > 0){
|
||||
pybf.append(ss[0]);
|
||||
}else{
|
||||
pybf.append(String.valueOf(arr[i]));
|
||||
String[] ss = PinyinHelper.toHanyuPinyinStringArray(c, Static.defaultFormat);
|
||||
if (ss != null && ss.length > 0) {
|
||||
sb.append(ss[0]);
|
||||
} else {
|
||||
sb.append(String.valueOf(c));
|
||||
}
|
||||
} catch (BadHanyuPinyinOutputFormatCombination e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
} else {
|
||||
pybf.append(arr[i]);
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
if (isId){
|
||||
return Static.idPatt.matcher(pybf.toString()).replaceAll("").trim();
|
||||
return Static.idPat.matcher(sb.toString()).replaceAll("").trim();
|
||||
}
|
||||
return pybf.toString();
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -143,7 +151,7 @@ public class PinyinUtils {
|
||||
if (input == null){
|
||||
return null;
|
||||
}
|
||||
char c[] = input.toCharArray();
|
||||
char[] c = input.toCharArray();
|
||||
for (int i = 0; i < c.length; i++) {
|
||||
if (c[i] == '\u3000') {
|
||||
c[i] = ' ';
|
||||
|
||||
@@ -27,11 +27,11 @@ public class IdcardUtils {
|
||||
"62", "63", "64", "65", "71", "81", "82", "91" };
|
||||
|
||||
/** 每位加权因子 */
|
||||
public static final int power[] = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9,
|
||||
public static final int[] power = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9,
|
||||
10, 5, 8, 4, 2 };
|
||||
|
||||
/** 第18位校检码 */
|
||||
public static final String verifyCode[] = { "1", "0", "X", "9", "8", "7",
|
||||
public static final String[] verifyCode = { "1", "0", "X", "9", "8", "7",
|
||||
"6", "5", "4", "3", "2" };
|
||||
/** 最低年限 */
|
||||
public static final int MIN = 1930;
|
||||
@@ -116,9 +116,7 @@ public class IdcardUtils {
|
||||
|
||||
/**
|
||||
* 将15位身份证号码转换为18位
|
||||
*
|
||||
* @param idCard
|
||||
* 15位身份编码
|
||||
* @param idCard 15位身份编码
|
||||
* @return 18位身份编码
|
||||
*/
|
||||
public static String conver15CardTo18(String idCard) {
|
||||
|
||||
@@ -22,7 +22,6 @@ public class ThreadUtils {
|
||||
Thread.sleep(millis);
|
||||
} catch (InterruptedException e) {
|
||||
// Ignore.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +33,6 @@ public class ThreadUtils {
|
||||
Thread.sleep(unit.toMillis(duration));
|
||||
} catch (InterruptedException e) {
|
||||
// Ignore.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -509,7 +509,7 @@ public class ExcelExport implements Closeable{
|
||||
cell.setCellStyle(style);
|
||||
// }
|
||||
} catch (Exception ex) {
|
||||
log.info("Set cell value ["+row.getRowNum()+","+column+"] error: " + ex.toString());
|
||||
log.info("Set cell value [{},{}] error: {}", row.getRowNum(), column, ex.toString());
|
||||
cell.setCellValue(ObjectUtils.toString(val));
|
||||
}
|
||||
return cell;
|
||||
@@ -581,7 +581,7 @@ public class ExcelExport implements Closeable{
|
||||
this.addCell(row, colunm++, val, ef.align(), ef.fieldType(), ef.dataFormat());
|
||||
sb.append(val + ", ");
|
||||
}
|
||||
log.debug("Write success: ["+row.getRowNum()+"] "+sb.toString());
|
||||
log.debug("Write success: [{}] {}", row.getRowNum(), sb.toString());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@@ -633,7 +633,7 @@ public class ExcelExport implements Closeable{
|
||||
// try {
|
||||
// this.close();
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// log.error(e.getMessage(), e);
|
||||
// }
|
||||
// return this;
|
||||
// }
|
||||
@@ -647,7 +647,7 @@ public class ExcelExport implements Closeable{
|
||||
try {
|
||||
wb.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -465,7 +465,7 @@ public class ExcelImport implements Closeable {
|
||||
//val = DictUtils.getDictValue(val.toString(), ef.dictType(), "");
|
||||
//log.debug("Dictionary type value: ["+i+","+colunm+"] " + val);
|
||||
} catch (Exception ex) {
|
||||
log.info("Get cell value ["+i+","+column+"] error: " + ex.toString());
|
||||
log.info("Get cell value [{},{}] error: {}", i, column, ex.toString());
|
||||
val = null;
|
||||
}
|
||||
}
|
||||
@@ -557,7 +557,7 @@ public class ExcelImport implements Closeable {
|
||||
sb.append(val+", ");
|
||||
}
|
||||
dataList.add(e);
|
||||
log.debug("Read success: ["+i+"] "+sb.toString());
|
||||
log.debug("Read success: [{}] {}", i, sb.toString());
|
||||
}
|
||||
return dataList;
|
||||
}
|
||||
@@ -577,7 +577,7 @@ public class ExcelImport implements Closeable {
|
||||
try {
|
||||
wb.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* BigDecimal类型转换
|
||||
* @author ThinkGem
|
||||
|
||||
@@ -9,7 +9,6 @@ import java.text.NumberFormat;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
|
||||
/**
|
||||
* 金额类型转换(保留两位)
|
||||
* @author ThinkGem
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
package com.jeesite.common.utils.word;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import com.jeesite.common.io.ResourceUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||
import org.apache.poi.xwpf.usermodel.*;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHeight;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTrPr;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import java.io.*;
|
||||
import java.math.BigInteger;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@@ -12,22 +19,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||
import org.apache.poi.xwpf.usermodel.ParagraphAlignment;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFRun;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFTable;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFTableCell;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHeight;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTrPr;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import com.jeesite.common.io.ResourceUtils;
|
||||
|
||||
/**
|
||||
* 使用POI,进行Word相关的操作
|
||||
* @author xuyu
|
||||
@@ -38,6 +29,8 @@ import com.jeesite.common.io.ResourceUtils;
|
||||
*/
|
||||
public class WordExport {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(WordExport.class);
|
||||
|
||||
/** 内部使用的文档对象 **/
|
||||
private XWPFDocument document;
|
||||
|
||||
@@ -57,7 +50,7 @@ public class WordExport {
|
||||
}
|
||||
bookMarks = new BookMarks(document);
|
||||
} catch (IOException | InvalidFormatException e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,10 +217,8 @@ public class WordExport {
|
||||
try {
|
||||
fos = new FileOutputStream(newFile);
|
||||
this.document.write(fos);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage(), e);
|
||||
} finally {
|
||||
try {
|
||||
if (fos != null){
|
||||
@@ -237,7 +228,7 @@ public class WordExport {
|
||||
fos.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ public class EncodeUtilsTest {
|
||||
xssFilter(i++, "<!--HTML-->你好 ?abc=def&hello=123&world={\"a\":1}我还在。");
|
||||
xssFilter(i++, "<!--HTML-->你好 ?abc=def&hello=123&world={'a':1}我还在。");
|
||||
xssFilter(i++, "<!--HTML-->\"><svg/ONLOAD=confirm(3) />");
|
||||
xssFilter(i++, "<!--HTML-->XSS<embed src=\"data:text/html;base64,PHNjcmlwdD5hbGVydCg5KTwvc2NyaXB0Pgo=\">");
|
||||
sqlFilter(i++, "你好 select * from xxx where abc=def and 1=1我还在。", "common");
|
||||
sqlFilter(i++, "你好 insert into xxx values(1,2,3,4,5)我还在。", "common");
|
||||
sqlFilter(i++, "你好 delete from xxx我还在。", "common");
|
||||
|
||||
@@ -18,7 +18,7 @@ public class ZxingUtilsTest {
|
||||
String baseDir = FileUtils.getProjectPath();
|
||||
|
||||
// 条形码
|
||||
String imgPath = baseDir + "\\target\\zxing_EAN13.png";
|
||||
String imgPath = baseDir + "/target/zxing_EAN13.png";
|
||||
String contents = "6923450657713";
|
||||
int width = 105, height = 50;
|
||||
|
||||
@@ -30,7 +30,7 @@ public class ZxingUtilsTest {
|
||||
System.out.println("finished zxing EAN-13 decode.");
|
||||
|
||||
// 二维码
|
||||
String imgPath2 = baseDir + "\\target\\zxing.png";
|
||||
String imgPath2 = baseDir + "/target/zxing.png";
|
||||
String contents2 = "Hello Gem, welcome to Zxing!\nEMail [ thinkgem@163.com ]";
|
||||
int width2 = 300, height2 = 300;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-parent</artifactId>
|
||||
<version>5.12.1.springboot3-SNAPSHOT</version>
|
||||
<version>5.13.0.springboot3-SNAPSHOT</version>
|
||||
<relativePath>../../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -28,4 +28,5 @@
|
||||
5.11.0
|
||||
5.11.1
|
||||
5.12.0
|
||||
5.12.1
|
||||
5.12.1
|
||||
5.13.0
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-parent</artifactId>
|
||||
<version>5.12.1.springboot3-SNAPSHOT</version>
|
||||
<version>5.13.0.springboot3-SNAPSHOT</version>
|
||||
<relativePath>../../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
<properties>
|
||||
|
||||
<spring-ai.version>1.0.0-RC1</spring-ai.version>
|
||||
<spring-ai.version>1.0.0</spring-ai.version>
|
||||
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ productName: JeeSite Demo
|
||||
companyName: ThinkGem
|
||||
|
||||
# 产品版本、版权年份
|
||||
productVersion: V5.12
|
||||
productVersion: V5.13
|
||||
copyrightYear: 2025
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-parent</artifactId>
|
||||
<version>5.12.1.springboot3-SNAPSHOT</version>
|
||||
<version>5.13.0.springboot3-SNAPSHOT</version>
|
||||
<relativePath>../../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.springframework.core.io.Resource;
|
||||
@@ -22,17 +23,17 @@ import com.jeesite.common.lang.ExceptionUtils;
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2020-7-7
|
||||
*/
|
||||
public class FileTemplete implements Comparable<FileTemplete>, Serializable {
|
||||
public class FileTemplate implements Comparable<FileTemplate>, Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Resource resource;
|
||||
private final Resource resource;
|
||||
private String fileName;
|
||||
private String fileExtension;
|
||||
private String filePath;
|
||||
private boolean isDirectory;
|
||||
|
||||
public FileTemplete(Resource resource, String path) {
|
||||
public FileTemplate(Resource resource, String path) {
|
||||
this.resource = resource;
|
||||
this.fileName = resource.getFilename();
|
||||
this.fileExtension = FileUtils.getFileExtension(this.fileName);
|
||||
@@ -43,22 +44,22 @@ public class FileTemplete implements Comparable<FileTemplete>, Serializable {
|
||||
beginIndex = filePath.indexOf(path);
|
||||
}
|
||||
int endIndex = filePath.length();
|
||||
if (this.fileName.contains(".")){
|
||||
if (this.fileName != null && this.fileName.contains(".")) {
|
||||
endIndex = filePath.lastIndexOf('/');
|
||||
}else if (filePath.endsWith("/")) {
|
||||
endIndex -= 1;
|
||||
}
|
||||
}
|
||||
this.filePath = filePath.substring(beginIndex, endIndex);
|
||||
// System.out.println(this.filePath);
|
||||
} catch (IOException e) {
|
||||
throw ExceptionUtils.unchecked(e);
|
||||
}
|
||||
this.isDirectory = !this.fileName.contains(".");
|
||||
if (this.fileName != null) {
|
||||
this.isDirectory = !this.fileName.contains(".");
|
||||
}
|
||||
// System.out.println(filePath);
|
||||
// System.out.println(fileName);
|
||||
}
|
||||
|
||||
public FileTemplete(FileTemplete source) {
|
||||
public FileTemplate(FileTemplate source) {
|
||||
int index = source.filePath.lastIndexOf('/');
|
||||
this.fileName = source.filePath.substring(index+1);
|
||||
this.filePath = source.filePath.substring(0, index);
|
||||
@@ -111,14 +112,14 @@ public class FileTemplete implements Comparable<FileTemplete>, Serializable {
|
||||
return null;
|
||||
}
|
||||
try(InputStream is = resource.getInputStream()){
|
||||
return IOUtils.toString(is, EncodeUtils.UTF_8);
|
||||
return IOUtils.toString(is, StandardCharsets.UTF_8);
|
||||
}catch (IOException e) {
|
||||
throw ExceptionUtils.unchecked(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(FileTemplete o) {
|
||||
public int compareTo(FileTemplate o) {
|
||||
return this.getFileName().compareTo(o.getFileName());
|
||||
}
|
||||
|
||||
@@ -130,7 +131,7 @@ public class FileTemplete implements Comparable<FileTemplete>, Serializable {
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
FileTemplete e = (FileTemplete) o;
|
||||
FileTemplate e = (FileTemplate) o;
|
||||
return Objects.equals(this.fileName, e.fileName)
|
||||
&& Objects.equals(this.fileExtension, e.fileExtension)
|
||||
&& Objects.equals(this.filePath, e.filePath)
|
||||
@@ -49,7 +49,7 @@ public class Site extends DataEntity<Site> {
|
||||
/**
|
||||
* 模板路径
|
||||
*/
|
||||
public static final String TEMPLETE_BASE_DIRECTION = "views/modules/cmsfront/themes";
|
||||
public static final String TEMPLATE_BASE_DIRECTION = "views/modules/cmsfront/themes";
|
||||
/**
|
||||
* 默认模版
|
||||
*/
|
||||
@@ -192,7 +192,7 @@ public class Site extends DataEntity<Site> {
|
||||
* @return
|
||||
*/
|
||||
public String getSolutionPath() {
|
||||
return TEMPLETE_BASE_DIRECTION + "/" + getTheme();
|
||||
return TEMPLATE_BASE_DIRECTION + "/" + getTheme();
|
||||
}
|
||||
|
||||
public List<String> getCategoryCodes() {
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
*/
|
||||
package com.jeesite.modules.cms.service;
|
||||
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.modules.cms.entity.FileTemplate;
|
||||
import com.jeesite.modules.cms.entity.Site;
|
||||
import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
import com.jeesite.modules.cms.utils.FileTemplateUtils;
|
||||
import com.jeesite.modules.sys.entity.DictData;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 模版文件Service
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2020-7-7
|
||||
*/
|
||||
@Service
|
||||
public class FileTemplateService {
|
||||
|
||||
/**
|
||||
* 获取对应视图模板列表,兼容 Select 字典
|
||||
* @param prefix
|
||||
*/
|
||||
public List<DictData> getTemplateContentDict(String prefix) throws IOException {
|
||||
List<DictData> listSite = ListUtils.newArrayList();
|
||||
String solutionPath = CmsUtils.getSite(Site.getCurrentSiteCode()).getSolutionPath();
|
||||
List<FileTemplate> tplList = FileTemplateUtils.getFileTemplateListByPath(solutionPath);
|
||||
for (FileTemplate tpl : tplList) {
|
||||
if (tpl.getFileName().startsWith(prefix)) {
|
||||
listSite.add(new DictData(tpl.getFileName()
|
||||
.substring(0, tpl.getFileName().indexOf("."))));
|
||||
}
|
||||
}
|
||||
return listSite;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取编辑文件列表
|
||||
* @param path 模板路径
|
||||
*/
|
||||
public List<FileTemplate> getFileTemplateListForEdit(String path) throws IOException {
|
||||
return FileTemplateUtils.getFileTemplateListForEdit(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模版文件内容
|
||||
* @param fileName 模板文件
|
||||
*/
|
||||
public FileTemplate getFileTemplate(String fileName) throws IOException {
|
||||
return FileTemplateUtils.getFileTemplateByResource(fileName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
*/
|
||||
package com.jeesite.modules.cms.service;
|
||||
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.modules.cms.entity.FileTemplete;
|
||||
import com.jeesite.modules.cms.entity.Site;
|
||||
import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
import com.jeesite.modules.cms.utils.FileTempleteUtils;
|
||||
import com.jeesite.modules.sys.entity.DictData;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 模版文件Service
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2020-7-7
|
||||
*/
|
||||
@Service
|
||||
public class FileTempleteService {
|
||||
|
||||
// public List<String> getTempleteContent(String prefix) throws IOException {
|
||||
// List<String> tplList = getFileTempleteNameListByPrefix(CmsUtils.getSite(Site.getCurrentSiteCode()).getSolutionPath());
|
||||
// tplList = FilesTempleteUtils.templeteTrim(tplList, prefix, "");
|
||||
// return tplList;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取对应视图模板列表,兼容 Select 字典
|
||||
* @param prefix
|
||||
*/
|
||||
public List<DictData> getTempleteContentDict(String prefix) throws IOException {
|
||||
List<DictData> listSite = ListUtils.newArrayList();
|
||||
String solutionPath = CmsUtils.getSite(Site.getCurrentSiteCode()).getSolutionPath();
|
||||
List<FileTemplete> tplList = FileTempleteUtils.getFileTempleteListByPath(solutionPath);
|
||||
for (FileTemplete tpl : tplList) {
|
||||
if (tpl.getFileName().startsWith(prefix)) {
|
||||
listSite.add(new DictData(tpl.getFileName()
|
||||
.substring(0, tpl.getFileName().indexOf("."))));
|
||||
}
|
||||
}
|
||||
return listSite;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 通过前缀获取文件名集合
|
||||
// * @param filePath
|
||||
// * @return List<String> 文件名集合
|
||||
// * @author 长春叭哥
|
||||
// * @throws IOException
|
||||
// */
|
||||
// public List<String> getFileTempleteNameListByPrefix(String filePath) throws IOException {
|
||||
// return FilesTempleteUtils.getFileTempleteNameListByPrefix(filePath);
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 获取模版文件列表
|
||||
// * @param path 路径
|
||||
// * @param directory
|
||||
// * @return List<FileTemplete> 模版文件集合
|
||||
// * @author 长春叭哥
|
||||
// * @throws IOException
|
||||
// */
|
||||
// public List<FileTemplete> getFileTempleteListByPath(String path, boolean directory) throws IOException {
|
||||
// return FilesTempleteUtils.getFileTempleteListByPath(path, directory);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取编辑文件列表
|
||||
* @param path 模板路径
|
||||
*/
|
||||
public List<FileTemplete> getFileTempleteListForEdit(String path) throws IOException {
|
||||
return FileTempleteUtils.getFileTempleteListForEdit(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模版文件内容
|
||||
* @param fileName 模板文件
|
||||
*/
|
||||
public FileTemplete getFileTemplete(String fileName) throws IOException {
|
||||
return FileTempleteUtils.getFileTempleteByResource(fileName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.collect.SetUtils;
|
||||
import com.jeesite.common.io.ResourceUtils;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
import com.jeesite.modules.cms.entity.FileTemplete;
|
||||
import com.jeesite.modules.cms.entity.FileTemplate;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -20,30 +20,30 @@ import java.util.Set;
|
||||
* @author 长春叭哥、ThinkGem
|
||||
* @version 2020-7-7
|
||||
*/
|
||||
public class FileTempleteUtils {
|
||||
public class FileTemplateUtils {
|
||||
|
||||
/**
|
||||
* 获取模版文件
|
||||
* @param fileName
|
||||
*/
|
||||
public static FileTemplete getFileTempleteByResource(String fileName) {
|
||||
public static FileTemplate getFileTemplateByResource(String fileName) {
|
||||
if (!StringUtils.startsWith(fileName, "views/modules/cmsfront")) {
|
||||
fileName = "views/modules/cmsfront/themes/default/index.html";
|
||||
}
|
||||
Resource resource = ResourceUtils.getResource(fileName);
|
||||
return new FileTemplete(resource, fileName);
|
||||
return new FileTemplate(resource, fileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模板文件集合
|
||||
* @param path 前缀路径
|
||||
*/
|
||||
public static List<FileTemplete> getFileTempleteListByPath(String path) throws IOException {
|
||||
List<FileTemplete> list = ListUtils.newArrayList();
|
||||
public static List<FileTemplate> getFileTemplateListByPath(String path) throws IOException {
|
||||
List<FileTemplate> list = ListUtils.newArrayList();
|
||||
Resource[] resources = ResourceUtils.getResources("classpath*:" + path + "/**/*.html");
|
||||
for (Resource resource : resources) {
|
||||
if (resource.exists()) {
|
||||
list.add(new FileTemplete(resource, path));
|
||||
list.add(new FileTemplate(resource, path));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
@@ -53,14 +53,14 @@ public class FileTempleteUtils {
|
||||
* 获取模板文件相关属性(含目录)
|
||||
* @param path 前缀路径
|
||||
*/
|
||||
public static List<FileTemplete> getFileTempleteListForEdit(String path) throws IOException {
|
||||
public static List<FileTemplate> getFileTemplateListForEdit(String path) throws IOException {
|
||||
|
||||
List<FileTemplete> list = getFileTempleteListByPath(path);
|
||||
Set<FileTemplete> set = SetUtils.newLinkedHashSet();
|
||||
List<FileTemplate> list = getFileTemplateListByPath(path);
|
||||
Set<FileTemplate> set = SetUtils.newLinkedHashSet();
|
||||
|
||||
// 获取目录
|
||||
list.forEach(e -> {
|
||||
set.add(new FileTemplete(e));
|
||||
set.add(new FileTemplate(e));
|
||||
});
|
||||
set.addAll(list);
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.jeesite.modules.cms.entity.Category;
|
||||
import com.jeesite.modules.cms.entity.Site;
|
||||
import com.jeesite.modules.cms.service.ArticleService;
|
||||
import com.jeesite.modules.cms.service.CategoryService;
|
||||
import com.jeesite.modules.cms.service.FileTempleteService;
|
||||
import com.jeesite.modules.cms.service.FileTemplateService;
|
||||
import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
@@ -46,7 +46,7 @@ public class ArticleController extends BaseController {
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
@Autowired
|
||||
private FileTempleteService fileTempleteService;
|
||||
private FileTemplateService fileTemplateService;
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
@@ -135,7 +135,7 @@ public class ArticleController extends BaseController {
|
||||
if (StringUtils.isBlank(article.getId())) {
|
||||
article.setStatus(Article.STATUS_DRAFT);
|
||||
}
|
||||
model.addAttribute("contentViewList", fileTempleteService.getTempleteContentDict(Article.DEFAULT_TEMPLATE));
|
||||
model.addAttribute("contentViewList", fileTemplateService.getTemplateContentDict(Article.DEFAULT_TEMPLATE));
|
||||
model.addAttribute("article_DEFAULT_TEMPLATE", Article.DEFAULT_TEMPLATE);
|
||||
model.addAttribute("article", article);
|
||||
CmsUtils.addViewConfigAttribute(model, article.getCategory());
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.jeesite.modules.cms.entity.Article;
|
||||
import com.jeesite.modules.cms.entity.Category;
|
||||
import com.jeesite.modules.cms.entity.Site;
|
||||
import com.jeesite.modules.cms.service.CategoryService;
|
||||
import com.jeesite.modules.cms.service.FileTempleteService;
|
||||
import com.jeesite.modules.cms.service.FileTemplateService;
|
||||
import com.jeesite.modules.cms.utils.CmsUtils;
|
||||
import com.jeesite.modules.sys.utils.DictUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
@@ -46,7 +46,7 @@ public class CategoryController extends BaseController {
|
||||
private CategoryService categoryService;
|
||||
|
||||
@Autowired
|
||||
private FileTempleteService fileTempleteService;
|
||||
private FileTemplateService fileTemplateService;
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
@@ -157,9 +157,9 @@ public class CategoryController extends BaseController {
|
||||
if (category.getIsNeedAudit() == null) {
|
||||
category.setIsNeedAudit(Global.NO);
|
||||
}
|
||||
model.addAttribute("listViewList", fileTempleteService.getTempleteContentDict(Category.DEFAULT_TEMPLATE));
|
||||
model.addAttribute("listViewList", fileTemplateService.getTemplateContentDict(Category.DEFAULT_TEMPLATE));
|
||||
model.addAttribute("category_DEFAULT_TEMPLATE", Category.DEFAULT_TEMPLATE);
|
||||
model.addAttribute("contentViewList", fileTempleteService.getTempleteContentDict(Article.DEFAULT_TEMPLATE));
|
||||
model.addAttribute("contentViewList", fileTemplateService.getTemplateContentDict(Article.DEFAULT_TEMPLATE));
|
||||
model.addAttribute("article_DEFAULT_TEMPLATE", Article.DEFAULT_TEMPLATE);
|
||||
model.addAttribute("category", category);
|
||||
return "modules/cms/categoryForm";
|
||||
|
||||
@@ -4,20 +4,12 @@
|
||||
*/
|
||||
package com.jeesite.modules.cms.web;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.jeesite.common.codec.EncodeUtils;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.io.FileUtils;
|
||||
import com.jeesite.common.io.ResourceUtils;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
import com.jeesite.modules.gen.entity.GenTable;
|
||||
import com.jeesite.modules.gen.utils.GenTableUtils;
|
||||
import com.jeesite.modules.gen.utils.GenUtils;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.collect.MapUtils;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.cms.entity.FileTemplate;
|
||||
import com.jeesite.modules.cms.entity.Site;
|
||||
import com.jeesite.modules.cms.service.FileTemplateService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@@ -25,12 +17,9 @@ import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.collect.MapUtils;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.cms.entity.FileTemplete;
|
||||
import com.jeesite.modules.cms.entity.Site;
|
||||
import com.jeesite.modules.cms.service.FileTempleteService;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 模板管理
|
||||
@@ -42,7 +31,7 @@ import com.jeesite.modules.cms.service.FileTempleteService;
|
||||
public class FileTemplateController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private FileTempleteService fileTempleteService;
|
||||
private FileTemplateService fileTemplateService;
|
||||
|
||||
@RequiresPermissions("cms:template:edit")
|
||||
@RequestMapping(value = { "list", "" })
|
||||
@@ -50,19 +39,10 @@ public class FileTemplateController extends BaseController {
|
||||
return "modules/cms/tplIndex";
|
||||
}
|
||||
|
||||
// @RequiresPermissions("cms:template:edit")
|
||||
// @RequestMapping(value = "tree")
|
||||
// public String tree(Model model) throws IOException {
|
||||
// //根据系统默认的主题获取模板地址
|
||||
// model.addAttribute("templateList", fileTempleteService
|
||||
// .getFileTempleteListForEdit(Site.TEMPLETE_BASE_DIRECTION + "/" + "default"));
|
||||
// return "modules/cms/tplTree";
|
||||
// }
|
||||
|
||||
@RequiresPermissions("cms:template:edit")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(String name, Model model) throws IOException {
|
||||
model.addAttribute("template", fileTempleteService.getFileTemplete(name));
|
||||
model.addAttribute("template", fileTemplateService.getFileTemplate(name));
|
||||
return "modules/cms/tplForm";
|
||||
}
|
||||
|
||||
@@ -70,7 +50,7 @@ public class FileTemplateController extends BaseController {
|
||||
@RequestMapping(value = "saveFileTemplate")
|
||||
@ResponseBody
|
||||
public String saveFileTemplate(String fileName, String fileContent) throws IOException {
|
||||
FileTemplete template = fileTempleteService.getFileTemplete(fileName);
|
||||
FileTemplate template = fileTemplateService.getFileTemplate(fileName);
|
||||
String newFileName = FileUtils.path(FileUtils.getWebappPath() + "/WEB-INF/classes/" + fileName);
|
||||
File templateFile = template.resource().getFile();
|
||||
if (templateFile.getAbsoluteFile().exists()) {
|
||||
@@ -86,7 +66,7 @@ public class FileTemplateController extends BaseController {
|
||||
@RequestMapping(value = "deleteFileTemplate")
|
||||
@ResponseBody
|
||||
public String deleteFileTemplate(String fileName) throws IOException {
|
||||
FileTemplete template = fileTempleteService.getFileTemplete(fileName);
|
||||
FileTemplate template = fileTemplateService.getFileTemplate(fileName);
|
||||
File templateFile = template.resource().getFile();
|
||||
if (templateFile.getAbsoluteFile().exists()) {
|
||||
FileUtils.deleteFile(templateFile.getAbsolutePath());
|
||||
@@ -109,9 +89,9 @@ public class FileTemplateController extends BaseController {
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> treeData() throws IOException {
|
||||
List<Map<String, Object>> mapList = ListUtils.newArrayList();
|
||||
List<FileTemplete> listFileTemplete = fileTempleteService.getFileTempleteListForEdit(Site.TEMPLETE_BASE_DIRECTION);
|
||||
for (int i = 0; i < listFileTemplete.size(); i++) {
|
||||
FileTemplete e = listFileTemplete.get(i);
|
||||
List<FileTemplate> listFileTemplate = fileTemplateService.getFileTemplateListForEdit(Site.TEMPLATE_BASE_DIRECTION);
|
||||
for (int i = 0; i < listFileTemplate.size(); i++) {
|
||||
FileTemplate e = listFileTemplate.get(i);
|
||||
Map<String, Object> map = MapUtils.newHashMap();
|
||||
map.put("id", e.getFilePath() + "/" + e.getFileName());
|
||||
map.put("isDirectory", e.isDirectory());
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.cms.entity.Site;
|
||||
import com.jeesite.modules.cms.service.FileTempleteService;
|
||||
import com.jeesite.modules.cms.service.FileTemplateService;
|
||||
import com.jeesite.modules.cms.service.SiteService;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
@@ -39,7 +39,7 @@ public class SiteController extends BaseController {
|
||||
private SiteService siteService;
|
||||
|
||||
@Autowired
|
||||
private FileTempleteService fileTempleteService;
|
||||
private FileTemplateService fileTemplateService;
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
@@ -79,7 +79,7 @@ public class SiteController extends BaseController {
|
||||
@RequiresPermissions("cms:site:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(Site site, Model model) throws IOException {
|
||||
model.addAttribute("indexViewList", fileTempleteService.getTempleteContentDict(Site.DEFAULT_TEMPLATE));
|
||||
model.addAttribute("indexViewList", fileTemplateService.getTemplateContentDict(Site.DEFAULT_TEMPLATE));
|
||||
model.addAttribute("site_DEFAULT_TEMPLATE", Site.DEFAULT_TEMPLATE);
|
||||
model.addAttribute("site", site);
|
||||
model.addAttribute("demos", site);
|
||||
|
||||
@@ -36,4 +36,5 @@
|
||||
5.11.0
|
||||
5.11.1
|
||||
5.12.0
|
||||
5.12.1
|
||||
5.12.1
|
||||
5.13.0
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-parent</artifactId>
|
||||
<version>5.12.1.springboot3-SNAPSHOT</version>
|
||||
<version>5.13.0.springboot3-SNAPSHOT</version>
|
||||
<relativePath>../../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
<dependency>
|
||||
<groupId>com.dameng</groupId>
|
||||
<artifactId>DmJdbcDriver18</artifactId>
|
||||
<version>8.1.3.62</version>
|
||||
<version>${dameng.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
<dependency>
|
||||
<groupId>cn.com.kingbase</groupId>
|
||||
<artifactId>kingbase8</artifactId>
|
||||
<version>8.6.1</version>
|
||||
<version>${kingbase.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -129,13 +129,6 @@
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JTA 事务(当 spring.jta.enabled 为 true 的时候开启,不使用 jta 的时候不要引入该依赖)
|
||||
<dependency>
|
||||
<groupId>com.atomikos</groupId>
|
||||
<artifactId>transactions-spring-boot3-starter</artifactId>
|
||||
<version>${atomikos.version}</version>
|
||||
</dependency> -->
|
||||
|
||||
<!-- ELK 日志收集 -->
|
||||
<dependency>
|
||||
<groupId>net.logstash.logback</groupId>
|
||||
|
||||
@@ -41,7 +41,7 @@ public class PostListType implements FieldType {
|
||||
}
|
||||
}
|
||||
}
|
||||
return list.size() > 0 ? list.toArray(new String[list.size()]) : null;
|
||||
return !list.isEmpty() ? list.toArray(new String[0]) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,7 +41,7 @@ public class RoleListType implements FieldType {
|
||||
}
|
||||
}
|
||||
}
|
||||
return list.size() > 0 ? list.toArray(new String[list.size()]) : null;
|
||||
return !list.isEmpty() ? list.toArray(new String[0]) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.idgen.IdGen;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryDataScope;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.common.service.ServiceException;
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
@@ -72,16 +73,17 @@ public class EmpUserServiceSupport extends CrudService<EmpUserDao, EmpUser>
|
||||
*/
|
||||
@Override
|
||||
public void addDataScopeFilter(EmpUser empUser, String ctrlPermi) {
|
||||
empUser.sqlMap().getDataScope().addFilter("dsfOffice",
|
||||
"Office", "e.office_code", "a.create_by", ctrlPermi, "office_user");
|
||||
QueryDataScope dataScope = empUser.sqlMap().getDataScope();
|
||||
dataScope.addFilter("dsfOffice", "Office",
|
||||
"e.office_code", "a.create_by", ctrlPermi, "office_user");
|
||||
if (StringUtils.isNotBlank(EmpUtils.getCompany().getCompanyCode())){
|
||||
empUser.sqlMap().getDataScope().addFilter("dsfCompany",
|
||||
"Company", "e.company_code", "a.create_by", ctrlPermi, "office_user");
|
||||
dataScope.addFilter("dsfCompany", "Company",
|
||||
"e.company_code", "a.create_by", ctrlPermi, "office_user");
|
||||
}
|
||||
// empUser.sqlMap().getDataScope().addFilterByPermission("dsfOffice", "sys:empUser:view",
|
||||
// "Office", "e.office_code", "a.create_by", ctrlPermi);
|
||||
// empUser.sqlMap().getDataScope().addFilterByPermission("dsfOffice", "sys:empUser:view",
|
||||
// "User", "a.user_code", ctrlPermi);
|
||||
// dataScope.addFilterByPermission("dsfOffice", "sys:empUser:view", "Office",
|
||||
// "e.office_code", "a.create_by", ctrlPermi);
|
||||
// dataScope.addFilterByPermission("dsfOffice", "sys:empUser:view", "User",
|
||||
// "a.user_code", ctrlPermi);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -263,7 +263,7 @@ public class EmpUtils {
|
||||
}
|
||||
}
|
||||
});
|
||||
return list.toArray(new String[list.size()]);
|
||||
return list.toArray(new String[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,10 +27,10 @@ import com.jeesite.modules.sys.utils.UserUtils;
|
||||
public class CacheController extends BaseController {
|
||||
|
||||
/**
|
||||
* 清理全部缓存,可清理属性文件里的缓存(stste 单词写错了,将错就错)
|
||||
* 清理全部缓存,可清理属性文件里的缓存
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions(value={"sys:config:edit", "sys:stste:cache"}, logical=Logical.OR)
|
||||
@RequiresPermissions(value={"sys:config:edit", "sys:state:cache"}, logical=Logical.OR)
|
||||
@RequestMapping(value = "clearAll")
|
||||
@ResponseBody
|
||||
public String clearAll() {
|
||||
|
||||
@@ -283,7 +283,7 @@ public class LoginController extends BaseController{
|
||||
try {
|
||||
request.getRequestDispatcher(passwordModifyUrl).forward(request, response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ spring:
|
||||
# maxPoolSize: 20
|
||||
# keepAliveSeconds: 60
|
||||
|
||||
# JTA XA 事务(spring boot 3) 请在 jeesite-module-core/pom.xml 中打开 atomikos 依赖
|
||||
# JTA XA 事务(spring boot 3)
|
||||
jta:
|
||||
enabled: false
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
<template>vue/vueImport.xml</template>
|
||||
<childTable>
|
||||
<template>category-ref:dao</template>
|
||||
<template>vue/vueApiChild.xml</template>
|
||||
<template>vue/vueFormChildList.xml</template>
|
||||
</childTable>
|
||||
</category>
|
||||
@@ -33,12 +34,14 @@
|
||||
<template>vue/vueIndex.xml</template>
|
||||
<template>vue/vueImport.xml</template>
|
||||
<childTable>
|
||||
<template>vue/vueApiChild.xml</template>
|
||||
<template>vue/vueFormChildList.xml</template>
|
||||
</childTable>
|
||||
</category>
|
||||
<category value="crud_only_vue_modal" label="单表/主子表 (增删改查,弹窗表单) 仅vue ">
|
||||
<template>category-ref:crud_only_vue</template>
|
||||
<childTable>
|
||||
<template>vue/vueApiChild.xml</template>
|
||||
<template>vue/vueFormChildList.xml</template>
|
||||
</childTable>
|
||||
</category>
|
||||
@@ -49,6 +52,7 @@
|
||||
<template>vue/vueIndex.xml</template>
|
||||
<template>vue/vueImport.xml</template>
|
||||
<childTable>
|
||||
<template>vue/vueApiChild.xml</template>
|
||||
<template>vue/vueFormChildList.xml</template>
|
||||
</childTable>
|
||||
</category>
|
||||
@@ -64,6 +68,7 @@
|
||||
<template>vue/vueSelect.xml</template>
|
||||
<childTable>
|
||||
<template>category-ref:dao</template>
|
||||
<template>vue/vueApiChild.xml</template>
|
||||
<template>vue/vueFormChildList.xml</template>
|
||||
</childTable>
|
||||
</category>
|
||||
@@ -93,6 +98,7 @@
|
||||
<template>vue/vueImport.xml</template>
|
||||
<childTable>
|
||||
<template>category-ref:dao_cloud</template>
|
||||
<template>vue/vueApiChild.xml</template>
|
||||
<template>vue/vueFormChildList.xml</template>
|
||||
</childTable>
|
||||
</category>
|
||||
@@ -108,6 +114,7 @@
|
||||
<template>vue/vueSelect.xml</template>
|
||||
<childTable>
|
||||
<template>category-ref:dao_cloud</template>
|
||||
<template>vue/vueApiChild.xml</template>
|
||||
<template>vue/vueFormChildList.xml</template>
|
||||
</childTable>
|
||||
</category>
|
||||
@@ -260,6 +267,7 @@
|
||||
<template>module/src/main/resources/config/jeesite.xml</template>
|
||||
<template>module/src/main/resources/db/versions.xml</template>
|
||||
<template>module/src/main/resources/static/static.xml</template>
|
||||
<template>module/src/main/resources/application-assistant.xml</template>
|
||||
<template>module/pom.xml</template>
|
||||
</category>
|
||||
<category value="module_cloud" label="生成微服务模块代码(Cloud)">
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
No deletion without permission, or be held responsible to law. -->
|
||||
<template>
|
||||
<name>jeesite</name>
|
||||
<filePath>${baseDir}/${modulePath}/src/main/resources</filePath>
|
||||
<fileName>application-assistant.yml</fileName>
|
||||
<content><![CDATA[
|
||||
<% print('\n'); %>
|
||||
## 重要提示(Tip):
|
||||
|
||||
## 请勿在该配置文件中添加其它任何配置(添加也不会生效)。
|
||||
## 该文件,仅仅是为了让 jeesite-${moduleCode}.yml 文件,
|
||||
## 在 IDEA 中有一个自动完成及帮助提示,并无其它用意。
|
||||
## 参数配置请在 jeesite-bpm.yml 文件中添加。
|
||||
|
||||
spring:
|
||||
config:
|
||||
import:
|
||||
- classpath:config/jeesite-${moduleCode}.yml
|
||||
|
||||
]]>
|
||||
</content>
|
||||
</template>
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
<properties>
|
||||
|
||||
<finalName>web</finalName><!-- war包的名称 -->
|
||||
<finalName>web</finalName><!-- war 或 jar 包的名称 -->
|
||||
<start-class>com.jeesite.modules.${@StringUtils.capCamelCase(moduleCode)}Application</start-class>
|
||||
|
||||
<!-- docker setting -->
|
||||
|
||||
@@ -20,6 +20,10 @@ import { BasicModel, Page, TreeDataModel } from '@jeesite/core/api/model/baseMod
|
||||
<% }else{ %>
|
||||
import { BasicModel, Page } from '@jeesite/core/api/model/baseModel';
|
||||
<% } %>
|
||||
<% // 生成子表列表字段
|
||||
for(child in table.childList){ %>
|
||||
import { ${child.className} } from '@jeesite/${moduleMinus}/api${modulePath}${subModulePath}/${@StringUtils.uncap(child.classNameSimple)}';
|
||||
<% } %>
|
||||
<% if(toBoolean(table.optionMap['isImportExport'])){ %>
|
||||
import { UploadApiResult } from '@jeesite/core/api/sys/upload';
|
||||
import { UploadFileParams } from '@jeesite/types/axios';
|
||||
@@ -59,12 +63,12 @@ for(c in table.columnList){
|
||||
// 父类对象
|
||||
if(table.parentExists && table.parentTableFkName == c.columnName){
|
||||
%>
|
||||
${c.simpleAttrName}?: ${attrType};<% if (isNotBlank(c.comments)){ %> // ${c.comments} 父类<% } %>
|
||||
${c.simpleAttrName}${c.isRequired == '1' ? '' : '?'}: ${ParentClassName};<% if (isNotBlank(c.comments)){ %> // ${c.comments} 父类<% } %>
|
||||
<%
|
||||
// 其它字段
|
||||
}else{
|
||||
%>
|
||||
${c.simpleAttrName}?: ${attrType};<%if(isNotBlank(c.comments)){%> // ${c.comments}<%}%>
|
||||
${c.simpleAttrName}${c.isRequired == '1' ? '' : '?'}: ${attrType};<%if(isNotBlank(c.comments)){%> // ${c.comments}<%}%>
|
||||
<%
|
||||
}
|
||||
}
|
||||
@@ -73,7 +77,7 @@ for(c in table.columnList){
|
||||
%>
|
||||
<% // 生成子表列表字段
|
||||
for(child in table.childList){ %>
|
||||
${@StringUtils.uncap(child.classNameSimple)}List?: any[]; // 子表列表
|
||||
${@StringUtils.uncap(child.classNameSimple)}List?: ${child.className}[]; // 子表列表
|
||||
<% } %>
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
No deletion without permission, or be held responsible to law. -->
|
||||
<template>
|
||||
<name>vueApi</name>
|
||||
<filePath>${frontDir}/packages${modulePath}/api${modulePath}${subModulePath}</filePath>
|
||||
<fileName>${@StringUtils.uncap(table.classNameSimple)}.ts</fileName>
|
||||
<content><![CDATA[
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author ${functionAuthor}
|
||||
*/
|
||||
<% if(table.isTreeEntity){ %>
|
||||
import { TreeModel } from '@jeesite/core/api/model/baseModel';
|
||||
<% }else{ %>
|
||||
import { BasicModel } from '@jeesite/core/api/model/baseModel';
|
||||
<% } %>
|
||||
import { ${ParentClassName} } from '@jeesite/${moduleMinus}/api${modulePath}${subModulePath}/${funName}';
|
||||
|
||||
export interface ${ClassName} extends ${table.isTreeEntity?'Tree':'Basic'}Model<${ClassName}> {
|
||||
<%
|
||||
isExtend = false;
|
||||
// 生成字段属性
|
||||
for(c in table.columnList){
|
||||
var attrType = c.simpleAttrType;
|
||||
if (attrType == 'String') attrType = 'string';
|
||||
else if (attrType == 'Long') attrType = 'number';
|
||||
else if (attrType == 'Integer') attrType = 'number';
|
||||
else if (attrType == 'Double') attrType = 'number';
|
||||
else if (attrType == 'BigDecimal') attrType = 'number';
|
||||
else if (attrType == 'Date') attrType = 'string';
|
||||
else attrType = 'any';
|
||||
if(!@StringUtils.equalsIgnoreCase(c.columnName, 'id') && !c.isSuperColumn){
|
||||
// 如果是Extend类属性
|
||||
if(table.isExtendEntity && c.isExtendColumn){
|
||||
if(!isExtend){
|
||||
isExtend = true;
|
||||
%>
|
||||
extend?: any; // 扩展字段
|
||||
<%
|
||||
}
|
||||
}
|
||||
// 如果不是基类属性
|
||||
else if(!@StringUtils.equalsIgnoreCase(c.columnName, 'id') && !c.isSuperColumn){
|
||||
// 父类对象
|
||||
if(table.parentExists && table.parentTableFkName == c.columnName){
|
||||
%>
|
||||
${c.simpleAttrName}${c.isRequired == '1' ? '' : '?'}: ${ParentClassName};<% if (isNotBlank(c.comments)){ %> // ${c.comments} 父类<% } %>
|
||||
<%
|
||||
// 其它字段
|
||||
}else{
|
||||
%>
|
||||
${c.simpleAttrName}${c.isRequired == '1' ? '' : '?'}: ${attrType};<%if(isNotBlank(c.comments)){%> // ${c.comments}<%}%>
|
||||
<%
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
}
|
||||
<% %>
|
||||
]]>
|
||||
</content>
|
||||
</template>
|
||||
@@ -117,7 +117,7 @@
|
||||
value: record.value.isNewRecord ? t('新增${functionNameSimple}') : t('编辑${functionNameSimple}'),
|
||||
}));
|
||||
|
||||
const inputFormSchemas: FormSchema[] = [
|
||||
const inputFormSchemas: FormSchema<${ClassName}>[] = [
|
||||
<% if(table.isTreeEntity){ %>
|
||||
{
|
||||
label: t('上级${functionNameSimple}'),
|
||||
@@ -428,7 +428,7 @@ for (c in table.columnList){
|
||||
}
|
||||
}
|
||||
%>
|
||||
const [registerForm, { resetFields, setFieldsValue<% if(updateSchemas.~size > 0){ %>, updateSchema<% } %>, validate }] = useForm({
|
||||
const [registerForm, { resetFields, setFieldsValue<% if(updateSchemas.~size > 0){ %>, updateSchema<% } %>, validate }] = useForm<${ClassName}>({
|
||||
labelWidth: 120,
|
||||
schemas: inputFormSchemas,
|
||||
<% var formColNum = table.optionMap['formColNum']; %>
|
||||
@@ -447,7 +447,7 @@ for (c in table.columnList){
|
||||
record.value.parentName = data.parentName;
|
||||
}
|
||||
<% } %>
|
||||
setFieldsValue(record.value);
|
||||
await setFieldsValue(record.value);
|
||||
<% for (child in table.childList){ %>
|
||||
form${@StringUtils.cap(child.classNameSimple)}ListRef.value?.setTableData(record.value);
|
||||
<% } %>
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicTable, BasicColumn, useTable } from '@jeesite/core/components/Table';
|
||||
import { ${ParentClassName} } from '@jeesite/${moduleMinus}/api${modulePath}${subModulePath}/${parentClassName}';
|
||||
import { ${ClassName} } from '@jeesite/${moduleMinus}/api${modulePath}${subModulePath}/${className}';
|
||||
<%
|
||||
var userselectExists = false;
|
||||
var officeselectExists = false;
|
||||
@@ -59,7 +60,7 @@
|
||||
const { t } = useI18n('${moduleName}${subModuleNameDot}.${funName}');
|
||||
const record = ref<${ParentClassName}>({} as ${ParentClassName});
|
||||
|
||||
const tableColumns: BasicColumn[] = [
|
||||
const tableColumns: BasicColumn<${ClassName}>[] = [
|
||||
<%
|
||||
for (c in table.columnList){
|
||||
if (c.isEdit != '1' || c.isPk == '1'){
|
||||
@@ -166,11 +167,11 @@ for (c in table.columnList){
|
||||
<% } %>
|
||||
];
|
||||
|
||||
const [registerTable, tableAction] = useTable({
|
||||
const [registerTable, tableAction] = useTable<${ClassName}>({
|
||||
columns: tableColumns,
|
||||
actionColumn: {
|
||||
width: 60,
|
||||
actions: (record: Recordable) => [
|
||||
actions: (record: ${ClassName}) => [
|
||||
{
|
||||
icon: 'i-ant-design:delete-outlined',
|
||||
color: 'error',
|
||||
|
||||
@@ -136,7 +136,7 @@ for(c in table.columnList){
|
||||
setTitle(record.value.isNewRecord ? t('新增${functionNameSimple}') : t('编辑${functionNameSimple}'));
|
||||
};
|
||||
|
||||
const inputFormSchemas: FormSchema[] = [
|
||||
const inputFormSchemas: FormSchema<${ClassName}>[] = [
|
||||
<% if(table.isTreeEntity){ %>
|
||||
{
|
||||
label: t('上级${functionNameSimple}'),
|
||||
@@ -368,7 +368,7 @@ for (c in table.columnList){
|
||||
<%
|
||||
for (child in table.childList){ %>
|
||||
|
||||
const input${child.className}FormSchemas: FormSchema[] = [
|
||||
const input${child.className}FormSchemas: FormSchema<${ClassName}>[] = [
|
||||
{
|
||||
field: '${@StringUtils.uncap(child.classNameSimple)}List',
|
||||
component: 'Input',
|
||||
@@ -381,7 +381,7 @@ for (c in table.columnList){
|
||||
if(false && toBoolean(table.optionMap['isBpmForm'])){
|
||||
%>
|
||||
|
||||
const inputBpmFormSchemas: FormSchema[] = [
|
||||
const inputBpmFormSchemas: FormSchema<${ClassName}>[] = [
|
||||
{
|
||||
label: t('审批意见'),
|
||||
field: 'bpm.comment',
|
||||
@@ -459,7 +459,7 @@ for (c in table.columnList){
|
||||
}
|
||||
}
|
||||
%>
|
||||
const [registerForm, formAction] = useForm({
|
||||
const [registerForm, formAction] = useForm<${ClassName}>({
|
||||
labelWidth: 120,
|
||||
schemas: inputFormSchemas,
|
||||
<% var formColNum = table.optionMap['formColNum']; %>
|
||||
@@ -467,16 +467,16 @@ for (c in table.columnList){
|
||||
});
|
||||
<% for (child in table.childList){ %>
|
||||
|
||||
const [register${child.className}Form, ${@StringUtils.uncap(child.className)}Form] = useForm({
|
||||
const [register${child.className}Form, ${@StringUtils.uncap(child.className)}Form] = useForm<${ClassName}>({
|
||||
labelWidth: 120,
|
||||
schemas: input${child.className}FormSchemas,
|
||||
baseColProps: { md: 24, lg: 24 },
|
||||
});
|
||||
|
||||
const [register${child.className}Table, ${@StringUtils.uncap(child.classNameSimple)}Table] = useTable({
|
||||
const [register${child.className}Table, ${@StringUtils.uncap(child.classNameSimple)}Table] = useTable<${ClassName}>({
|
||||
actionColumn: {
|
||||
width: 60,
|
||||
actions: (record: Recordable) => [
|
||||
actions: (record: ${ClassName}) => [
|
||||
{
|
||||
icon: 'i-ant-design:delete-outlined',
|
||||
color: 'error',
|
||||
@@ -687,7 +687,7 @@ for (c in table.columnList){
|
||||
record.value.parentName = data.parentName;
|
||||
}
|
||||
<% } %>
|
||||
setFieldsValue(record.value);
|
||||
await setFieldsValue(record.value);
|
||||
<% for (child in table.childList){ %>
|
||||
set${child.className}TableData(res);
|
||||
<% } %>
|
||||
|
||||
@@ -22,12 +22,7 @@
|
||||
:minHeight="120"
|
||||
:width="400"
|
||||
>
|
||||
<Upload
|
||||
accept=".xls,.xlsx"
|
||||
:file-list="fileList"
|
||||
:before-upload="beforeUpload"
|
||||
@remove="handleRemove"
|
||||
>
|
||||
<Upload accept=".xls,.xlsx" :file-list="fileList" :before-upload="beforeUpload" @remove="handleRemove">
|
||||
<a-button> <Icon icon="ant-design:upload-outlined" /> {{ t('选择文件') }} </a-button>
|
||||
<span class="ml-4">{{ uploadInfo }}</span>
|
||||
</Upload>
|
||||
|
||||
@@ -94,7 +94,7 @@ if(table.isTreeEntity){
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup name="${compNamePrefix}List">
|
||||
import { unref<% if(toBoolean(table.optionMap['isImportExport'])){ %>, ref<% } %><% if(table.isTreeEntity || isNotBlank(table.optionMap['leftTreeRightTableFk'])){ %>, watch<% }
|
||||
import { onMounted<% if(toBoolean(table.optionMap['isImportExport'])){ %>, ref<% } %>, unref<% if(table.isTreeEntity || isNotBlank(table.optionMap['leftTreeRightTableFk'])){ %>, watch<% }
|
||||
%><% if(table.isTreeEntity){ %>, nextTick<% } %> } from 'vue';
|
||||
<% if(@StringUtils.contains(table.tplCategory, '_route')) { %>
|
||||
import { useEmitter } from '@jeesite/core/store/modules/user';
|
||||
@@ -111,6 +111,7 @@ if(table.isTreeEntity){
|
||||
import { router } from '@jeesite/core/router';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicTable, BasicColumn, useTable } from '@jeesite/core/components/Table';
|
||||
import { ${ClassName}, ${className}List } from '@jeesite/${moduleMinus}/api${modulePath}${subModulePath}/${funName}';
|
||||
import { ${className}Delete, ${className}ListData } from '@jeesite/${moduleMinus}/api${modulePath}${subModulePath}/${funName}';
|
||||
<% if(toBoolean(table.optionMap['isHaveDisableEnable'])){ %>
|
||||
import { ${className}Disable, ${className}Enable } from '@jeesite/${moduleMinus}/api${modulePath}${subModulePath}/${funName}';
|
||||
@@ -179,6 +180,7 @@ if(table.isTreeEntity){
|
||||
const { t } = useI18n('${moduleName}${subModuleNameDot}.${funName}');
|
||||
const { showMessage } = useMessage();
|
||||
const { meta } = unref(router.currentRoute);
|
||||
const record = ref<${ClassName}>({} as ${ClassName});
|
||||
|
||||
const getTitle = {
|
||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||
@@ -191,7 +193,7 @@ if(table.isTreeEntity){
|
||||
const loading = ref(false);
|
||||
<% } %>
|
||||
|
||||
const searchForm: FormProps = {
|
||||
const searchForm: FormProps<${ClassName}> = {
|
||||
baseColProps: { md: 8, lg: 6 },
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
@@ -285,7 +287,7 @@ if(table.isTreeEntity){
|
||||
<% } %>
|
||||
};
|
||||
|
||||
const tableColumns: BasicColumn[] = [
|
||||
const tableColumns: BasicColumn<${ClassName}>[] = [
|
||||
<%
|
||||
var firstColumn = true;
|
||||
// 生成树表的节点列
|
||||
@@ -355,9 +357,9 @@ for(c in table.columnList){
|
||||
%>
|
||||
];
|
||||
|
||||
const actionColumn: BasicColumn = {
|
||||
const actionColumn: BasicColumn<${ClassName}> = {
|
||||
width: 160,
|
||||
actions: (record: Recordable) => [
|
||||
actions: (record: ${ClassName}) => [
|
||||
{
|
||||
icon: 'i-clarity:note-edit-line',
|
||||
title: t('编辑${functionNameSimple}'),
|
||||
@@ -425,9 +427,7 @@ for(c in table.columnList){
|
||||
],
|
||||
};
|
||||
|
||||
const [registerTable, { reload<% if(table.isTreeEntity){ %>, expandAll, collapseAll, expandCollapse<% } %><%
|
||||
if (table.isTreeEntity || isNotBlank(table.optionMap['leftTreeRightTableFk'])
|
||||
|| toBoolean(table.optionMap['isImportExport'])){ %>, getForm<% } %> }] = useTable({
|
||||
const [registerTable, { reload<% if(table.isTreeEntity){ %>, expandAll, collapseAll, expandCollapse<% } %>, getForm }] = useTable<${ClassName}>({
|
||||
api: ${className}ListData,
|
||||
beforeFetch: (params) => {
|
||||
<% if(table.isTreeEntity){ %>
|
||||
@@ -449,6 +449,12 @@ for(c in table.columnList){
|
||||
canResize: true,
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
const res = await ${className}List();
|
||||
record.value = (res.${className} || {}) as ${ClassName};
|
||||
await getForm().setFieldsValue(record.value);
|
||||
});
|
||||
|
||||
<% if(!@StringUtils.contains(table.tplCategory, '_route')) { %>
|
||||
const [register${modalOrDrawer}, { open${modalOrDrawer} }] = use${modalOrDrawer}();
|
||||
<% } %>
|
||||
@@ -460,10 +466,14 @@ for(c in table.columnList){
|
||||
if (!isEmpty(props.treeCodes)) {
|
||||
<% if (isNotBlank(table.optionMap['leftTreeRightTableFk'])) { %>
|
||||
await getForm().setFieldsValue({
|
||||
<% if (@StringUtils.contains(table.optionMap['leftTreeRightTableFk'], '.')) { %>
|
||||
'${table.optionMap['leftTreeRightTableFk']}': props.treeCodes[0],
|
||||
<% } else { %>
|
||||
${table.optionMap['leftTreeRightTableFk']}: props.treeCodes[0],
|
||||
<% } %>
|
||||
});
|
||||
<% } %>
|
||||
reload();
|
||||
await reload();
|
||||
}
|
||||
},
|
||||
);
|
||||
@@ -511,14 +521,14 @@ for(c in table.columnList){
|
||||
const params = { ${idParam} };
|
||||
const res = await ${className}Disable(params);
|
||||
showMessage(res.message);
|
||||
handleSuccess(record);
|
||||
await handleSuccess(record);
|
||||
}
|
||||
|
||||
async function handleEnable(record: Recordable) {
|
||||
const params = { ${idParam} };
|
||||
const res = await ${className}Enable(params);
|
||||
showMessage(res.message);
|
||||
handleSuccess(record);
|
||||
await handleSuccess(record);
|
||||
}
|
||||
<% } %>
|
||||
|
||||
@@ -526,11 +536,11 @@ for(c in table.columnList){
|
||||
const params = { ${idParam} };
|
||||
const res = await ${className}Delete(params);
|
||||
showMessage(res.message);
|
||||
handleSuccess(record);
|
||||
await handleSuccess(record);
|
||||
}
|
||||
|
||||
function handleSuccess(record: Recordable) {
|
||||
reload({ record });
|
||||
async function handleSuccess(record: Recordable) {
|
||||
await reload({ record });
|
||||
}
|
||||
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ const modalProps = {
|
||||
title: t('${functionNameSimple}选择'),
|
||||
};
|
||||
|
||||
const searchForm: FormProps = {
|
||||
const searchForm: FormProps<${ClassName}> = {
|
||||
baseColProps: { md: 8, lg: 6 },
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
@@ -130,7 +130,7 @@ const searchForm: FormProps = {
|
||||
],
|
||||
};
|
||||
|
||||
const tableColumns: BasicColumn[] = [
|
||||
const tableColumns: BasicColumn<${ClassName}>[] = [
|
||||
<%
|
||||
var firstColumn = true;
|
||||
// 生成树表的节点列
|
||||
|
||||
@@ -178,7 +178,7 @@ $(function() {
|
||||
},
|
||||
extendParams: {"#{p.extendParams}"},
|
||||
isLazy: "#{p.isLazy}",
|
||||
preview: "${__info_type=='0'?'':p.preview!=''?p.preview:@Global.getConfig('file.preview','true')}",
|
||||
preview: "${__info_type=='0'?'':isBlank(p.preview)||p.preview=='true'?@Global.getConfig('file.preview','true'):p.preview}",
|
||||
callback: function(id, act, $this, fileUploadId, fileUrl, fileName, fileUpload){
|
||||
if(typeof "#{p.callbackFuncName}" == 'function'){
|
||||
"#{p.callbackFuncName}"(id, act, $this, fileUploadId, fileUrl, fileName, fileUpload);
|
||||
|
||||
@@ -4,7 +4,7 @@ productName: JeeSite Demo
|
||||
companyName: ThinkGem
|
||||
|
||||
# 产品版本、版权年份
|
||||
productVersion: V5.12
|
||||
productVersion: V5.13
|
||||
copyrightYear: 2025
|
||||
|
||||
# 数据库连接
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-modules</artifactId>
|
||||
<version>5.12.1.springboot3-SNAPSHOT</version>
|
||||
<version>5.13.0.springboot3-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>JeeSite Modules</name>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-parent</artifactId>
|
||||
<version>5.12.1.springboot3-SNAPSHOT</version>
|
||||
<version>5.13.0.springboot3-SNAPSHOT</version>
|
||||
<relativePath>../../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-parent</artifactId>
|
||||
<version>5.12.1.springboot3-SNAPSHOT</version>
|
||||
<version>5.13.0.springboot3-SNAPSHOT</version>
|
||||
<relativePath>../../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.4.5</version>
|
||||
<version>3.5.4</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-parent</artifactId>
|
||||
<version>5.12.1.springboot3-SNAPSHOT</version>
|
||||
<version>5.13.0.springboot3-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>JeeSite Parent</name>
|
||||
@@ -48,14 +48,20 @@
|
||||
<mybatis-spring.version>3.0.4</mybatis-spring.version>
|
||||
<jsqlparser.version>4.9</jsqlparser.version>
|
||||
<atomikos.version>6.0.0</atomikos.version>
|
||||
<druid.version>1.2.24</druid.version>
|
||||
<shiro.version>2.0.4</shiro.version>
|
||||
<druid.version>1.2.27</druid.version>
|
||||
<shiro.version>2.0.5</shiro.version>
|
||||
<quartz.version>2.5.0</quartz.version>
|
||||
<swagger3.version>2.2.27</swagger3.version>
|
||||
<liquibase.version>4.31.1</liquibase.version>
|
||||
|
||||
<!-- jdbc driver version -->
|
||||
<mysql.version>8.0.33</mysql.version>
|
||||
<!-- jdbc driver for your db version -->
|
||||
<!--<mysql.version>9.3.0</mysql.version>-->
|
||||
<!--<oracle-database.version>23.7.0.25.01</oracle-database.version>-->
|
||||
<!--<jtds.version>1.3.1</jtds.version>-->
|
||||
<!--<mssql-jdbc.version>12.10.1.jre11</mssql-jdbc.version>-->
|
||||
<!--<postgresql.version>42.7.7</postgresql.version>-->
|
||||
<dameng.version>8.1.3.62</dameng.version>
|
||||
<kingbase.version>8.6.1</kingbase.version>
|
||||
<h2.version>2.3.232</h2.version>
|
||||
|
||||
<!-- environment setting -->
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite</artifactId>
|
||||
<version>5.12.1.springboot3-SNAPSHOT</version>
|
||||
<version>5.13.0.springboot3-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>JeeSite</name>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-root</artifactId>
|
||||
<version>5.12.1.springboot3-SNAPSHOT</version>
|
||||
<version>5.13.0.springboot3-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>JeeSite Root</name>
|
||||
|
||||
@@ -19,7 +19,7 @@ cd target
|
||||
rem <20><><EFBFBD><EFBFBD>Web<65><62><EFBFBD>̣<EFBFBD><CCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
rem <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> web.jar Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> jar <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
rem web.war <EFBFBD><EFBFBD> pom.xml <20><> finalName<6D><65>packaging һ<EFBFBD><EFBFBD>
|
||||
mkdir app
|
||||
copy web.war app
|
||||
cd app
|
||||
|
||||
@@ -17,7 +17,7 @@ cd target
|
||||
# 打包Web工程(结束)
|
||||
|
||||
|
||||
# 根据情况修改 web.jar 为您的 jar 包名称
|
||||
# web.war 与 pom.xml 中 finalName、packaging 一致
|
||||
mkdir app
|
||||
cp web.war ./app
|
||||
cd app
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-parent</artifactId>
|
||||
<version>5.12.1.springboot3-SNAPSHOT</version>
|
||||
<version>5.13.0.springboot3-SNAPSHOT</version>
|
||||
<relativePath>../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<properties>
|
||||
|
||||
<finalName>web</finalName><!-- war or jar 包的名称 -->
|
||||
<finalName>web</finalName><!-- war 或 jar 包的名称 -->
|
||||
<start-class>com.jeesite.modules.AiApplication</start-class>
|
||||
|
||||
<!-- docker setting -->
|
||||
@@ -63,7 +63,7 @@
|
||||
<dependency>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-vue-dist</artifactId>
|
||||
<version>5.12.1-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 热部署工具
|
||||
|
||||
@@ -8,7 +8,7 @@ productName: JeeSite Demo
|
||||
companyName: ThinkGem
|
||||
|
||||
# 产品版本、版权年份
|
||||
productVersion: V5.12
|
||||
productVersion: V5.13
|
||||
copyrightYear: 2025
|
||||
|
||||
# 是否演示模式
|
||||
|
||||
@@ -19,7 +19,7 @@ cd target
|
||||
rem <20><><EFBFBD><EFBFBD>Web<65><62><EFBFBD>̣<EFBFBD><CCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
rem <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> web.jar Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> jar <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
rem web.war <EFBFBD><EFBFBD> pom.xml <20><> finalName<6D><65>packaging һ<EFBFBD><EFBFBD>
|
||||
mkdir app
|
||||
copy web.war app
|
||||
cd app
|
||||
|
||||
@@ -17,7 +17,7 @@ cd target
|
||||
# 打包Web工程(结束)
|
||||
|
||||
|
||||
# 根据情况修改 web.jar 为您的 jar 包名称
|
||||
# web.war 与 pom.xml 中 finalName、packaging 一致
|
||||
mkdir app
|
||||
cp web.war ./app
|
||||
cd app
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-parent</artifactId>
|
||||
<version>5.12.1.springboot3-SNAPSHOT</version>
|
||||
<version>5.13.0.springboot3-SNAPSHOT</version>
|
||||
<relativePath>../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<properties>
|
||||
|
||||
<finalName>web</finalName><!-- war or jar 包的名称 -->
|
||||
<finalName>web</finalName><!-- war 或 jar 包的名称 -->
|
||||
<start-class>com.jeesite.modules.ApiApplication</start-class>
|
||||
|
||||
<!-- docker setting -->
|
||||
|
||||
@@ -8,7 +8,7 @@ productName: JeeSite Demo
|
||||
companyName: ThinkGem
|
||||
|
||||
# 产品版本、版权年份
|
||||
productVersion: V5.12
|
||||
productVersion: V5.13
|
||||
copyrightYear: 2025
|
||||
|
||||
# 是否演示模式
|
||||
@@ -280,7 +280,7 @@ spring:
|
||||
pathmatch:
|
||||
matching-strategy: ANT_PATH_MATCHER
|
||||
|
||||
# JTA XA 事务(spring boot 3) 请在 jeesite-module-core/pom.xml 中打开 atomikos 依赖
|
||||
# JTA XA 事务(spring boot 3)
|
||||
jta:
|
||||
enabled: false
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-parent</artifactId>
|
||||
<version>5.12.1.springboot3-SNAPSHOT</version>
|
||||
<version>5.13.0.springboot3-SNAPSHOT</version>
|
||||
<relativePath>../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<properties>
|
||||
|
||||
<finalName>web</finalName><!-- war or jar 包的名称 -->
|
||||
<finalName>web</finalName><!-- war 或 jar 包的名称 -->
|
||||
<start-class>com.jeesite.modules.FastApplication</start-class>
|
||||
|
||||
<!-- docker setting -->
|
||||
@@ -97,7 +97,7 @@
|
||||
<dependency>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-vue-dist</artifactId>
|
||||
<version>5.12.1-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -8,7 +8,7 @@ productName: JeeSite Demo
|
||||
companyName: ThinkGem
|
||||
|
||||
# 产品版本、版权年份
|
||||
productVersion: V5.12
|
||||
productVersion: V5.13
|
||||
copyrightYear: 2025
|
||||
|
||||
# 是否演示模式
|
||||
|
||||
@@ -19,7 +19,7 @@ cd target
|
||||
rem <20><><EFBFBD><EFBFBD>Web<65><62><EFBFBD>̣<EFBFBD><CCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
rem <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> web.jar Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> jar <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
rem web.war <EFBFBD><EFBFBD> pom.xml <20><> finalName<6D><65>packaging һ<EFBFBD><EFBFBD>
|
||||
mkdir app
|
||||
copy web.war app
|
||||
cd app
|
||||
|
||||
@@ -17,7 +17,7 @@ cd target
|
||||
# 打包Web工程(结束)
|
||||
|
||||
|
||||
# 根据情况修改 web.jar 为您的 jar 包名称
|
||||
# web.war 与 pom.xml 中 finalName、packaging 一致
|
||||
mkdir app
|
||||
cp web.war ./app
|
||||
cd app
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-parent</artifactId>
|
||||
<version>5.12.1.springboot3-SNAPSHOT</version>
|
||||
<version>5.13.0.springboot3-SNAPSHOT</version>
|
||||
<relativePath>../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<properties>
|
||||
|
||||
<finalName>web</finalName><!-- war or jar 包的名称 -->
|
||||
<finalName>web</finalName><!-- war 或 jar 包的名称 -->
|
||||
<start-class>com.jeesite.modules.MiniApplication</start-class>
|
||||
|
||||
<!-- docker setting -->
|
||||
|
||||
@@ -8,7 +8,7 @@ productName: JeeSite Demo
|
||||
companyName: ThinkGem
|
||||
|
||||
# 产品版本、版权年份
|
||||
productVersion: V5.12
|
||||
productVersion: V5.13
|
||||
copyrightYear: 2025
|
||||
|
||||
# 是否演示模式
|
||||
|
||||
@@ -19,7 +19,7 @@ cd target
|
||||
rem <20><><EFBFBD><EFBFBD>Web<65><62><EFBFBD>̣<EFBFBD><CCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
rem <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> web.jar Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> jar <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
rem web.war <EFBFBD><EFBFBD> pom.xml <20><> finalName<6D><65>packaging һ<EFBFBD><EFBFBD>
|
||||
mkdir app
|
||||
copy web.war app
|
||||
cd app
|
||||
|
||||
@@ -17,7 +17,7 @@ cd target
|
||||
# 打包Web工程(结束)
|
||||
|
||||
|
||||
# 根据情况修改 web.jar 为您的 jar 包名称
|
||||
# web.war 与 pom.xml 中 finalName、packaging 一致
|
||||
mkdir app
|
||||
cp web.war ./app
|
||||
cd app
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.jeesite</groupId>
|
||||
<artifactId>jeesite-parent</artifactId>
|
||||
<version>5.12.1.springboot3-SNAPSHOT</version>
|
||||
<version>5.13.0.springboot3-SNAPSHOT</version>
|
||||
<relativePath>../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<properties>
|
||||
|
||||
<finalName>web</finalName><!-- war or jar 包的名称 -->
|
||||
<finalName>web</finalName><!-- war 或 jar 包的名称 -->
|
||||
<start-class>com.jeesite.modules.Application</start-class>
|
||||
|
||||
<!-- docker setting -->
|
||||
|
||||
@@ -8,7 +8,7 @@ productName: JeeSite Demo
|
||||
companyName: ThinkGem
|
||||
|
||||
# 产品版本、版权年份
|
||||
productVersion: V5.12
|
||||
productVersion: V5.13
|
||||
copyrightYear: 2025
|
||||
|
||||
# 是否演示模式
|
||||
@@ -220,7 +220,7 @@ jdbc:
|
||||
# ds2:
|
||||
# type: mysql
|
||||
# driver: com.mysql.cj.jdbc.Driver
|
||||
# url: jdbc:mysql://127.0.0.1:3306/jeesite2?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai
|
||||
# url: jdbc:mysql://127.0.0.1:3306/jeesite_test?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai
|
||||
# username: root
|
||||
# password: 123456
|
||||
# testSql: SELECT 1
|
||||
@@ -280,7 +280,7 @@ spring:
|
||||
pathmatch:
|
||||
matching-strategy: ANT_PATH_MATCHER
|
||||
|
||||
# JTA XA 事务(spring boot 3) 请在 jeesite-module-core/pom.xml 中打开 atomikos 依赖
|
||||
# JTA XA 事务(spring boot 3)
|
||||
jta:
|
||||
enabled: false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user