合并冲突处理
This commit is contained in:
commit
3299aa7804
|
|
@ -23,26 +23,6 @@
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter</artifactId>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>ch.qos.logback</groupId>
|
|
||||||
<artifactId>logback-classic</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-log4j12</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
|
||||||
<artifactId>log4j-to-slf4j</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.hutool</groupId>
|
<groupId>cn.hutool</groupId>
|
||||||
<artifactId>hutool-all</artifactId>
|
<artifactId>hutool-all</artifactId>
|
||||||
|
|
@ -93,35 +73,6 @@
|
||||||
<artifactId>druid</artifactId>
|
<artifactId>druid</artifactId>
|
||||||
<version>1.1.10</version>
|
<version>1.1.10</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
|
||||||
<artifactId>log4j-api</artifactId>
|
|
||||||
<version>2.11.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
|
||||||
<artifactId>log4j-core</artifactId>
|
|
||||||
<version>2.11.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
|
||||||
<artifactId>log4j-jcl</artifactId>
|
|
||||||
<version>2.11.2</version>
|
|
||||||
</dependency>
|
|
||||||
<!--使⽤log4j2的AsyncLogger,包含disruptor-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.lmax</groupId>
|
|
||||||
<artifactId>disruptor</artifactId>
|
|
||||||
<version>3.4.2</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- slf4j依赖-->
|
|
||||||
<!--与slf4j保持桥接-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
|
||||||
<artifactId>log4j-slf4j-impl</artifactId>
|
|
||||||
<version>2.11.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.electromagnetic.industry.software.manage.common;
|
||||||
|
|
||||||
|
import com.electromagnetic.industry.software.common.exception.BizException;
|
||||||
|
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||||
|
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@ControllerAdvice
|
||||||
|
public class GlobalExceptionHandler {
|
||||||
|
|
||||||
|
@ExceptionHandler(RuntimeException.class)
|
||||||
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
|
@ResponseBody
|
||||||
|
public ElectromagneticResult<?> runTimeError(Throwable e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
return ElectromagneticResultUtil.fail("-1", e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(BizException.class)
|
||||||
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
|
@ResponseBody
|
||||||
|
public ElectromagneticResult<?> bizError(BizException e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
return ElectromagneticResultUtil.fail("-1", e.getMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -15,7 +15,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@RequestMapping("/data/ed/file")
|
@RequestMapping("/data1/ed/file")
|
||||||
@RestController
|
@RestController
|
||||||
public class EDDataController {
|
public class EDDataController {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,72 @@
|
||||||
package com.electromagnetic.industry.software.manage.controller;
|
package com.electromagnetic.industry.software.manage.controller;
|
||||||
|
|
||||||
|
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||||
|
import com.electromagnetic.industry.software.manage.pojo.req.FolderResortDTO;
|
||||||
|
import com.electromagnetic.industry.software.manage.service.EdFileInfoService;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/data/ed/prj")
|
@RequestMapping("/data/ed/prj")
|
||||||
public class ProjectController {
|
public class ProjectController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private EdFileInfoService edFileInfoService;
|
||||||
|
|
||||||
|
@RequestMapping("create")
|
||||||
|
public ElectromagneticResult<?> create(@RequestParam String prjName) {
|
||||||
|
return edFileInfoService.createNewPrj(prjName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("delete")
|
||||||
|
public ElectromagneticResult<?> delete(@RequestParam String prjId) {
|
||||||
|
return edFileInfoService.delete(prjId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("modify")
|
||||||
|
public ElectromagneticResult<?> modifyPrjName(@RequestParam String newPrjName, @RequestParam String prjId) {
|
||||||
|
return edFileInfoService.modifyPrjName(prjId, newPrjName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping("queryAll")
|
||||||
|
public ElectromagneticResult<?> queryAll() {
|
||||||
|
return edFileInfoService.queryAllPrjInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("addFolder")
|
||||||
|
public ElectromagneticResult<?> addFolder(@RequestParam String folderName, @RequestParam String parentId) {
|
||||||
|
return edFileInfoService.addFolder(parentId, folderName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("modifyFolder")
|
||||||
|
public ElectromagneticResult<?> modifyFolder(@RequestParam String newFolderName, @RequestParam String id) {
|
||||||
|
return edFileInfoService.modifyFolder(id, newFolderName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("deleteFolder")
|
||||||
|
public ElectromagneticResult<?> deleteFolder(@RequestParam String fileId) {
|
||||||
|
return edFileInfoService.deleteFolder(fileId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("folderResort")
|
||||||
|
public ElectromagneticResult<?> folderResort(@RequestBody List<FolderResortDTO> folderResortDTOList) {
|
||||||
|
return edFileInfoService.folderResort(folderResortDTOList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("publish")
|
||||||
|
public ElectromagneticResult<?> publish(@RequestParam String prjId) {
|
||||||
|
return edFileInfoService.publish(prjId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("follow")
|
||||||
|
public ElectromagneticResult<?> follow(@RequestParam String sourceId, @RequestParam String targetId) {
|
||||||
|
return edFileInfoService.follow(sourceId, targetId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,13 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.models.EdFileInfo;
|
import com.electromagnetic.industry.software.manage.pojo.models.EdFileInfo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface EdFileInfoMapper extends BaseMapper<EdFileInfo> {
|
public interface EdFileInfoMapper extends BaseMapper<EdFileInfo> {
|
||||||
|
|
||||||
|
String maxPrjId();
|
||||||
|
|
||||||
|
List<EdFileInfo> selectAllAdminFolder(String prjId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.models.RolePermission;
|
import com.electromagnetic.industry.software.manage.pojo.models.RolePermission;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface RolePermissionMapper extends BaseMapper<RolePermission> {
|
public interface RolePermissionMapper extends BaseMapper<RolePermission> {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.electromagnetic.industry.software.manage.pojo.models;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Data
|
||||||
|
public class BaseModel {
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "created_time")
|
||||||
|
private Date createdTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@TableField(value = "created_by")
|
||||||
|
private String createdBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最后更新时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "update_time")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最后更新人
|
||||||
|
*/
|
||||||
|
@TableField(value = "updated_by")
|
||||||
|
private String updatedBy;
|
||||||
|
}
|
||||||
|
|
@ -2,13 +2,16 @@ package com.electromagnetic.industry.software.manage.pojo.models;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.*;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import lombok.experimental.FieldNameConstants;
|
||||||
|
|
||||||
import java.util.Date;
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
|
||||||
@Data
|
|
||||||
@TableName("ed_file_info")
|
@TableName("ed_file_info")
|
||||||
public class EdFileInfo {
|
@Accessors(chain = true)
|
||||||
|
@Data
|
||||||
|
@FieldNameConstants
|
||||||
|
public class EdFileInfo extends BaseModel {
|
||||||
/**
|
/**
|
||||||
* 主键ID
|
* 主键ID
|
||||||
*/
|
*/
|
||||||
|
|
@ -100,30 +103,6 @@ public class EdFileInfo {
|
||||||
@TableField(value = "save_status")
|
@TableField(value = "save_status")
|
||||||
private Integer saveStatus;
|
private Integer saveStatus;
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件创建时间
|
|
||||||
*/
|
|
||||||
@TableField(value = "created_time")
|
|
||||||
private Date createdTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件创建人
|
|
||||||
*/
|
|
||||||
@TableField(value = "created_by")
|
|
||||||
private String createdBy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件最后更新时间
|
|
||||||
*/
|
|
||||||
@TableField(value = "update_time")
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件最后更新人
|
|
||||||
*/
|
|
||||||
@TableField(value = "updated_by")
|
|
||||||
private String updatedBy;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件夹发布状态,0-未发布,1-已发布
|
* 文件夹发布状态,0-未发布,1-已发布
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.electromagnetic.industry.software.manage.pojo.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class FolderResortDTO {
|
||||||
|
private String id;
|
||||||
|
private int sort;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.electromagnetic.industry.software.manage.pojo.resp;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ProjectVO {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String fileName;
|
||||||
|
private String parentId;
|
||||||
|
private int sort;
|
||||||
|
|
||||||
|
private List<ProjectVO> children;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,81 @@
|
||||||
package com.electromagnetic.industry.software.manage.service;
|
package com.electromagnetic.industry.software.manage.service;
|
||||||
|
|
||||||
|
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||||
|
import com.electromagnetic.industry.software.manage.pojo.req.FolderResortDTO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface EdFileInfoService {
|
public interface EdFileInfoService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建一个新的工程
|
||||||
|
* @param prjName 新的工程名
|
||||||
|
*/
|
||||||
|
ElectromagneticResult<?> createNewPrj(String prjName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改项目名称
|
||||||
|
* @param prjId
|
||||||
|
* @param newPrjName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ElectromagneticResult<?> modifyPrjName(String prjId, String newPrjName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除一个项目,做逻辑删除
|
||||||
|
* @param prjId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ElectromagneticResult<?> delete(String prjId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加子集
|
||||||
|
* @param parentId
|
||||||
|
* @param folderName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ElectromagneticResult<?> addFolder(String parentId, String folderName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有项目
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ElectromagneticResult<?> queryAllPrjInfo();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子集拖拽重排序
|
||||||
|
* @param folderResortDTOList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ElectromagneticResult<?> folderResort(List<FolderResortDTO> folderResortDTOList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目发布
|
||||||
|
* @param prjId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ElectromagneticResult<?> publish(String prjId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除子集
|
||||||
|
* @param fileId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ElectromagneticResult<?> deleteFolder(String fileId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 层级沿用
|
||||||
|
* @param sourceId
|
||||||
|
* @param targetId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ElectromagneticResult<?> follow(String sourceId, String targetId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改子集名称
|
||||||
|
* @param id
|
||||||
|
* @param newFolderName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ElectromagneticResult<?> modifyFolder(String id, String newFolderName);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.electromagnetic.industry.software.manage.service;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
public interface FileSystemService {
|
||||||
|
|
||||||
|
void createDirectory(String path);
|
||||||
|
|
||||||
|
void copyFile(String source, String destination);
|
||||||
|
|
||||||
|
void moveFile(String source, String destination);
|
||||||
|
|
||||||
|
void save(InputStream inputStream, String destination);
|
||||||
|
|
||||||
|
void renameFile(String sourcePath, String newName);
|
||||||
|
|
||||||
|
void renameFile(String sourcePath, String sourceName, String newName);
|
||||||
|
|
||||||
|
boolean checkFolderExist(String newPath);
|
||||||
|
}
|
||||||
|
|
@ -63,25 +63,25 @@ public class EDDataServiceImpl implements EDDataService {
|
||||||
private EDDataMapper edDataMapper;
|
private EDDataMapper edDataMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private CategoryMapper categoryMapper;
|
private CategoryMapper categoryMapper;
|
||||||
@Value("${data.windows.path}")
|
// @Value("${data.windows.path}")
|
||||||
private String uploadFilePath;
|
private String uploadFilePath;
|
||||||
@Value("${data.file.storage.dir}")
|
// @Value("${data.file.storage.dir}")
|
||||||
private String fileStorageDir;
|
private String fileStorageDir;
|
||||||
@Value("${data.import.cache.dir}")
|
// @Value("${data.import.cache.dir}")
|
||||||
private String importCacheDir;
|
private String importCacheDir;
|
||||||
@Value("${file.encode.passwd}")
|
// @Value("${file.encode.passwd}")
|
||||||
private String encodePasswd;
|
private String encodePasswd;
|
||||||
@Value("${data.type.folder}")
|
// @Value("${data.type.folder}")
|
||||||
private String dataTypeFolder;
|
private String dataTypeFolder;
|
||||||
@Value("${data.windows.path}")
|
// @Value("${data.windows.path}")
|
||||||
private String windowsDir;
|
private String windowsDir;
|
||||||
@Value("${data.file.cache.dir}")
|
// @Value("${data.file.cache.dir}")
|
||||||
private String fileCacheDir;
|
private String fileCacheDir;
|
||||||
@Value("${data.upload.cache.dir}")
|
// @Value("${data.upload.cache.dir}")
|
||||||
private String uploadCacheDir;
|
private String uploadCacheDir;
|
||||||
@Value("${data.export.cache.dir}")
|
// @Value("${data.export.cache.dir}")
|
||||||
private String exportCacheDir;
|
private String exportCacheDir;
|
||||||
@Value("${data.type.file}")
|
// @Value("${data.type.file}")
|
||||||
private String dataTypeFile;
|
private String dataTypeFile;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,520 @@
|
||||||
package com.electromagnetic.industry.software.manage.service.serviceimpl;
|
package com.electromagnetic.industry.software.manage.service.serviceimpl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import cn.hutool.core.lang.tree.Tree;
|
||||||
|
import cn.hutool.core.lang.tree.TreeNodeConfig;
|
||||||
|
import cn.hutool.core.lang.tree.TreeUtil;
|
||||||
|
import cn.hutool.core.text.StrFormatter;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.electromagnetic.industry.software.common.enums.EffectFlagEnum;
|
||||||
|
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.exception.BizException;
|
||||||
|
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||||
|
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;
|
||||||
|
import com.electromagnetic.industry.software.manage.pojo.resp.ProjectVO;
|
||||||
import com.electromagnetic.industry.software.manage.service.EdFileInfoService;
|
import com.electromagnetic.industry.software.manage.service.EdFileInfoService;
|
||||||
|
import com.electromagnetic.industry.software.manage.service.FileSystemService;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.core.env.Environment;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.electromagnetic.industry.software.common.cons.ElectromagneticConstants.*;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class EdFileInfoServiceImpl implements EdFileInfoService {
|
public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo> implements EdFileInfoService {
|
||||||
|
|
||||||
|
private EleLog log = new EleLog(EdFileInfoServiceImpl.class);
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private Environment environment;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FileSystemService fileSystemService;
|
||||||
|
|
||||||
|
@Value("${prj.folder.max.length}")
|
||||||
|
private int prjFolderMaxLength;
|
||||||
|
|
||||||
|
private String eleDataPath;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
String osName = System.getProperty("os.name").toLowerCase();
|
||||||
|
eleDataPath = osName.startsWith("win") ? environment.getProperty("data.windows.path") : environment.getProperty("data.linux.path");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建一个新的工程
|
||||||
|
* @param prjName 新的工程名
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public ElectromagneticResult<?> createNewPrj(String prjName) {
|
||||||
|
|
||||||
|
Assert.isTrue(EleCommonUtil.isFileNameValid(prjName), "文件名不符合规范,只能包含中文字符、下划线、连字符、加号、数字和英文字符且长度小于32。");
|
||||||
|
if (!EleCommonUtil.isFileNameValid(prjName)) {
|
||||||
|
String info = StrFormatter.format("工程名称{}不符合要求", prjName);
|
||||||
|
log.error(info);
|
||||||
|
return ElectromagneticResultUtil.fail("-1", info);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 首先检查工程是否存在
|
||||||
|
// TODO 一个项目如果被废除了,然后又新建了一个同名工程,这种情况怎么处理,需要产品确认。当前这里先按照同名如果存在则抛出异常处理。
|
||||||
|
LambdaQueryWrapper<EdFileInfo> existPrjWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
|
.eq(EdFileInfo::getParentId, "")
|
||||||
|
.isNull(EdFileInfo::getParentId);
|
||||||
|
|
||||||
|
List<EdFileInfo> existEdFileInfos = this.baseMapper.selectList(existPrjWrapper);
|
||||||
|
if (CollUtil.isNotEmpty(existEdFileInfos)) {
|
||||||
|
String info = StrFormatter.format("{} 已经存在", prjName);
|
||||||
|
log.info(info);
|
||||||
|
ElectromagneticResultUtil.fail("-1", "该项目名称已经存在。");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 保存信息到MySQL
|
||||||
|
int id = Integer.parseInt(this.baseMapper.maxPrjId());
|
||||||
|
Date now = new Date();
|
||||||
|
String currentUserId = UserThreadLocal.getUserId();
|
||||||
|
String newPrjId = String.valueOf(id + 1);
|
||||||
|
|
||||||
|
EdFileInfo fileInfo = new EdFileInfo();
|
||||||
|
fileInfo.setId(newPrjId)
|
||||||
|
.setFileId(newPrjId)
|
||||||
|
.setFileName(prjName)
|
||||||
|
.setFileVersion(100)
|
||||||
|
.setFileTime(EleCommonUtil.getNowTimeStr())
|
||||||
|
.setDataType(EleDataTypeEnum.FOLDER.code)
|
||||||
|
.setDataStatus(EleDataStatusEnum.NOT_PUBLISHED.code)
|
||||||
|
.setEffectFlag(EffectFlagEnum.EFFECT.code)
|
||||||
|
.setSaveStatus(EleDataSaveStatusEnum.SUCCESS.code)
|
||||||
|
.setFilePath(newPrjId)
|
||||||
|
.setSort(1)
|
||||||
|
.setCreatedTime(now)
|
||||||
|
.setUpdateTime(now)
|
||||||
|
.setCreatedBy(currentUserId)
|
||||||
|
.setUpdatedBy(currentUserId);
|
||||||
|
this.save(fileInfo);
|
||||||
|
// 保存到文件系统
|
||||||
|
fileSystemService.createDirectory(eleDataPath);
|
||||||
|
} catch (Exception e) {
|
||||||
|
String info = StrFormatter.format("文件创建失败,具体为--->{}", e.getMessage());
|
||||||
|
log.error(info, e);
|
||||||
|
throw new BizException(-1, info);
|
||||||
|
}
|
||||||
|
return ElectromagneticResultUtil.success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改项目名称
|
||||||
|
* @param prjId
|
||||||
|
* @param newPrjName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public ElectromagneticResult<?> modifyPrjName(String prjId, String newPrjName) {
|
||||||
|
try {
|
||||||
|
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class).eq(EdFileInfo::getId, prjId);
|
||||||
|
EdFileInfo fileInfo = this.baseMapper.selectOne(queryWrapper);
|
||||||
|
String oldPrjName = fileInfo.getFileName();
|
||||||
|
String newPath = eleDataPath + File.separator + newPrjName;
|
||||||
|
if (fileSystemService.checkFolderExist(newPath)) {
|
||||||
|
String info = StrFormatter.format("工程名{}已经存在", newPrjName);
|
||||||
|
log.error(info);
|
||||||
|
return ElectromagneticResultUtil.fail("-1", info);
|
||||||
|
}
|
||||||
|
fileInfo.setFileName(newPrjName);
|
||||||
|
this.baseMapper.updateById(fileInfo);
|
||||||
|
fileSystemService.renameFile(eleDataPath, oldPrjName, newPrjName);
|
||||||
|
} catch (Exception e) {
|
||||||
|
String info = StrFormatter.format("修改工程名异常--->{},{}", newPrjName, e.getMessage());
|
||||||
|
log.error(info, e);
|
||||||
|
throw new BizException(-1, info);
|
||||||
|
}
|
||||||
|
return ElectromagneticResultUtil.success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除一个项目,做逻辑删除
|
||||||
|
*
|
||||||
|
* @param prjId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public ElectromagneticResult<?> delete(String prjId) {
|
||||||
|
try {
|
||||||
|
List<String> ids = new ArrayList<>();
|
||||||
|
ids.add(prjId);
|
||||||
|
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
|
.select(EdFileInfo::getId)
|
||||||
|
.likeRight(EdFileInfo::getFilePath, prjId + MYSQL_FILE_PATH_SPLIT);
|
||||||
|
List<EdFileInfo> edFileInfos = this.baseMapper.selectList(queryWrapper);
|
||||||
|
edFileInfos.forEach(e -> ids.add(e.getId()));
|
||||||
|
Wrappers.lambdaUpdate(EdFileInfo.class).set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code).in(EdFileInfo::getId, ids);
|
||||||
|
return ElectromagneticResultUtil.success(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
String info = "删除项目失败";
|
||||||
|
log.error(info, e);
|
||||||
|
throw new BizException(-1, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加子集
|
||||||
|
*
|
||||||
|
* @param parentId
|
||||||
|
* @param folderName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public ElectromagneticResult<?> addFolder(String parentId, String folderName) {
|
||||||
|
|
||||||
|
// 验证名称是否合法
|
||||||
|
Assert.isTrue(EleCommonUtil.isFileNameValid(folderName), "文件名不符合规范,只能包含中文字符、下划线、连字符、加号、数字和英文字符且长度小于32。");
|
||||||
|
|
||||||
|
if (!EleCommonUtil.isFileNameValid(folderName)) {
|
||||||
|
String info = StrFormatter.format("子集名称{}不符合要求", folderName);
|
||||||
|
log.error(info);
|
||||||
|
return ElectromagneticResultUtil.fail("-1", info);
|
||||||
|
}
|
||||||
|
// 首先判断判断当前深度是否已经达到6层
|
||||||
|
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
|
.select(EdFileInfo::getId, EdFileInfo::getFilePath)
|
||||||
|
.eq(EdFileInfo::getId, parentId);
|
||||||
|
EdFileInfo edFileInfo = this.baseMapper.selectOne(queryWrapper);
|
||||||
|
String currentPath = edFileInfo.getFilePath();
|
||||||
|
List<String> paths = CollUtil.newArrayList(edFileInfo.getFilePath().split(MYSQL_FILE_PATH_SPLIT));
|
||||||
|
if (paths.size() >= prjFolderMaxLength) {
|
||||||
|
String info = "当前子集已达到最大层级,禁止创建子集。";
|
||||||
|
log.error(info);
|
||||||
|
return ElectromagneticResultUtil.fail("-1", info);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断文件夹名称是否存在
|
||||||
|
List<EdFileInfo> edFileInfos = this.baseMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
|
.select(EdFileInfo::getId, EdFileInfo::getFileName)
|
||||||
|
.eq(EdFileInfo::getParentId, parentId));
|
||||||
|
List<String> names = edFileInfos.stream().map(EdFileInfo::getFileName).collect(Collectors.toList());
|
||||||
|
if (names.contains(folderName)) {
|
||||||
|
String info = "该子集名称已存在";
|
||||||
|
log.error(info);
|
||||||
|
return ElectromagneticResultUtil.fail("-1", info);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
int id = Integer.parseInt(this.baseMapper.maxPrjId());
|
||||||
|
Date now = new Date();
|
||||||
|
String currentUserId = UserThreadLocal.getUserId();
|
||||||
|
String newFolderId = String.valueOf(id + 1);
|
||||||
|
String path = currentPath + MYSQL_FILE_PATH_SPLIT + newFolderId;
|
||||||
|
EdFileInfo fileInfo = new EdFileInfo();
|
||||||
|
fileInfo.setId(newFolderId)
|
||||||
|
.setFileId(newFolderId)
|
||||||
|
.setFileName(folderName)
|
||||||
|
.setFileVersion(100)
|
||||||
|
.setParentId(parentId)
|
||||||
|
.setFileTime(EleCommonUtil.getNowTimeStr())
|
||||||
|
.setDataType(EleDataTypeEnum.FOLDER.code)
|
||||||
|
.setDataStatus(EleDataStatusEnum.NOT_PUBLISHED.code)
|
||||||
|
.setEffectFlag(EffectFlagEnum.EFFECT.code)
|
||||||
|
.setSaveStatus(EleDataSaveStatusEnum.SUCCESS.code)
|
||||||
|
.setFilePath(path)
|
||||||
|
.setSort(names.size() + 1)
|
||||||
|
.setCreatedTime(now)
|
||||||
|
.setUpdateTime(now)
|
||||||
|
.setCreatedBy(currentUserId)
|
||||||
|
.setUpdatedBy(currentUserId);
|
||||||
|
// 保存到文件系统
|
||||||
|
String targetFilePath = getPath(paths) + File.separator + folderName;
|
||||||
|
fileSystemService.createDirectory(targetFilePath);
|
||||||
|
return ElectromagneticResultUtil.success(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
String info = "添加子集失败";
|
||||||
|
log.error(info, e);
|
||||||
|
throw new BizException(-1, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有项目
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ElectromagneticResult<?> queryAllPrjInfo() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
|
.select(EdFileInfo::getId)
|
||||||
|
.eq(EdFileInfo::getParentId, 0)
|
||||||
|
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code);
|
||||||
|
List<String> ids = this.baseMapper.selectList(queryWrapper).stream().map(EdFileInfo::getId).collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<ProjectVO> projectVOS = new ArrayList<>();
|
||||||
|
|
||||||
|
for (String id : ids) {
|
||||||
|
LambdaQueryWrapper<EdFileInfo> queryWrapper1 = Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
|
.select(EdFileInfo::getId, EdFileInfo::getFileName, EdFileInfo::getParentId, EdFileInfo::getSort)
|
||||||
|
.like(EdFileInfo::getFilePath, MYSQL_FILE_PATH_SPLIT + id + MYSQL_FILE_PATH_SPLIT);
|
||||||
|
List<EdFileInfo> edFileInfos = this.baseMapper.selectList(queryWrapper1);
|
||||||
|
// 转换为树
|
||||||
|
TreeNodeConfig config = new TreeNodeConfig();
|
||||||
|
config.setIdKey(EdFileInfo.Fields.id);
|
||||||
|
config.setParentIdKey(EdFileInfo.Fields.parentId);
|
||||||
|
config.setWeightKey(EdFileInfo.Fields.sort);
|
||||||
|
|
||||||
|
List<Tree<String>> trees = TreeUtil.build(edFileInfos, "0", config, ((obj, treeNode) -> {
|
||||||
|
treeNode.putExtra(EdFileInfo.Fields.id, obj.getId());
|
||||||
|
treeNode.putExtra(EdFileInfo.Fields.parentId, obj.getParentId());
|
||||||
|
treeNode.putExtra(EdFileInfo.Fields.sort, obj.getSort());
|
||||||
|
treeNode.putExtra(EdFileInfo.Fields.fileName, obj.getFileName());
|
||||||
|
}));
|
||||||
|
|
||||||
|
String jsonStr = JSONUtil.toJsonStr(trees);
|
||||||
|
ProjectVO projectVO = JSONUtil.toList(jsonStr, ProjectVO.class).get(0);
|
||||||
|
projectVOS.add(projectVO);
|
||||||
|
}
|
||||||
|
return ElectromagneticResultUtil.success(projectVOS);
|
||||||
|
} catch (Exception e) {
|
||||||
|
String info = "查询项目失败";
|
||||||
|
log.error(info, e);
|
||||||
|
throw new BizException(-1, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子集拖拽重排序
|
||||||
|
*
|
||||||
|
* @param folderResortDTOList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public ElectromagneticResult<?> folderResort(List<FolderResortDTO> folderResortDTOList) {
|
||||||
|
try {
|
||||||
|
for (FolderResortDTO folderResortDTO : folderResortDTOList) {
|
||||||
|
LambdaUpdateWrapper<EdFileInfo> updateWrapper = Wrappers.lambdaUpdate(EdFileInfo.class)
|
||||||
|
.set(EdFileInfo::getSort, folderResortDTO.getSort())
|
||||||
|
.eq(EdFileInfo::getId, folderResortDTO.getId());
|
||||||
|
this.update(updateWrapper);
|
||||||
|
}
|
||||||
|
return ElectromagneticResultUtil.success(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
String info = "子集重排序异常";
|
||||||
|
log.error(info, e);
|
||||||
|
throw new BizException(-1, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目发布
|
||||||
|
*
|
||||||
|
* @param prjId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public ElectromagneticResult<?> publish(String prjId) {
|
||||||
|
try {
|
||||||
|
LambdaUpdateWrapper<EdFileInfo> updateWrapper = Wrappers.lambdaUpdate(EdFileInfo.class)
|
||||||
|
.set(EdFileInfo::getDataStatus, EleDataStatusEnum.PUBLISHED.code)
|
||||||
|
.likeRight(EdFileInfo::getFilePath, prjId);
|
||||||
|
this.update(updateWrapper);
|
||||||
|
return ElectromagneticResultUtil.success(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
String info = "项目发布异常";
|
||||||
|
log.error(info, e);
|
||||||
|
throw new BizException(-1, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除子集
|
||||||
|
*
|
||||||
|
* @param fileId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ElectromagneticResult<?> deleteFolder(String fileId) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
// TODO是否需要判断文件夹是否为空
|
||||||
|
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
|
.select(EdFileInfo::getId, EdFileInfo::getFilePath)
|
||||||
|
.like(EdFileInfo::getFilePath, MYSQL_FILE_PATH_SPLIT + fileId + MYSQL_FILE_PATH_SPLIT)
|
||||||
|
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code);
|
||||||
|
List<EdFileInfo> edFileInfos = this.baseMapper.selectList(queryWrapper);
|
||||||
|
List<String> ids = edFileInfos.stream().map(EdFileInfo::getId).collect(Collectors.toList());
|
||||||
|
ids.add(fileId);
|
||||||
|
LambdaUpdateWrapper<EdFileInfo> updateWrapper = Wrappers.lambdaUpdate(EdFileInfo.class)
|
||||||
|
.set(EdFileInfo::getEffectFlag, EffectFlagEnum.NOT_EFFECTIVE.code)
|
||||||
|
.set(EdFileInfo::getSort, -1)
|
||||||
|
.in(EdFileInfo::getId, ids);
|
||||||
|
this.baseMapper.update(null, updateWrapper);
|
||||||
|
|
||||||
|
String[] tmpFileIds = edFileInfos.get(0).getFilePath().split(MYSQL_FILE_PATH_SPLIT);
|
||||||
|
String parentId = tmpFileIds[0];
|
||||||
|
for (String tmpPathId : tmpFileIds) {
|
||||||
|
parentId = this.baseMapper.maxPrjId();
|
||||||
|
if (fileId.equals(tmpPathId)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 同层级的resort
|
||||||
|
List<EdFileInfo> edFileInfos1 = this.baseMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
|
.select(EdFileInfo::getId, EdFileInfo::getSort)
|
||||||
|
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
||||||
|
.eq(EdFileInfo::getParentId, parentId)
|
||||||
|
.orderByAsc(EdFileInfo::getSort));
|
||||||
|
for (int i = 1; i <= edFileInfos1.size(); i++) {
|
||||||
|
String id = edFileInfos1.get(i).getId();
|
||||||
|
this.baseMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class)
|
||||||
|
.set(EdFileInfo::getSort, i)
|
||||||
|
.eq(EdFileInfo::getId, id));
|
||||||
|
}
|
||||||
|
return ElectromagneticResultUtil.success(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
String info = "删除子集异常";
|
||||||
|
log.error(info, e);
|
||||||
|
throw new BizException(-1, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 层级沿用
|
||||||
|
*
|
||||||
|
* @param sourceId
|
||||||
|
* @param targetId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ElectromagneticResult<?> follow(String sourceId, String targetId) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
String currentUserId = UserThreadLocal.getUserId();
|
||||||
|
// 把source工程的层级结构copy到目标工程
|
||||||
|
// 查找source的全部目录
|
||||||
|
List<EdFileInfo> sourceEdFileInfos = this.baseMapper.selectAllAdminFolder(sourceId);
|
||||||
|
List<EdFileInfo> targetEdFileInfos = this.baseMapper.selectAllAdminFolder(targetId);
|
||||||
|
// 确定层级最大为prjFolderMaxLength层,现在逐层来处理。
|
||||||
|
for (int i = 1; i <= prjFolderMaxLength; ++i) {
|
||||||
|
// 先查找source第i层下有那些子集
|
||||||
|
final int count = i;
|
||||||
|
EdFileInfo targetParentFile = targetEdFileInfos.stream()
|
||||||
|
.filter(e -> StrUtil.count(e.getFilePath(), MYSQL_FILE_PATH_SPLIT) == count - 1)
|
||||||
|
.collect(Collectors.toList()).get(0);
|
||||||
|
List<EdFileInfo> sourceTmpEdFiles = sourceEdFileInfos.stream()
|
||||||
|
.filter(e -> StrUtil.count(e.getFilePath(), MYSQL_FILE_PATH_SPLIT) == count)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
List<EdFileInfo> targetTmpEdFiles = targetEdFileInfos.stream()
|
||||||
|
.filter(e -> StrUtil.count(e.getFilePath(), MYSQL_FILE_PATH_SPLIT) == count)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
Map<String, EdFileInfo> sourceFileNameMap= sourceTmpEdFiles.stream().collect(Collectors.toMap(EdFileInfo::getFileName, e -> e));
|
||||||
|
List<String> targetFileNames = targetTmpEdFiles.stream().map(EdFileInfo::getFileName).collect(Collectors.toList());
|
||||||
|
for (EdFileInfo edFileInfo : sourceTmpEdFiles) {
|
||||||
|
String sourceFileName = edFileInfo.getFileName();
|
||||||
|
if (!targetFileNames.contains(sourceFileName)) {
|
||||||
|
EdFileInfo sourceFile = sourceFileNameMap.get(sourceFileName);
|
||||||
|
EdFileInfo targetFile = new EdFileInfo();
|
||||||
|
int maxFolderId = Integer.parseInt(this.baseMapper.maxPrjId());
|
||||||
|
String newFolderId = String.valueOf(maxFolderId + 1);
|
||||||
|
Date now = new Date();
|
||||||
|
targetFile.setId(newFolderId)
|
||||||
|
.setFileId(newFolderId)
|
||||||
|
.setFileName(sourceFile.getFileName())
|
||||||
|
.setFileVersion(100)
|
||||||
|
.setParentId(targetParentFile.getParentId())
|
||||||
|
.setFileTime(EleCommonUtil.getNowTimeStr())
|
||||||
|
.setDataType(EleDataTypeEnum.FOLDER.code)
|
||||||
|
.setDataStatus(EleDataStatusEnum.NOT_PUBLISHED.code)
|
||||||
|
.setEffectFlag(EffectFlagEnum.EFFECT.code)
|
||||||
|
.setSaveStatus(EleDataSaveStatusEnum.SUCCESS.code)
|
||||||
|
.setFilePath(targetParentFile.getFilePath() + MYSQL_FILE_PATH_SPLIT + newFolderId)
|
||||||
|
.setSort(targetTmpEdFiles.size() + 1)
|
||||||
|
.setCreatedTime(now)
|
||||||
|
.setUpdateTime(now)
|
||||||
|
.setCreatedBy(currentUserId)
|
||||||
|
.setUpdatedBy(currentUserId);
|
||||||
|
this.save(targetFile);
|
||||||
|
String targetSysFilePath = getSysFilePathByDbPath(targetFile.getFilePath()) + File.separator + sourceFileName;
|
||||||
|
fileSystemService.createDirectory(targetSysFilePath);
|
||||||
|
targetEdFileInfos = this.baseMapper.selectAllAdminFolder(targetId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ElectromagneticResultUtil.success(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
String info = StrFormatter.format("层级沿用失败");
|
||||||
|
log.error(info, e);
|
||||||
|
return ElectromagneticResultUtil.fail("-1", info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改子集名称
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @param newFolderName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ElectromagneticResult<?> modifyFolder(String id, String newFolderName) {
|
||||||
|
try {
|
||||||
|
EdFileInfo fileInfo = this.baseMapper.selectOne(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
|
.eq(EdFileInfo::getId, id));
|
||||||
|
String sysFilePath = getSysFilePathByDbPath(fileInfo.getFilePath());
|
||||||
|
this.baseMapper.update(null, Wrappers.lambdaUpdate(EdFileInfo.class)
|
||||||
|
.set(EdFileInfo::getFileName, newFolderName));
|
||||||
|
fileSystemService.renameFile(sysFilePath, newFolderName);
|
||||||
|
return ElectromagneticResultUtil.success(true);
|
||||||
|
} catch(Exception e) {
|
||||||
|
String info = StrFormatter.format("修改子集名称为{}失败", newFolderName);
|
||||||
|
log.error(info, e);
|
||||||
|
return ElectromagneticResultUtil.fail("-1", info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getSysFilePathByDbPath(String dbPath) {
|
||||||
|
ArrayList<String> paths = CollUtil.newArrayList(dbPath.split(MYSQL_FILE_PATH_SPLIT));
|
||||||
|
return getPath(paths);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getPath(List<String> ids) {
|
||||||
|
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
|
.select(EdFileInfo::getId, EdFileInfo::getFileName)
|
||||||
|
.in(EdFileInfo::getId, ids);
|
||||||
|
List<EdFileInfo> edFileInfos = this.baseMapper.selectList(queryWrapper);
|
||||||
|
Map<String, String> map = edFileInfos.stream().collect(Collectors.toMap(EdFileInfo::getId, EdFileInfo::getFileName));
|
||||||
|
StringBuilder path = new StringBuilder();
|
||||||
|
for (String id : ids) {
|
||||||
|
String tmp = map.get(id) + File.separator;
|
||||||
|
path.append(tmp);
|
||||||
|
}
|
||||||
|
return path.toString();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.electromagnetic.industry.software.manage.service.serviceimpl;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.FileUtil;
|
||||||
|
import com.electromagnetic.industry.software.manage.service.FileSystemService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class FileSystemServiceImpl implements FileSystemService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createDirectory(String path) {
|
||||||
|
FileUtil.mkdir(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void copyFile(String source, String destination) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void moveFile(String source, String destination) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void save(InputStream inputStream, String destination) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renameFile(String sourcePath, String newName) {
|
||||||
|
FileUtil.rename(new File(sourcePath), newName, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renameFile(String sourcePath, String oldName, String newName) {
|
||||||
|
File sourceFile = new File(sourcePath + File.separator + oldName);
|
||||||
|
FileUtil.rename(sourceFile, newName, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkFolderExist(String newPath) {
|
||||||
|
return FileUtil.exist(newPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -83,7 +83,7 @@ public class UserServiceImpl implements UserService {
|
||||||
public Boolean checkUserValid(User user) {
|
public Boolean checkUserValid(User user) {
|
||||||
if (user == null
|
if (user == null
|
||||||
|| user.getIsPublished() == PublishEnum.UNPUBLISHED.getCode()
|
|| user.getIsPublished() == PublishEnum.UNPUBLISHED.getCode()
|
||||||
|| user.getEffectFlag() == EffectFlagEnum.EFFECT_FLAG_0.getCode()
|
|| user.getEffectFlag() == EffectFlagEnum.NOT_EFFECTIVE.code
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
} else if (user.getInternshipEndDate() != null && user.getInternshipEndDate().before(now())) {
|
} else if (user.getInternshipEndDate() != null && user.getInternshipEndDate().before(now())) {
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,7 @@
|
||||||
#required
|
#required
|
||||||
spring.application.name=electromagnetic-data
|
spring.application.name=electromagnetic-data
|
||||||
# security
|
|
||||||
run.mode=NORMAL
|
|
||||||
com.alipay.env=shared
|
|
||||||
#log
|
|
||||||
logging.file.path=./logs
|
logging.file.path=./logs
|
||||||
loggerPath=electromagnetic-data
|
loggerPath=electromagnetic-data
|
||||||
logging.level.com.aliyun.fsi.insurance=${LOG_LEVEL:INFO}
|
|
||||||
#日志配置
|
|
||||||
logging.config=classpath:${LOG_CONFIG:log4j2-spring.xml}
|
|
||||||
spring.datasource.typd=com.alibaba.druid.pool.DruidDataSource
|
spring.datasource.typd=com.alibaba.druid.pool.DruidDataSource
|
||||||
spring.datasource.url=jdbc:mysql://139.224.43.89:3306/em_data?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true&rewriteBatchedStatements=true
|
spring.datasource.url=jdbc:mysql://139.224.43.89:3306/em_data?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true&rewriteBatchedStatements=true
|
||||||
spring.datasource.username=comac
|
spring.datasource.username=comac
|
||||||
|
|
@ -21,21 +14,9 @@ mybatis-plus.mapper-locations=classpath:sqlmapper/*.xml
|
||||||
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
|
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
pagehelper.helperDialect=mysql
|
pagehelper.helperDialect=mysql
|
||||||
pagehelper.reasonable=false
|
pagehelper.reasonable=false
|
||||||
server.port=8888
|
server.port=12395
|
||||||
#windows文件存储目录
|
#windows文件存储目录,用于测试
|
||||||
data.windows.path=E:/comacFileStorage/
|
data.windows.path=E:/tmp/eleData/
|
||||||
#文件缓存路径
|
data.linux.path=/szsd/data/eleData
|
||||||
data.file.cache.dir=/szsd/cache/
|
prj.folder.max.length=6
|
||||||
#文件存储路径
|
|
||||||
data.file.storage.dir=/szsd/fileStorage/
|
|
||||||
#上传文件时文件的缓存文件夹名称
|
|
||||||
data.upload.cache.dir=upload
|
|
||||||
#导出数据时文件的缓存文件夹名称
|
|
||||||
data.export.cache.dir=export
|
|
||||||
#导入数据时文件的缓存文件夹名称
|
|
||||||
data.import.cache.dir=import
|
|
||||||
file.encode.passwd=adknfhkj87654knd
|
|
||||||
#数据类型中的文件类型为file
|
|
||||||
data.type.file=file
|
|
||||||
#数据类型中的文件夹类型为folder
|
|
||||||
data.type.folder=folder
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
log4j.rootLogger=DEBUG, stdout
|
|
||||||
# Console output...
|
|
||||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
|
||||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
|
||||||
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n
|
|
||||||
|
|
@ -1,206 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Configuration>
|
|
||||||
<properties>
|
|
||||||
<property name="LOG_LEVEL" value="INFO"/>
|
|
||||||
<property name="APP_NAME" value="electromagnetic-data"/>
|
|
||||||
<property name="LOG_HOME" value="./logs/${APP_NAME}"/>
|
|
||||||
<property name="LOG_LAYOUT"
|
|
||||||
value="%d{yyyy-MM-dd HH:mm:ss.SSS},%t,%r,%-5p,%X{SOFA-TraceId},%X{SOFA-SpanId},%c{2},%m%n%throwable"/>
|
|
||||||
<property name="SIMPLE_LAYOUT" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %m%n%"/>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<Appenders>
|
|
||||||
<Console name="STDOUT-APPENDER" target="SYSTEM_OUT">
|
|
||||||
<PatternLayout pattern="${LOG_LAYOUT}" charset="UTF-8"/>
|
|
||||||
</Console>
|
|
||||||
<Console name="STDERR-APPENDER" target="SYSTEM_ERR">
|
|
||||||
<PatternLayout pattern="${LOG_LAYOUT}" charset="UTF-8"/>
|
|
||||||
</Console>
|
|
||||||
|
|
||||||
<!-- 错误节点日志 -->
|
|
||||||
<RollingFile name="ERROR-APPENDER" fileName="${LOG_HOME}/common-error.log"
|
|
||||||
filePattern="${LOG_HOME}/common-error-%d{yyyy-MM-dd}_%i.log" append="true">
|
|
||||||
<Filters>
|
|
||||||
<ThresholdFilter level="ERROR" onMatch="ACCEPT" onMismatch="DENY"/>
|
|
||||||
</Filters>
|
|
||||||
<PatternLayout pattern="${LOG_LAYOUT}" charset="UTF-8"/>
|
|
||||||
<Policies>
|
|
||||||
<SizeBasedTriggeringPolicy size="500MB"/>
|
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
|
||||||
</Policies>
|
|
||||||
<DefaultRolloverStrategy max="300">
|
|
||||||
<Delete basePath="${LOG_HOME}" maxDepth="1">
|
|
||||||
<IfLastModified age="15d"/>
|
|
||||||
<IfFileName glob="${LOG_HOME}*.log"/>
|
|
||||||
</Delete>
|
|
||||||
</DefaultRolloverStrategy>
|
|
||||||
</RollingFile>
|
|
||||||
|
|
||||||
<!-- 业务日常节点日志-->
|
|
||||||
<RollingFile name="COMMON-APPENDER" fileName="${LOG_HOME}/common-default.log"
|
|
||||||
filePattern="${LOG_HOME}/common-default-%d{yyyy-MM-dd}_%i.log" append="true">
|
|
||||||
<PatternLayout pattern="${LOG_LAYOUT}" charset="UTF-8"/>
|
|
||||||
<Policies>
|
|
||||||
<SizeBasedTriggeringPolicy size="500MB"/>
|
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
|
||||||
</Policies>
|
|
||||||
<DefaultRolloverStrategy max="300">
|
|
||||||
<Delete basePath="${LOG_HOME}" maxDepth="1">
|
|
||||||
<IfLastModified age="15d"/>
|
|
||||||
<IfFileName glob="${LOG_HOME}*.log"/>
|
|
||||||
</Delete>
|
|
||||||
</DefaultRolloverStrategy>
|
|
||||||
</RollingFile>
|
|
||||||
<!-- 业务日常节点日志-->
|
|
||||||
<RollingFile name="DOMAIN-CALL-APPENDER" fileName="${LOG_HOME}/domain-call.log"
|
|
||||||
filePattern="${LOG_HOME}/domain-call-%d{yyyy-MM-dd}_%i.log" append="true">
|
|
||||||
<PatternLayout pattern="${SIMPLE_LAYOUT}" charset="UTF-8"/>
|
|
||||||
<Policies>
|
|
||||||
<SizeBasedTriggeringPolicy size="500MB"/>
|
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
|
||||||
</Policies>
|
|
||||||
<DefaultRolloverStrategy max="300">
|
|
||||||
<Delete basePath="${LOG_HOME}" maxDepth="1">
|
|
||||||
<IfLastModified age="15d"/>
|
|
||||||
<IfFileName glob="${LOG_HOME}*.log"/>
|
|
||||||
</Delete>
|
|
||||||
</DefaultRolloverStrategy>
|
|
||||||
</RollingFile>
|
|
||||||
<!-- 消息监听日志 -->
|
|
||||||
<RollingFile name="MSG-LISTEN-APPENDER" fileName="${LOG_HOME}/msg-listen.log"
|
|
||||||
filePattern="${LOG_HOME}/msg-listen-%d{yyyy-MM-dd}_%i.log" append="true">
|
|
||||||
<PatternLayout pattern="${LOG_LAYOUT}" charset="UTF-8"/>
|
|
||||||
<Policies>
|
|
||||||
<SizeBasedTriggeringPolicy size="500MB"/>
|
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
|
||||||
</Policies>
|
|
||||||
<DefaultRolloverStrategy max="300">
|
|
||||||
<Delete basePath="${LOG_HOME}" maxDepth="1">
|
|
||||||
<IfLastModified age="15d"/>
|
|
||||||
<IfFileName glob="${LOG_HOME}*.log"/>
|
|
||||||
</Delete>
|
|
||||||
</DefaultRolloverStrategy>
|
|
||||||
</RollingFile>
|
|
||||||
|
|
||||||
<!-- 异步任务日志 -->
|
|
||||||
<RollingFile name="TASK-SCHEDULER-APPENDER" fileName="${LOG_HOME}/task-scheduler.log"
|
|
||||||
filePattern="${LOG_HOME}/task-scheduler-%d{yyyy-MM-dd}_%i.log" append="true">
|
|
||||||
<PatternLayout pattern="${LOG_LAYOUT}" charset="UTF-8"/>
|
|
||||||
<Policies>
|
|
||||||
<SizeBasedTriggeringPolicy size="500MB"/>
|
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
|
||||||
</Policies>
|
|
||||||
<DefaultRolloverStrategy max="300">
|
|
||||||
<Delete basePath="${LOG_HOME}" maxDepth="1">
|
|
||||||
<IfLastModified age="15d"/>
|
|
||||||
<IfFileName glob="${LOG_HOME}*.log"/>
|
|
||||||
</Delete>
|
|
||||||
</DefaultRolloverStrategy>
|
|
||||||
</RollingFile>
|
|
||||||
|
|
||||||
<!-- SOFA日常节点日志 -->
|
|
||||||
<RollingFile name="SOFA-DEFAULT-APPENDER" fileName="${LOG_HOME}/sofa-default.log"
|
|
||||||
filePattern="${LOG_HOME}/sofa-default-%d{yyyy-MM-dd}_%i.log" append="true">
|
|
||||||
<PatternLayout pattern="${LOG_LAYOUT}" charset="UTF-8"/>
|
|
||||||
<Policies>
|
|
||||||
<SizeBasedTriggeringPolicy size="500MB"/>
|
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
|
||||||
</Policies>
|
|
||||||
<DefaultRolloverStrategy max="300">
|
|
||||||
<Delete basePath="${LOG_HOME}" maxDepth="1">
|
|
||||||
<IfLastModified age="15d"/>
|
|
||||||
<IfFileName glob="${LOG_HOME}*.log"/>
|
|
||||||
</Delete>
|
|
||||||
</DefaultRolloverStrategy>
|
|
||||||
</RollingFile>
|
|
||||||
|
|
||||||
<!-- 调用外部系统日志 -->
|
|
||||||
<RollingFile name="INTEGRATION-APPENDER" fileName="${LOG_HOME}/integration.log"
|
|
||||||
filePattern="${LOG_HOME}/integration-%d{yyyy-MM-dd}_%i.log" append="true">
|
|
||||||
<PatternLayout pattern="${LOG_LAYOUT}" charset="UTF-8"/>
|
|
||||||
<Policies>
|
|
||||||
<SizeBasedTriggeringPolicy size="500MB"/>
|
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
|
||||||
</Policies>
|
|
||||||
<DefaultRolloverStrategy max="300">
|
|
||||||
<Delete basePath="${LOG_HOME}" maxDepth="1">
|
|
||||||
<IfLastModified age="15d"/>
|
|
||||||
<IfFileName glob="${LOG_HOME}*.log"/>
|
|
||||||
</Delete>
|
|
||||||
</DefaultRolloverStrategy>
|
|
||||||
</RollingFile>
|
|
||||||
|
|
||||||
<RollingFile name="COMMON-MONITOR-APPENDER" fileName="${LOG_HOME}/common-monitor.log"
|
|
||||||
filePattern="${LOG_HOME}/common-monitor-%d{yyyy-MM-dd}_%i.log" append="true">
|
|
||||||
<PatternLayout pattern="${LOG_LAYOUT}" charset="UTF-8"/>
|
|
||||||
<Policies>
|
|
||||||
<SizeBasedTriggeringPolicy size="500MB"/>
|
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
|
||||||
</Policies>
|
|
||||||
<DefaultRolloverStrategy max="300">
|
|
||||||
<Delete basePath="${LOG_HOME}" maxDepth="1">
|
|
||||||
<IfLastModified age="15d"/>
|
|
||||||
<IfFileName glob="${LOG_HOME}*.log"/>
|
|
||||||
</Delete>
|
|
||||||
</DefaultRolloverStrategy>
|
|
||||||
</RollingFile>
|
|
||||||
</Appenders>
|
|
||||||
|
|
||||||
<Loggers>
|
|
||||||
<AsyncRoot includeLocation="true" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="COMMON-APPENDER"/>
|
|
||||||
</AsyncRoot>
|
|
||||||
|
|
||||||
<AsyncLogger name="com.alipay.sofa" additivity="false" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="SOFA-DEFAULT-APPENDER"/>
|
|
||||||
</AsyncLogger>
|
|
||||||
<AsyncLogger name="com.aliyun.fsi.insurance" additivity="false" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="COMMON-APPENDER"/>
|
|
||||||
</AsyncLogger>
|
|
||||||
|
|
||||||
<Logger name="INTEGRATION" additivity="false" includeLocation="true" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="INTEGRATION-APPENDER"/>
|
|
||||||
</Logger>
|
|
||||||
<Logger name="SERIOUS-ALERT" additivity="false" includeLocation="true" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="COMMON-APPENDER"/>
|
|
||||||
</Logger>
|
|
||||||
<Logger name="DOMAIN-ERROR" additivity="false" includeLocation="true" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="COMMON-APPENDER"/>
|
|
||||||
</Logger>
|
|
||||||
<Logger name="DOMAIN-DIGEST" additivity="false" includeLocation="true" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="COMMON-APPENDER"/>
|
|
||||||
</Logger>
|
|
||||||
<Logger name="DOMAIN-CALL" additivity="false" includeLocation="true" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="DOMAIN-CALL-APPENDER"/>
|
|
||||||
</Logger>
|
|
||||||
<Logger name="DOMAIN-SERVICE" additivity="false" includeLocation="true" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="COMMON-APPENDER"/>
|
|
||||||
</Logger>
|
|
||||||
<Logger name="TASK-SCHEDULER" additivity="false" includeLocation="true" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="TASK-SCHEDULER-APPENDER"/>
|
|
||||||
</Logger>
|
|
||||||
|
|
||||||
<Logger name="MSG-LISTEN" additivity="false" includeLocation="true" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="MSG-LISTEN-APPENDER"/>
|
|
||||||
</Logger>
|
|
||||||
<Logger name="AbstractMessageListenerXFlush" additivity="false" includeLocation="true" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="MSG-LISTEN-APPENDER"/>
|
|
||||||
</Logger>
|
|
||||||
<Logger name="COMMON-MONITOR" includeLocation="true" additivity="false" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="COMMON-MONITOR-APPENDER"/>
|
|
||||||
<AppenderRef ref="STDOUT-APPENDER"/>
|
|
||||||
</Logger>
|
|
||||||
</Loggers>
|
|
||||||
</Configuration>
|
|
||||||
|
|
@ -1,218 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Configuration>
|
|
||||||
<properties>
|
|
||||||
<property name="LOG_LEVEL" value="DEBUG"/>
|
|
||||||
<property name="APP_NAME" value="electromagnetic-data"/>
|
|
||||||
<property name="LOG_HOME" value="./logs/${APP_NAME}"/>
|
|
||||||
<property name="LOG_LAYOUT"
|
|
||||||
value="%d{yyyy-MM-dd HH:mm:ss.SSS},%t,%r,%-5p,%X{SOFA-TraceId},%X{SOFA-SpanId},%c{2},%m%n%throwable"/>
|
|
||||||
<property name="SIMPLE_LAYOUT" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %m%n%"/>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<Appenders>
|
|
||||||
<Console name="STDOUT-APPENDER" target="SYSTEM_OUT">
|
|
||||||
<PatternLayout pattern="${LOG_LAYOUT}" charset="UTF-8"/>
|
|
||||||
</Console>
|
|
||||||
<Console name="STDERR-APPENDER" target="SYSTEM_ERR">
|
|
||||||
<PatternLayout pattern="${LOG_LAYOUT}" charset="UTF-8"/>
|
|
||||||
</Console>
|
|
||||||
|
|
||||||
<!-- 错误节点日志 -->
|
|
||||||
<RollingFile name="ERROR-APPENDER" fileName="${LOG_HOME}/common-error.log"
|
|
||||||
filePattern="${LOG_HOME}/common-error-%d{yyyy-MM-dd}_%i.log" append="true">
|
|
||||||
<Filters>
|
|
||||||
<ThresholdFilter level="ERROR" onMatch="ACCEPT" onMismatch="DENY"/>
|
|
||||||
</Filters>
|
|
||||||
<PatternLayout pattern="${LOG_LAYOUT}" charset="UTF-8"/>
|
|
||||||
<Policies>
|
|
||||||
<SizeBasedTriggeringPolicy size="500MB"/>
|
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
|
||||||
</Policies>
|
|
||||||
<DefaultRolloverStrategy max="300">
|
|
||||||
<Delete basePath="${LOG_HOME}" maxDepth="1">
|
|
||||||
<IfLastModified age="15d"/>
|
|
||||||
<IfFileName glob="${LOG_HOME}*.log"/>
|
|
||||||
</Delete>
|
|
||||||
</DefaultRolloverStrategy>
|
|
||||||
</RollingFile>
|
|
||||||
|
|
||||||
<!-- 业务日常节点日志-->
|
|
||||||
<RollingFile name="COMMON-APPENDER" fileName="${LOG_HOME}/common-default.log"
|
|
||||||
filePattern="${LOG_HOME}/common-default-%d{yyyy-MM-dd}_%i.log" append="true">
|
|
||||||
<PatternLayout pattern="${LOG_LAYOUT}" charset="UTF-8"/>
|
|
||||||
<Policies>
|
|
||||||
<SizeBasedTriggeringPolicy size="500MB"/>
|
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
|
||||||
</Policies>
|
|
||||||
<DefaultRolloverStrategy max="300">
|
|
||||||
<Delete basePath="${LOG_HOME}" maxDepth="1">
|
|
||||||
<IfLastModified age="15d"/>
|
|
||||||
<IfFileName glob="${LOG_HOME}*.log"/>
|
|
||||||
</Delete>
|
|
||||||
</DefaultRolloverStrategy>
|
|
||||||
</RollingFile>
|
|
||||||
<!-- 业务日常节点日志-->
|
|
||||||
<RollingFile name="DOMAIN-CALL-APPENDER" fileName="${LOG_HOME}/domain-call.log"
|
|
||||||
filePattern="${LOG_HOME}/domain-call-%d{yyyy-MM-dd}_%i.log" append="true">
|
|
||||||
<PatternLayout pattern="${SIMPLE_LAYOUT}" charset="UTF-8"/>
|
|
||||||
<Policies>
|
|
||||||
<SizeBasedTriggeringPolicy size="500MB"/>
|
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
|
||||||
</Policies>
|
|
||||||
<DefaultRolloverStrategy max="300">
|
|
||||||
<Delete basePath="${LOG_HOME}" maxDepth="1">
|
|
||||||
<IfLastModified age="15d"/>
|
|
||||||
<IfFileName glob="${LOG_HOME}*.log"/>
|
|
||||||
</Delete>
|
|
||||||
</DefaultRolloverStrategy>
|
|
||||||
</RollingFile>
|
|
||||||
<!-- 消息监听日志 -->
|
|
||||||
<RollingFile name="MSG-LISTEN-APPENDER" fileName="${LOG_HOME}/msg-listen.log"
|
|
||||||
filePattern="${LOG_HOME}/msg-listen-%d{yyyy-MM-dd}_%i.log" append="true">
|
|
||||||
<PatternLayout pattern="${LOG_LAYOUT}" charset="UTF-8"/>
|
|
||||||
<Policies>
|
|
||||||
<SizeBasedTriggeringPolicy size="500MB"/>
|
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
|
||||||
</Policies>
|
|
||||||
<DefaultRolloverStrategy max="300">
|
|
||||||
<Delete basePath="${LOG_HOME}" maxDepth="1">
|
|
||||||
<IfLastModified age="15d"/>
|
|
||||||
<IfFileName glob="${LOG_HOME}*.log"/>
|
|
||||||
</Delete>
|
|
||||||
</DefaultRolloverStrategy>
|
|
||||||
</RollingFile>
|
|
||||||
|
|
||||||
<!-- 异步任务日志 -->
|
|
||||||
<RollingFile name="TASK-SCHEDULER-APPENDER" fileName="${LOG_HOME}/task-scheduler.log"
|
|
||||||
filePattern="${LOG_HOME}/task-scheduler-%d{yyyy-MM-dd}_%i.log" append="true">
|
|
||||||
<PatternLayout pattern="${LOG_LAYOUT}" charset="UTF-8"/>
|
|
||||||
<Policies>
|
|
||||||
<SizeBasedTriggeringPolicy size="500MB"/>
|
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
|
||||||
</Policies>
|
|
||||||
<DefaultRolloverStrategy max="300">
|
|
||||||
<Delete basePath="${LOG_HOME}" maxDepth="1">
|
|
||||||
<IfLastModified age="15d"/>
|
|
||||||
<IfFileName glob="${LOG_HOME}*.log"/>
|
|
||||||
</Delete>
|
|
||||||
</DefaultRolloverStrategy>
|
|
||||||
</RollingFile>
|
|
||||||
|
|
||||||
<!-- SOFA日常节点日志 -->
|
|
||||||
<RollingFile name="SOFA-DEFAULT-APPENDER" fileName="${LOG_HOME}/sofa-default.log"
|
|
||||||
filePattern="${LOG_HOME}/sofa-default-%d{yyyy-MM-dd}_%i.log" append="true">
|
|
||||||
<PatternLayout pattern="${LOG_LAYOUT}" charset="UTF-8"/>
|
|
||||||
<Policies>
|
|
||||||
<SizeBasedTriggeringPolicy size="500MB"/>
|
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
|
||||||
</Policies>
|
|
||||||
<DefaultRolloverStrategy max="300">
|
|
||||||
<Delete basePath="${LOG_HOME}" maxDepth="1">
|
|
||||||
<IfLastModified age="15d"/>
|
|
||||||
<IfFileName glob="${LOG_HOME}*.log"/>
|
|
||||||
</Delete>
|
|
||||||
</DefaultRolloverStrategy>
|
|
||||||
</RollingFile>
|
|
||||||
|
|
||||||
<!-- 调用外部系统日志 -->
|
|
||||||
<RollingFile name="INTEGRATION-APPENDER" fileName="${LOG_HOME}/integration.log"
|
|
||||||
filePattern="${LOG_HOME}/integration-%d{yyyy-MM-dd}_%i.log" append="true">
|
|
||||||
<PatternLayout pattern="${LOG_LAYOUT}" charset="UTF-8"/>
|
|
||||||
<Policies>
|
|
||||||
<SizeBasedTriggeringPolicy size="500MB"/>
|
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
|
||||||
</Policies>
|
|
||||||
<DefaultRolloverStrategy max="300">
|
|
||||||
<Delete basePath="${LOG_HOME}" maxDepth="1">
|
|
||||||
<IfLastModified age="15d"/>
|
|
||||||
<IfFileName glob="${LOG_HOME}*.log"/>
|
|
||||||
</Delete>
|
|
||||||
</DefaultRolloverStrategy>
|
|
||||||
</RollingFile>
|
|
||||||
|
|
||||||
<RollingFile name="COMMON-MONITOR-APPENDER" fileName="${LOG_HOME}/common-monitor.log"
|
|
||||||
filePattern="${LOG_HOME}/common-monitor-%d{yyyy-MM-dd}_%i.log" append="true">
|
|
||||||
<PatternLayout pattern="${LOG_LAYOUT}" charset="UTF-8"/>
|
|
||||||
<Policies>
|
|
||||||
<SizeBasedTriggeringPolicy size="500MB"/>
|
|
||||||
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
|
|
||||||
</Policies>
|
|
||||||
<DefaultRolloverStrategy max="300">
|
|
||||||
<Delete basePath="${LOG_HOME}" maxDepth="1">
|
|
||||||
<IfLastModified age="15d"/>
|
|
||||||
<IfFileName glob="${LOG_HOME}*.log"/>
|
|
||||||
</Delete>
|
|
||||||
</DefaultRolloverStrategy>
|
|
||||||
</RollingFile>
|
|
||||||
</Appenders>
|
|
||||||
|
|
||||||
<Loggers>
|
|
||||||
<AsyncRoot includeLocation="true" level="INFO">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="COMMON-APPENDER"/>
|
|
||||||
<AppenderRef ref="STDOUT-APPENDER"/>
|
|
||||||
</AsyncRoot>
|
|
||||||
|
|
||||||
<AsyncLogger name="com.alipay.sofa" additivity="false" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="SOFA-DEFAULT-APPENDER"/>
|
|
||||||
<AppenderRef ref="STDOUT-APPENDER"/>
|
|
||||||
</AsyncLogger>
|
|
||||||
<AsyncLogger name="com.aliyun.fsi.insurance" additivity="false" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="COMMON-APPENDER"/>
|
|
||||||
<AppenderRef ref="STDOUT-APPENDER"/>
|
|
||||||
</AsyncLogger>
|
|
||||||
|
|
||||||
<Logger name="INTEGRATION" includeLocation="true" additivity="false" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="INTEGRATION-APPENDER"/>
|
|
||||||
<AppenderRef ref="STDOUT-APPENDER"/>
|
|
||||||
</Logger>
|
|
||||||
<Logger name="SERIOUS-ALERT" includeLocation="true" additivity="false" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="COMMON-APPENDER"/>
|
|
||||||
<AppenderRef ref="STDERR-APPENDER"/>
|
|
||||||
</Logger>
|
|
||||||
<Logger name="DOMAIN-CALL" additivity="false" includeLocation="true" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="DOMAIN-CALL-APPENDER"/>
|
|
||||||
</Logger>
|
|
||||||
<Logger name="DOMAIN-ERROR" includeLocation="true" additivity="false" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="COMMON-APPENDER"/>
|
|
||||||
<AppenderRef ref="STDERR-APPENDER"/>
|
|
||||||
</Logger>
|
|
||||||
<Logger name="DOMAIN-DIGEST" includeLocation="true" additivity="false" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="COMMON-APPENDER"/>
|
|
||||||
<AppenderRef ref="STDOUT-APPENDER"/>
|
|
||||||
</Logger>
|
|
||||||
<Logger name="DOMAIN-SERVICE" includeLocation="true" additivity="false" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="COMMON-APPENDER"/>
|
|
||||||
<AppenderRef ref="STDOUT-APPENDER"/>
|
|
||||||
</Logger>
|
|
||||||
|
|
||||||
<Logger name="TASK-SCHEDULER" includeLocation="true" additivity="false" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="TASK-SCHEDULER-APPENDER"/>
|
|
||||||
<AppenderRef ref="STDOUT-APPENDER"/>
|
|
||||||
</Logger>
|
|
||||||
|
|
||||||
<Logger name="MSG-LISTEN" includeLocation="true" additivity="false" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="MSG-LISTEN-APPENDER"/>
|
|
||||||
<AppenderRef ref="STDOUT-APPENDER"/>
|
|
||||||
</Logger>
|
|
||||||
<Logger name="AbstractMessageListenerXFlush" includeLocation="true" additivity="false" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="MSG-LISTEN-APPENDER"/>
|
|
||||||
<AppenderRef ref="STDOUT-APPENDER"/>
|
|
||||||
</Logger>
|
|
||||||
<Logger name="COMMON-MONITOR" includeLocation="true" additivity="false" level="${LOG_LEVEL}">
|
|
||||||
<AppenderRef ref="ERROR-APPENDER"/>
|
|
||||||
<AppenderRef ref="COMMON-MONITOR-APPENDER"/>
|
|
||||||
<AppenderRef ref="STDOUT-APPENDER"/>
|
|
||||||
</Logger>
|
|
||||||
</Loggers>
|
|
||||||
</Configuration>
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="com.electromagnetic.industry.software.manage.mapper.EdFileInfoMapper">
|
||||||
|
|
||||||
|
<select id="maxPrjId" resultType="java.lang.String">
|
||||||
|
select max(id) from ed_file_info where length(id) = 6 and (parent_id is null or parent_id = "")
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectAllAdminFolder"
|
||||||
|
resultType="com.electromagnetic.industry.software.manage.pojo.models.EdFileInfo">
|
||||||
|
select id, file_name, parent_id, sort, file_path from ed_file_info where length(id) = 6 and effect_flag = 1 and data_type = 0
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
|
|
@ -39,6 +39,16 @@
|
||||||
<artifactId>hutool-all</artifactId>
|
<artifactId>hutool-all</artifactId>
|
||||||
<version>5.8.22</version>
|
<version>5.8.22</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-classic</artifactId>
|
||||||
|
<version>1.2.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-core</artifactId>
|
||||||
|
<version>1.2.3</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -4,4 +4,6 @@ public interface ElectromagneticConstants {
|
||||||
|
|
||||||
String EXPORT_FILE_SUFFIX = ".colib";
|
String EXPORT_FILE_SUFFIX = ".colib";
|
||||||
|
|
||||||
|
String MYSQL_FILE_PATH_SPLIT = "_";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,18 +10,16 @@ import lombok.Getter;
|
||||||
* @version $Id: EffectFlagEnum.java, v 0.1 2024-08-01 18:18
|
* @version $Id: EffectFlagEnum.java, v 0.1 2024-08-01 18:18
|
||||||
*/
|
*/
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Getter
|
|
||||||
public enum EffectFlagEnum {
|
public enum EffectFlagEnum {
|
||||||
/**
|
/**
|
||||||
* 有效
|
* 有效
|
||||||
*/
|
*/
|
||||||
EFFECT_FLAG_1(1, "有效"),
|
EFFECT(1, "有效"),
|
||||||
/**
|
/**
|
||||||
* 无效
|
* 无效
|
||||||
*/
|
*/
|
||||||
EFFECT_FLAG_0(0, "无效"),
|
NOT_EFFECTIVE(0, "无效");
|
||||||
;
|
public Integer code;
|
||||||
private Integer code;
|
public String desc;
|
||||||
private String desc;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.electromagnetic.industry.software.common.enums;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum EleDataSaveStatusEnum {
|
||||||
|
|
||||||
|
UPLOADING(0, "上传中"),
|
||||||
|
SUCCESS(1, "上传成功"),
|
||||||
|
FAIL(2, "上传失败");
|
||||||
|
|
||||||
|
public int code;
|
||||||
|
public String des;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.electromagnetic.industry.software.common.enums;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum EleDataStatusEnum {
|
||||||
|
|
||||||
|
NOT_PUBLISHED(0, "未发布"),
|
||||||
|
PUBLISHED(1, "已发布"),
|
||||||
|
OCCUPY(2, "占用");
|
||||||
|
|
||||||
|
public int code;
|
||||||
|
public String desc;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.electromagnetic.industry.software.common.enums;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum EleDataTypeEnum {
|
||||||
|
|
||||||
|
FILE(0, "文件夹"),
|
||||||
|
FOLDER(1, "普通文件");
|
||||||
|
|
||||||
|
public int code;
|
||||||
|
public String desc;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.electromagnetic.industry.software.common.exception;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class BizException extends RuntimeException {
|
||||||
|
|
||||||
|
private int code;
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.electromagnetic.industry.software.common.util;
|
package com.electromagnetic.industry.software.common.util;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public final class EleCommonUtil {
|
public final class EleCommonUtil {
|
||||||
|
|
@ -7,6 +9,8 @@ public final class EleCommonUtil {
|
||||||
// 正则表达式模式,匹配中文字符、下划线、连字符、加号、数字和英文字符
|
// 正则表达式模式,匹配中文字符、下划线、连字符、加号、数字和英文字符
|
||||||
private static final String PATTERN = "^[\\u4e00-\\u9fa5a-zA-Z0-9._\\-+]+$";
|
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 Pattern pattern = Pattern.compile(PATTERN);
|
||||||
|
|
||||||
|
|
@ -37,4 +41,13 @@ public final class EleCommonUtil {
|
||||||
return pattern.matcher(fileFullName).matches();
|
return pattern.matcher(fileFullName).matches();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getNowTimeStr() {
|
||||||
|
// 获取当前时间
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
// 创建日期时间格式化器
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(TIME_FORMAT1);
|
||||||
|
// 格式化当前时间
|
||||||
|
return now.format(formatter);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.electromagnetic.industry.software.common.util;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
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