Compare commits
4 Commits
bee0344340
...
95a82bb69c
| Author | SHA1 | Date |
|---|---|---|
|
|
95a82bb69c | |
|
|
c6dcd99afb | |
|
|
82ef0063f7 | |
|
|
ce50a07e93 |
|
|
@ -18,7 +18,6 @@ import com.electromagnetic.industry.software.common.enums.*;
|
|||
import com.electromagnetic.industry.software.common.exception.BizException;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.EleCommonUtil;
|
||||
import com.electromagnetic.industry.software.common.util.EleLog;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import com.electromagnetic.industry.software.manage.config.ElePropertyConfig;
|
||||
|
|
@ -31,6 +30,7 @@ import com.electromagnetic.industry.software.manage.service.FileFormatService;
|
|||
import com.electromagnetic.industry.software.manage.service.FileSystemService;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
|
@ -43,12 +43,12 @@ import java.util.stream.Collectors;
|
|||
import static com.electromagnetic.industry.software.common.cons.ElectromagneticConstants.*;
|
||||
import static com.electromagnetic.industry.software.common.enums.FileRepeatEnum.*;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class CommonService {
|
||||
|
||||
private static final Map<Integer, String> PATH_MAP = new HashMap<>();
|
||||
|
||||
private final EleLog log = new EleLog(CommonService.class);
|
||||
|
||||
@Resource
|
||||
private ElePropertyConfig elePropertyConfig;
|
||||
|
|
|
|||
|
|
@ -7,10 +7,7 @@ import cn.hutool.core.io.FileUtil;
|
|||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.text.StrFormatter;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import cn.hutool.core.util.*;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.crypto.symmetric.AES;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
|
|
@ -42,6 +39,7 @@ import com.electromagnetic.industry.software.manage.pojo.resp.UploadRecordVO;
|
|||
import com.electromagnetic.industry.software.manage.service.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
|
|
@ -64,10 +62,10 @@ import static com.electromagnetic.industry.software.common.cons.ElectromagneticC
|
|||
import static com.electromagnetic.industry.software.common.enums.DataOwnEnum.USER_FILE;
|
||||
import static com.electromagnetic.industry.software.common.enums.FileRepeatEnum.*;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo> implements EdFileInfoService {
|
||||
|
||||
private final EleLog log = new EleLog(EdFileInfoServiceImpl.class);
|
||||
@Resource
|
||||
private CommonService commonService;
|
||||
@Resource
|
||||
|
|
@ -1312,11 +1310,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
}
|
||||
|
||||
String mimeType = Files.probeContentType(Paths.get(fileSaveTmpPath));
|
||||
if (mimeType == null) {
|
||||
// 如果无法探测到MIME类型,则使用默认值 application/octet-stream
|
||||
mimeType = "application/octet-stream";
|
||||
}
|
||||
|
||||
mimeType = EleCommonUtil.simpleTrueFalse(ObjectUtil.isNull(mimeType), "application/octet-stream", mimeType);
|
||||
FileSystemResource fileSystemResource = new FileSystemResource(fileSaveTmpPath);
|
||||
String fileName = fileSystemResource.getFilename();
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
|
|
@ -1571,69 +1565,79 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
}
|
||||
|
||||
private void updateImportPrj2FileSystem(MultipartFile file, String prjId) throws IOException {
|
||||
String orgName = file.getOriginalFilename();
|
||||
String tmpZipFile = elePropertyConfig.getEleTmpPath() + File.separator + orgName;
|
||||
String mainName = FileUtil.mainName(orgName);
|
||||
FileUtil.del(tmpZipFile);
|
||||
FileUtil.writeFromStream(file.getInputStream(), tmpZipFile);
|
||||
String destDir = elePropertyConfig.getEleTmpPath() + File.separator + IdUtil.fastSimpleUUID();
|
||||
String tmpZipFile = null;
|
||||
String destDir = null;
|
||||
try {
|
||||
ZipUtil.unzip(tmpZipFile, destDir, StandardCharsets.UTF_8);
|
||||
} catch (Exception e) {
|
||||
ZipUtil.unzip(tmpZipFile, destDir, Charset.forName("GBK"));
|
||||
}
|
||||
|
||||
File file1 = Objects.requireNonNull(new File(destDir).listFiles())[0];
|
||||
FileUtil.rename(file1, mainName, true);
|
||||
List<EdFileInfo> edFileInfos = this.baseMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
||||
.likeRight(EdFileInfo::getFilePath, prjId + MYSQL_FILE_PATH_SPLIT)
|
||||
.eq(EdFileInfo::getDataOwn, DataOwnEnum.SYS_PRJ.code));
|
||||
Map<String, String> idNameMap = edFileInfos.stream().collect(Collectors.toMap(EdFileInfo::getId, EdFileInfo::getFileName));
|
||||
idNameMap.put(prjId, mainName);
|
||||
Map<String, EdFileInfo> filePathMap = new HashMap<>();
|
||||
for (EdFileInfo edFileInfo : edFileInfos) {
|
||||
StringBuilder names = new StringBuilder();
|
||||
for (String id : edFileInfo.getFilePath().split(MYSQL_FILE_PATH_SPLIT)) {
|
||||
String name = idNameMap.get(id);
|
||||
names.append(MYSQL_FILE_PATH_SPLIT).append(name);
|
||||
String orgName = file.getOriginalFilename();
|
||||
tmpZipFile = elePropertyConfig.getEleTmpPath() + File.separator + orgName;
|
||||
String mainName = FileUtil.mainName(orgName);
|
||||
FileUtil.del(tmpZipFile);
|
||||
FileUtil.writeFromStream(file.getInputStream(), tmpZipFile);
|
||||
destDir = elePropertyConfig.getEleTmpPath() + File.separator + IdUtil.fastSimpleUUID();
|
||||
try {
|
||||
ZipUtil.unzip(tmpZipFile, destDir, StandardCharsets.UTF_8);
|
||||
} catch (Exception e) {
|
||||
ZipUtil.unzip(tmpZipFile, destDir, Charset.forName("GBK"));
|
||||
}
|
||||
filePathMap.put(names.substring(1), edFileInfo);
|
||||
}
|
||||
|
||||
List<File> files = FileUtil.loopFiles(destDir);
|
||||
String tmpPath = FileUtil.normalize(destDir);
|
||||
for (File importFile : files) {
|
||||
Assert.isTrue(EleCommonUtil.isFileNameValid(importFile.getName()), "文件名称不符合规范");
|
||||
String parentDir = FileUtil.normalize(importFile.getParent());
|
||||
String relativeFilePath = parentDir.replace(tmpPath, "");
|
||||
String fileType = FileUtil.getSuffix(importFile.getName());
|
||||
relativeFilePath = relativeFilePath.startsWith("/") ? relativeFilePath.substring(1) : relativeFilePath;
|
||||
relativeFilePath = relativeFilePath.replace("/", MYSQL_FILE_PATH_SPLIT);
|
||||
EdFileInfo edFileInfo = filePathMap.get(relativeFilePath);
|
||||
Assert.notNull(edFileInfo, "导入的工程与定义的层级结构不一致");
|
||||
String id = edFileInfo.getId();
|
||||
EdFileInfo newEdFileInfo = new EdFileInfo();
|
||||
newEdFileInfo.newInit();
|
||||
String fileCode = commonService.createFileCode(id, fileType, FILE_START_VERSION, newEdFileInfo.getFileTime());
|
||||
newEdFileInfo.setParentId(id)
|
||||
.setFileCode(fileCode)
|
||||
.setSaveStatus(EleDataSaveStatusEnum.SUCCESS.code)
|
||||
.setDataOwn(DataOwnEnum.SYS_FILE.code)
|
||||
.setFileName(FileUtil.mainName(importFile))
|
||||
.setFileContent(EleCommonUtil.parse(FileUtil.getInputStream(importFile), fileType))
|
||||
.setFileType(fileType)
|
||||
.setFileVersion(FILE_START_VERSION)
|
||||
.setFileSize(importFile.length())
|
||||
.setFilePath(edFileInfo.getFilePath() + MYSQL_FILE_PATH_SPLIT + newEdFileInfo.getId())
|
||||
.setDataType(EleDataTypeEnum.FILE.code)
|
||||
.setDataStatus(PublishEnum.PUBLISHED.getCode())
|
||||
.setEffectFlag(EffectFlagEnum.EFFECT.code);
|
||||
this.baseMapper.insert(newEdFileInfo);
|
||||
String destPath = commonService.getPrjRootPath1(DataOwnEnum.SYS_FILE.code) + File.separator + newEdFileInfo.getId();
|
||||
FileUtil.move(importFile, new File(destPath), false);
|
||||
EleCommonUtil.encryptFile(destPath, SecureUtil.aes(FILE_SEC_PASSWD.getBytes()));
|
||||
UserThreadLocal.setSuccessInfo(newEdFileInfo.getParentId(), newEdFileInfo.getId(), "解析导入的工程文件成功,导入的工程名为 {},文件名为 {}", orgName, importFile.getName());
|
||||
File file1 = Objects.requireNonNull(new File(destDir).listFiles())[0];
|
||||
FileUtil.rename(file1, mainName, true);
|
||||
List<EdFileInfo> edFileInfos = this.baseMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
||||
.likeRight(EdFileInfo::getFilePath, prjId + MYSQL_FILE_PATH_SPLIT)
|
||||
.eq(EdFileInfo::getDataOwn, DataOwnEnum.SYS_PRJ.code));
|
||||
Map<String, String> idNameMap = edFileInfos.stream().collect(Collectors.toMap(EdFileInfo::getId, EdFileInfo::getFileName));
|
||||
idNameMap.put(prjId, mainName);
|
||||
Map<String, EdFileInfo> filePathMap = new HashMap<>();
|
||||
for (EdFileInfo edFileInfo : edFileInfos) {
|
||||
StringBuilder names = new StringBuilder();
|
||||
for (String id : edFileInfo.getFilePath().split(MYSQL_FILE_PATH_SPLIT)) {
|
||||
String name = idNameMap.get(id);
|
||||
names.append(MYSQL_FILE_PATH_SPLIT).append(name);
|
||||
}
|
||||
filePathMap.put(names.substring(1), edFileInfo);
|
||||
}
|
||||
|
||||
List<File> files = FileUtil.loopFiles(destDir);
|
||||
String tmpPath = FileUtil.normalize(destDir);
|
||||
for (File importFile : files) {
|
||||
Assert.isTrue(EleCommonUtil.isFileNameValid(importFile.getName()), "文件名称不符合规范");
|
||||
String parentDir = FileUtil.normalize(importFile.getParent());
|
||||
String relativeFilePath = parentDir.replace(tmpPath, "");
|
||||
String fileType = FileUtil.getSuffix(importFile.getName());
|
||||
relativeFilePath = relativeFilePath.startsWith("/") ? relativeFilePath.substring(1) : relativeFilePath;
|
||||
relativeFilePath = relativeFilePath.replace("/", MYSQL_FILE_PATH_SPLIT);
|
||||
EdFileInfo edFileInfo = filePathMap.get(relativeFilePath);
|
||||
Assert.notNull(edFileInfo, "导入的工程与定义的层级结构不一致");
|
||||
String id = edFileInfo.getId();
|
||||
EdFileInfo newEdFileInfo = new EdFileInfo();
|
||||
newEdFileInfo.newInit();
|
||||
String fileCode = commonService.createFileCode(id, fileType, FILE_START_VERSION, newEdFileInfo.getFileTime());
|
||||
newEdFileInfo.setParentId(id)
|
||||
.setFileCode(fileCode)
|
||||
.setSaveStatus(EleDataSaveStatusEnum.SUCCESS.code)
|
||||
.setDataOwn(DataOwnEnum.SYS_FILE.code)
|
||||
.setFileName(FileUtil.mainName(importFile))
|
||||
.setFileContent(EleCommonUtil.parse(FileUtil.getInputStream(importFile), fileType))
|
||||
.setFileType(fileType)
|
||||
.setFileVersion(FILE_START_VERSION)
|
||||
.setFileSize(importFile.length())
|
||||
.setFilePath(edFileInfo.getFilePath() + MYSQL_FILE_PATH_SPLIT + newEdFileInfo.getId())
|
||||
.setDataType(EleDataTypeEnum.FILE.code)
|
||||
.setDataStatus(PublishEnum.PUBLISHED.getCode())
|
||||
.setEffectFlag(EffectFlagEnum.EFFECT.code);
|
||||
this.baseMapper.insert(newEdFileInfo);
|
||||
String destPath = commonService.getPrjRootPath1(DataOwnEnum.SYS_FILE.code) + File.separator + newEdFileInfo.getId();
|
||||
FileUtil.move(importFile, new File(destPath), false);
|
||||
EleCommonUtil.encryptFile(destPath, SecureUtil.aes(FILE_SEC_PASSWD.getBytes()));
|
||||
UserThreadLocal.setSuccessInfo(newEdFileInfo.getParentId(), newEdFileInfo.getId(), "解析导入的工程文件成功,导入的工程名为 {},文件名为 {}", orgName, importFile.getName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
String info = "上传失败,原因 " + e.getMessage();
|
||||
throw new BizException(info, e);
|
||||
} finally {
|
||||
FileUtil.del(destDir);
|
||||
FileUtil.del(tmpZipFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import com.electromagnetic.industry.software.common.enums.*;
|
|||
import com.electromagnetic.industry.software.common.exception.BizException;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.EleCommonUtil;
|
||||
import com.electromagnetic.industry.software.common.util.EleLog;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import com.electromagnetic.industry.software.manage.config.ElePropertyConfig;
|
||||
|
|
@ -25,6 +24,7 @@ import com.electromagnetic.industry.software.manage.pojo.resp.ProjectVO;
|
|||
import com.electromagnetic.industry.software.manage.service.EdPrjService;
|
||||
import com.electromagnetic.industry.software.manage.service.FileSystemService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
|
@ -33,11 +33,10 @@ import java.util.stream.Collectors;
|
|||
|
||||
import static com.electromagnetic.industry.software.common.cons.ElectromagneticConstants.*;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo> implements EdPrjService {
|
||||
|
||||
private final EleLog log = new EleLog(EdPrjServiceImpl.class);
|
||||
|
||||
@Resource
|
||||
private FileSystemService fileSystemService;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,8 @@ import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
|||
|
||||
import javax.crypto.*;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
import java.security.Security;
|
||||
|
||||
/**
|
||||
|
|
@ -21,56 +19,6 @@ import java.security.Security;
|
|||
*/
|
||||
public class AESUtils {
|
||||
|
||||
/**
|
||||
* <p>Discription:[加密]</p>
|
||||
* Created on 2022/07/06 10:52
|
||||
*
|
||||
* @param content 明文 用JSON.toJSONString(Map<String, String> map)转换的json字符串
|
||||
* @param key 加解密规则 访客系统提供key
|
||||
* @return String 密文
|
||||
*/
|
||||
public static String ecodes(String content, String key) {
|
||||
if (content == null || content.length() < 1) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
KeyGenerator kgen = KeyGenerator.getInstance("AES");
|
||||
SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
|
||||
random.setSeed(key.getBytes());
|
||||
kgen.init(128, random);
|
||||
SecretKey secretKey = kgen.generateKey();
|
||||
byte[] enCodeFormat = secretKey.getEncoded();
|
||||
SecretKeySpec secretKeySpec = new SecretKeySpec(enCodeFormat, "AES");
|
||||
Cipher cipher = Cipher.getInstance("AES");
|
||||
byte[] byteContent = content.getBytes("utf-8");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);
|
||||
byte[] byteRresult = cipher.doFinal(byteContent);
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < byteRresult.length; i++) {
|
||||
String hex = Integer.toHexString(byteRresult[i] & 0xFF);
|
||||
if (hex.length() == 1) {
|
||||
hex = '0' + hex;
|
||||
}
|
||||
sb.append(hex.toUpperCase());
|
||||
}
|
||||
return sb.toString();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchPaddingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvalidKeyException e) {
|
||||
e.printStackTrace();
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalBlockSizeException e) {
|
||||
e.printStackTrace();
|
||||
} catch (BadPaddingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 前端使用ECB,后端解密方法
|
||||
*
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
|
|||
import cn.hutool.crypto.symmetric.AES;
|
||||
import com.electromagnetic.industry.software.common.exception.BizException;
|
||||
import com.electromagnetic.industry.software.common.parse.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
|
|
@ -17,6 +18,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Slf4j
|
||||
public final class EleCommonUtil {
|
||||
|
||||
private static final Map<String, FileParse> PARSE_MAP = new HashMap<>();
|
||||
|
|
@ -24,8 +26,7 @@ public final class EleCommonUtil {
|
|||
private static final String PATTERN = "^[\\u4e00-\\u9fa5a-zA-Z0-9._\\-+]+$";
|
||||
private static final String TIME_FORMAT1 = "yyMMddHHmmssSSS";
|
||||
// 编译正则表达式
|
||||
private static final Pattern pattern = Pattern.compile(PATTERN);
|
||||
private static final EleLog log = new EleLog(EleCommonUtil.class);
|
||||
private static final Pattern NAME_PATTERN = Pattern.compile(PATTERN);
|
||||
|
||||
static {
|
||||
PARSE_MAP.put("doc", new WordParse());
|
||||
|
|
@ -51,7 +52,7 @@ public final class EleCommonUtil {
|
|||
if (StrUtil.isEmpty(fileFullName) || fileFullName.length() > 32) {
|
||||
return false;
|
||||
}
|
||||
return pattern.matcher(fileFullName).matches();
|
||||
return NAME_PATTERN.matcher(fileFullName).matches();
|
||||
}
|
||||
|
||||
public static String getNowTimeStr() {
|
||||
|
|
|
|||
|
|
@ -1,81 +0,0 @@
|
|||
package com.electromagnetic.industry.software.common.util;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class EleLog {
|
||||
|
||||
private static final String PLACE_HOLDER = "{}";
|
||||
|
||||
private Logger logger;
|
||||
|
||||
public EleLog(Class clazz) {
|
||||
this.logger = LoggerFactory.getLogger(clazz);
|
||||
}
|
||||
|
||||
private static String format(String strPattern, Object... argArray) {
|
||||
if (!StrUtil.isBlank(strPattern) && !StrUtil.isBlank(PLACE_HOLDER) && !ArrayUtil.isEmpty(argArray)) {
|
||||
int strPatternLength = strPattern.length();
|
||||
int placeHolderLength = PLACE_HOLDER.length();
|
||||
StringBuilder sbuf = new StringBuilder(strPatternLength + 50);
|
||||
int handledPosition = 0;
|
||||
|
||||
for (int argIndex = 0; argIndex < argArray.length; ++argIndex) {
|
||||
int delimIndex = strPattern.indexOf(PLACE_HOLDER, handledPosition);
|
||||
if (delimIndex == -1) {
|
||||
if (handledPosition == 0) {
|
||||
return strPattern;
|
||||
}
|
||||
|
||||
sbuf.append(strPattern, handledPosition, strPatternLength);
|
||||
return sbuf.toString();
|
||||
}
|
||||
|
||||
if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == '\\') {
|
||||
if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == '\\') {
|
||||
sbuf.append(strPattern, handledPosition, delimIndex - 1);
|
||||
sbuf.append(StrUtil.utf8Str(argArray[argIndex]));
|
||||
handledPosition = delimIndex + placeHolderLength;
|
||||
} else {
|
||||
--argIndex;
|
||||
sbuf.append(strPattern, handledPosition, delimIndex - 1);
|
||||
sbuf.append(PLACE_HOLDER.charAt(0));
|
||||
handledPosition = delimIndex + 1;
|
||||
}
|
||||
} else {
|
||||
sbuf.append(strPattern, handledPosition, delimIndex);
|
||||
sbuf.append(StrUtil.utf8Str(argArray[argIndex]));
|
||||
handledPosition = delimIndex + placeHolderLength;
|
||||
}
|
||||
}
|
||||
|
||||
sbuf.append(strPattern, handledPosition, strPatternLength);
|
||||
return sbuf.toString();
|
||||
} else {
|
||||
return strPattern;
|
||||
}
|
||||
}
|
||||
|
||||
public void info(String msg, Object... args) {
|
||||
logger.info(format(msg, args));
|
||||
}
|
||||
|
||||
public void debug(String msg, Object... args) {
|
||||
logger.debug(format(msg, args));
|
||||
}
|
||||
|
||||
public void warn(String msg, Object... args) {
|
||||
logger.warn(format(msg, args));
|
||||
}
|
||||
|
||||
public void error(String msg, Object... args) {
|
||||
logger.error(format(msg, args));
|
||||
}
|
||||
|
||||
public void error(String msg, Throwable e, Object... args) {
|
||||
String info = format(msg, args);
|
||||
logger.error(info, e);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue