整理日志输出
This commit is contained in:
parent
8cb8c4c834
commit
7f50349104
|
|
@ -12,10 +12,7 @@ import com.electromagnetic.industry.software.common.enums.EleDataSaveStatusEnum;
|
|||
import com.electromagnetic.industry.software.common.enums.EleDataStatusEnum;
|
||||
import com.electromagnetic.industry.software.common.enums.EleDataTypeEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.EleCommonUtil;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
import com.electromagnetic.industry.software.common.util.IdWorker;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import com.electromagnetic.industry.software.common.util.*;
|
||||
import com.electromagnetic.industry.software.manage.mapper.EdFileInfoMapper;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.EdFileInfo;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.FolderResortDTO;
|
||||
|
|
@ -36,10 +33,11 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo> implements EdFileInfoService {
|
||||
|
||||
private EleLog log = new EleLog(EdFileInfoServiceImpl.class);
|
||||
|
||||
@Resource
|
||||
private Environment environment;
|
||||
|
||||
|
|
@ -73,7 +71,8 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
|
||||
List<EdFileInfo> existEdFileInfos = this.baseMapper.selectList(existPrjWrapper);
|
||||
if (CollUtil.isNotEmpty(existEdFileInfos)) {
|
||||
log.info("{} 已经存在", prjName);
|
||||
String info = StrFormatter.format("{} 已经存在", prjName);
|
||||
log.info(info);
|
||||
ElectromagneticResultUtil.fail("-1", "该项目名称已经存在。");
|
||||
}
|
||||
|
||||
|
|
@ -104,7 +103,8 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
// 保存到文件系统
|
||||
fileSystemService.createDirectory(eleDataPath);
|
||||
} catch (Exception e) {
|
||||
log.error("文件创建失败,具体为--->{}", e.getMessage(), e);
|
||||
String info = StrFormatter.format("文件创建失败,具体为--->{}", e.getMessage());
|
||||
log.error(info, e);
|
||||
return ElectromagneticResultUtil.fail("-1", e.getMessage());
|
||||
}
|
||||
return ElectromagneticResultUtil.success(true);
|
||||
|
|
@ -133,7 +133,8 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
this.baseMapper.updateById(fileInfo);
|
||||
fileSystemService.renameFile(eleDataPath, oldPrjName, newPrjName);
|
||||
} catch (Exception e) {
|
||||
log.error("修改工程名异常--->{},{}", newPrjName, e.getMessage(), e);
|
||||
String info = StrFormatter.format("修改工程名异常--->{},{}", newPrjName, e.getMessage());
|
||||
log.error(info, e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return ElectromagneticResultUtil.success(true);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,32 @@
|
|||
package com.electromagnetic.industry.software.common.util;
|
||||
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Slf4j
|
||||
@Setter
|
||||
public class EleLog {
|
||||
|
||||
private Logger logger;
|
||||
|
||||
public EleLog(Class clazz) {
|
||||
this.logger = LoggerFactory.getLogger(clazz);
|
||||
}
|
||||
|
||||
public void info(String msg) {
|
||||
logger.info(msg);
|
||||
}
|
||||
|
||||
public void debug(String msg) {
|
||||
logger.debug(msg);
|
||||
}
|
||||
|
||||
public void warn(String msg) {
|
||||
logger.warn(msg);
|
||||
}
|
||||
public void error(String msg) {
|
||||
logger.error(msg);
|
||||
}
|
||||
|
||||
public void error(String msg, Throwable e) {
|
||||
logger.error(msg, e);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue