reformat code

This commit is contained in:
chenxudong 2024-12-13 16:12:27 +08:00
parent 7360a4d1fa
commit 4ad81053fb
38 changed files with 586 additions and 494 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>

View File

@ -18,7 +18,6 @@ public class WebMvcConfig implements WebMvcConfigurer {
private LoginInterceptor loginInterceptor; private LoginInterceptor loginInterceptor;
/** /**
*
* @param registry registry * @param registry registry
*/ */
@Override @Override

View File

@ -1,6 +1,6 @@
package com.electromagnetic.industry.software.manage.controller; package com.electromagnetic.industry.software.manage.controller;
import com.electromagnetic.industry.software.common.resp.*; import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
import com.electromagnetic.industry.software.manage.pojo.req.EDDataRequest; import com.electromagnetic.industry.software.manage.pojo.req.EDDataRequest;
import com.electromagnetic.industry.software.manage.pojo.req.FileChunkDTO; import com.electromagnetic.industry.software.manage.pojo.req.FileChunkDTO;
import com.electromagnetic.industry.software.manage.service.EDDataService; import com.electromagnetic.industry.software.manage.service.EDDataService;

View File

@ -11,30 +11,35 @@ public interface CategoryMapper extends BaseMapper<Category> {
/** /**
* 获取顶级节点 * 获取顶级节点
*
* @return * @return
*/ */
List<Category> selectTopCategories(); List<Category> selectTopCategories();
/** /**
* 获取所有节点 * 获取所有节点
*
* @return * @return
*/ */
List<Category> selectAllCategories(); List<Category> selectAllCategories();
/** /**
* 获取节点通过编码ID * 获取节点通过编码ID
*
* @return * @return
*/ */
List<Category> selectCategories(Category category); List<Category> selectCategories(Category category);
/** /**
* 获取子节点通过父ID * 获取子节点通过父ID
*
* @return * @return
*/ */
List<Category> selectChildCategories(Category category); List<Category> selectChildCategories(Category category);
/** /**
* 创建目录树节点数据 * 创建目录树节点数据
*
* @return * @return
*/ */
Boolean createCategory(Category category); Boolean createCategory(Category category);

View File

@ -12,6 +12,7 @@ import java.util.List;
public interface EDDataMapper extends BaseMapper<EDDataInfo> { public interface EDDataMapper extends BaseMapper<EDDataInfo> {
/** /**
* 创建文件/文件夹数据信息 * 创建文件/文件夹数据信息
*
* @param edDataInfo * @param edDataInfo
* @return * @return
*/ */
@ -19,6 +20,7 @@ public interface EDDataMapper extends BaseMapper<EDDataInfo> {
/** /**
* 获取文件信息列表 * 获取文件信息列表
*
* @param parames * @param parames
* @return * @return
*/ */
@ -26,6 +28,7 @@ public interface EDDataMapper extends BaseMapper<EDDataInfo> {
/** /**
* 更新文件信息 * 更新文件信息
*
* @param parames * @param parames
* @return * @return
*/ */

View File

@ -15,18 +15,23 @@ public interface EDDataMappers {
/** /**
* 文件数据扩展模型入参转换 * 文件数据扩展模型入参转换
*
* @param request * @param request
* @return * @return
*/ */
EDDataParams getEDDataParames(EDDataRequest request); EDDataParams getEDDataParames(EDDataRequest request);
/** /**
* 文件数据扩展模型入参转换 * 文件数据扩展模型入参转换
*
* @param request * @param request
* @return * @return
*/ */
EDDataInfo getEDDataInfo(EDDataRequest request); EDDataInfo getEDDataInfo(EDDataRequest request);
/** /**
* 指标卡扩展模型返回 * 指标卡扩展模型返回
*
* @param edDataPage * @param edDataPage
* @return * @return
*/ */

View File

@ -9,6 +9,7 @@ public interface TokenMapper extends BaseMapper<Token> {
/** /**
* 插入 * 插入
*
* @param token * @param token
* @return * @return
*/ */
@ -16,6 +17,7 @@ public interface TokenMapper extends BaseMapper<Token> {
/** /**
* 查询 * 查询
*
* @param token * @param token
* @return Token * @return Token
*/ */
@ -23,6 +25,7 @@ public interface TokenMapper extends BaseMapper<Token> {
/** /**
* 删除token * 删除token
*
* @param token * @param token
* @return * @return
*/ */

View File

@ -13,6 +13,7 @@ public interface UserMapper {
/** /**
* 插入 * 插入
*
* @param user * @param user
* @return * @return
*/ */
@ -20,6 +21,7 @@ public interface UserMapper {
/** /**
* 编辑 * 编辑
*
* @param user * @param user
* @return * @return
*/ */
@ -27,6 +29,7 @@ public interface UserMapper {
/** /**
* 发布 * 发布
*
* @param publishParam * @param publishParam
* @return * @return
*/ */
@ -34,6 +37,7 @@ public interface UserMapper {
/** /**
* 通过工号查询用户 * 通过工号查询用户
*
* @param workNumber * @param workNumber
* @return * @return
*/ */
@ -41,6 +45,7 @@ public interface UserMapper {
/** /**
* 通过用户编码查询用户 * 通过用户编码查询用户
*
* @param userId * @param userId
* @return * @return
*/ */
@ -48,6 +53,7 @@ public interface UserMapper {
/** /**
* 通过用户编码查询用户 * 通过用户编码查询用户
*
* @param searchKeywords * @param searchKeywords
* @return * @return
*/ */
@ -55,6 +61,7 @@ public interface UserMapper {
/** /**
* 查询数据总条目数 * 查询数据总条目数
*
* @param searchKeywords * @param searchKeywords
* @return * @return
*/ */
@ -62,6 +69,7 @@ public interface UserMapper {
/** /**
* 通过用户ID删除用户 * 通过用户ID删除用户
*
* @param userId * @param userId
* @return * @return
*/ */

View File

@ -18,6 +18,7 @@ public interface UserMappers {
/** /**
* 用户Request转用户模型 * 用户Request转用户模型
*
* @param userRequest * @param userRequest
* @return * @return
*/ */
@ -25,6 +26,7 @@ public interface UserMappers {
/** /**
* 用户登录Request转用户登录模型 * 用户登录Request转用户登录模型
*
* @param loginRequest * @param loginRequest
* @return * @return
*/ */
@ -32,6 +34,7 @@ public interface UserMappers {
/** /**
* 获取单条用户信息Request转用户模型 * 获取单条用户信息Request转用户模型
*
* @param user * @param user
* @return * @return
*/ */
@ -40,6 +43,7 @@ public interface UserMappers {
/** /**
* 用户发布request转用户发布参数模型 * 用户发布request转用户发布参数模型
*
* @param userPublishRequest * @param userPublishRequest
* @return * @return
*/ */
@ -47,6 +51,7 @@ public interface UserMappers {
/** /**
* 获取单条用户信息Request转用户模型 * 获取单条用户信息Request转用户模型
*
* @param searchUserRequest * @param searchUserRequest
* @return * @return
*/ */
@ -54,6 +59,7 @@ public interface UserMappers {
/** /**
* 获取用户列表转response列表 * 获取用户列表转response列表
*
* @param users * @param users
* @return * @return
*/ */
@ -61,6 +67,7 @@ public interface UserMappers {
/** /**
* 编辑用户Request转用户模型 * 编辑用户Request转用户模型
*
* @param userModiRequest * @param userModiRequest
* @return * @return
*/ */
@ -68,6 +75,7 @@ public interface UserMappers {
/** /**
* 校验工号唯一性Request转用户模型 * 校验工号唯一性Request转用户模型
*
* @param userWorkNumRequest * @param userWorkNumRequest
* @return * @return
*/ */
@ -75,6 +83,7 @@ public interface UserMappers {
/** /**
* 删除单条用户信息Request转用户模型 * 删除单条用户信息Request转用户模型
*
* @param userDeleteRequest * @param userDeleteRequest
* @return * @return
*/ */

View File

@ -8,6 +8,7 @@ import java.io.Serializable;
/** /**
* 分页综合返回 * 分页综合返回
*
* @author * @author
* @version $Id: IndicatorCardPage.java, v 0.1 2024-08-14 17:30 * @version $Id: IndicatorCardPage.java, v 0.1 2024-08-14 17:30
*/ */

View File

@ -16,6 +16,7 @@ import java.util.Map;
public interface EDDataService { public interface EDDataService {
/** /**
* 创建文件夹 * 创建文件夹
*
* @param request * @param request
* @return * @return
*/ */
@ -24,6 +25,7 @@ public interface EDDataService {
/** /**
* 获取文件信息列表 * 获取文件信息列表
*
* @param request * @param request
* @return * @return
*/ */
@ -31,6 +33,7 @@ public interface EDDataService {
/** /**
* 更新文件信息 * 更新文件信息
*
* @param request * @param request
* @return * @return
*/ */
@ -38,6 +41,7 @@ public interface EDDataService {
/** /**
* 获取子文件数量 * 获取子文件数量
*
* @param request * @param request
* @return * @return
*/ */
@ -45,6 +49,7 @@ public interface EDDataService {
/** /**
* 上传 * 上传
*
* @param request * @param request
* @return * @return
*/ */
@ -60,6 +65,7 @@ public interface EDDataService {
/** /**
* 导出数据 * 导出数据
*
* @param dataIdArr * @param dataIdArr
* @return * @return
*/ */
@ -67,6 +73,7 @@ public interface EDDataService {
/** /**
* 导入数据 * 导入数据
*
* @param fileChunkDTO * @param fileChunkDTO
* @return * @return
*/ */
@ -74,6 +81,7 @@ public interface EDDataService {
/** /**
* 获取已经上传的分片 * 获取已经上传的分片
*
* @param identifier * @param identifier
* @return * @return
*/ */
@ -82,6 +90,7 @@ public interface EDDataService {
/** /**
* 合并分片 * 合并分片
*
* @param identifier * @param identifier
* @param fileName * @param fileName
* @param totalChunks * @param totalChunks
@ -92,6 +101,7 @@ public interface EDDataService {
/** /**
* 检查分片是否存在 * 检查分片是否存在
*
* @param fileChunkDTO * @param fileChunkDTO
* @return * @return
*/ */

View File

@ -8,6 +8,7 @@ public interface TokenService {
/** /**
* 创建令牌 * 创建令牌
*
* @param loginInfo * @param loginInfo
* @return 令牌 * @return 令牌
*/ */
@ -15,6 +16,7 @@ public interface TokenService {
/** /**
* 创建用户令牌 * 创建用户令牌
*
* @param user * @param user
* @param tokenStr * @param tokenStr
* @return * @return

View File

@ -7,6 +7,7 @@ public interface UserService {
/** /**
* 用户登录 * 用户登录
*
* @param loginRequest * @param loginRequest
* @return * @return
*/ */
@ -14,6 +15,7 @@ public interface UserService {
/** /**
* 新增用户信息 * 新增用户信息
*
* @param userRequest * @param userRequest
* @return * @return
*/ */
@ -21,6 +23,7 @@ public interface UserService {
/** /**
* 编辑用户信息 * 编辑用户信息
*
* @param userModiRequest * @param userModiRequest
* @return * @return
*/ */
@ -29,6 +32,7 @@ public interface UserService {
/** /**
* 发布用户 * 发布用户
*
* @param userPublishRequest * @param userPublishRequest
* @return * @return
*/ */
@ -36,6 +40,7 @@ public interface UserService {
/** /**
* 校验工号唯一性 * 校验工号唯一性
*
* @param workNumberRequest * @param workNumberRequest
* @return * @return
*/ */
@ -43,6 +48,7 @@ public interface UserService {
/** /**
* 通过用户编码获取单条用户信息 * 通过用户编码获取单条用户信息
*
* @param getSingleUserRequest * @param getSingleUserRequest
* @return * @return
*/ */
@ -50,6 +56,7 @@ public interface UserService {
/** /**
* 查询用户信息 * 查询用户信息
*
* @param searchUserRequest * @param searchUserRequest
* @return * @return
*/ */
@ -57,6 +64,7 @@ public interface UserService {
/** /**
* 刪除用戶逻辑删除 * 刪除用戶逻辑删除
*
* @param userDeleteRequest * @param userDeleteRequest
* @return * @return
*/ */
@ -64,6 +72,7 @@ public interface UserService {
/** /**
* 用户登出 * 用户登出
*
* @param token * @param token
* @return * @return
*/ */

View File

@ -39,6 +39,7 @@ public class CategoryServiceImpl implements CategoryService {
/** /**
* 递归列表 * 递归列表
*
* @param list * @param list
* @param category * @param category
*/ */
@ -54,6 +55,7 @@ public class CategoryServiceImpl implements CategoryService {
/** /**
* 得到子节点列表 * 得到子节点列表
*
* @param list * @param list
* @param category * @param category
* @return * @return
@ -72,6 +74,7 @@ public class CategoryServiceImpl implements CategoryService {
/** /**
* 判断是否有子节点 * 判断是否有子节点
*
* @param list * @param list
* @param category * @param category
* @return * @return

View File

@ -56,27 +56,23 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public class EDDataServiceImpl implements EDDataService { public class EDDataServiceImpl implements EDDataService {
private static final String UPLOAD_FILE_CHUNK_SUFFIX = ".part";
// 文件夹名称分隔符
private static final String FOLDER_NAME_SEPARATOR = "_";
@Resource @Resource
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}")
@ -88,11 +84,6 @@ public class EDDataServiceImpl implements EDDataService {
@Value("${data.type.file}") @Value("${data.type.file}")
private String dataTypeFile; private String dataTypeFile;
private static final String UPLOAD_FILE_CHUNK_SUFFIX = ".part";
// 文件夹名称分隔符
private static final String FOLDER_NAME_SEPARATOR = "_";
@Override @Override
public ElectromagneticResult<Boolean> createFolder(EDDataRequest request) { public ElectromagneticResult<Boolean> createFolder(EDDataRequest request) {
@ -123,8 +114,7 @@ public class EDDataServiceImpl implements EDDataService {
} }
public Boolean createDataInfo(EDDataInfo edDataInfo) throws Exception public Boolean createDataInfo(EDDataInfo edDataInfo) throws Exception {
{
// 获取上级目录的名称 // 获取上级目录的名称
String fileName = edDataInfo.getDataName(); String fileName = edDataInfo.getDataName();
Assert.isTrue(EleCommonUtil.isFileNameValid(fileName), "文件名不符合规范只能包含中文字符、下划线、连字符、加号、数字和英文字符且长度小于32。"); Assert.isTrue(EleCommonUtil.isFileNameValid(fileName), "文件名不符合规范只能包含中文字符、下划线、连字符、加号、数字和英文字符且长度小于32。");
@ -135,9 +125,7 @@ public class EDDataServiceImpl implements EDDataService {
if (categoryParentList.size() < 1) { if (categoryParentList.size() < 1) {
throw new Exception("上级文件夹不存在"); throw new Exception("上级文件夹不存在");
} } else {
else
{
// 获取新文件夹路径信息 // 获取新文件夹路径信息
categoryParent = categoryParentList.get(0); categoryParent = categoryParentList.get(0);
@ -149,8 +137,7 @@ public class EDDataServiceImpl implements EDDataService {
EDDataParams folderParames = new EDDataParams(); EDDataParams folderParames = new EDDataParams();
folderParames.setParentId(edDataInfo.getCategoryId()); folderParames.setParentId(edDataInfo.getCategoryId());
List<EDDataInfo> childFileInfoList = edDataMapper.getDataInfoList(folderParames); List<EDDataInfo> childFileInfoList = edDataMapper.getDataInfoList(folderParames);
for(EDDataInfo fileInfo : childFileInfoList) for (EDDataInfo fileInfo : childFileInfoList) {
{
if (fileInfo.getDataName().equals(edDataInfo.getDataName())) { if (fileInfo.getDataName().equals(edDataInfo.getDataName())) {
throw new Exception("文件夹已存在"); throw new Exception("文件夹已存在");
} }
@ -169,6 +156,7 @@ public class EDDataServiceImpl implements EDDataService {
/** /**
* 获取数据存储目录 * 获取数据存储目录
*
* @return * @return
*/ */
public String getDataStoragePath() { public String getDataStoragePath() {
@ -287,13 +275,10 @@ public class EDDataServiceImpl implements EDDataService {
List<EDDataInfo> edDataInfoList = edDataMapper.getDataInfoList(parames); List<EDDataInfo> edDataInfoList = edDataMapper.getDataInfoList(parames);
parames.setDataId(null); parames.setDataId(null);
for (EDDataInfo edDataInfo : edDataInfoList) { for (EDDataInfo edDataInfo : edDataInfoList) {
if(edDataInfo.getDataType().equals(dataTypeFolder)) if (edDataInfo.getDataType().equals(dataTypeFolder)) {
{
parames.setParentId(edDataInfo.getDataId()); parames.setParentId(edDataInfo.getDataId());
childFileCount += getChildFileCount(parames); childFileCount += getChildFileCount(parames);
} } else if (edDataInfo.getDataType().equals(dataTypeFile) && edDataInfo.getEffectFlag().equals(1)) {
else if(edDataInfo.getDataType().equals(dataTypeFile) && edDataInfo.getEffectFlag().equals(1))
{
++childFileCount; ++childFileCount;
} }
} }
@ -337,8 +322,7 @@ public class EDDataServiceImpl implements EDDataService {
EDDataParams folderParames = new EDDataParams(); EDDataParams folderParames = new EDDataParams();
folderParames.setParentId(categoryId); folderParames.setParentId(categoryId);
List<EDDataInfo> childFileInfoList = edDataMapper.getDataInfoList(folderParames); List<EDDataInfo> childFileInfoList = edDataMapper.getDataInfoList(folderParames);
for(EDDataInfo fileInfo : childFileInfoList) for (EDDataInfo fileInfo : childFileInfoList) {
{
if (fileInfo.getDataName().equals(fileFullName)) { if (fileInfo.getDataName().equals(fileFullName)) {
throw new Exception("上传的文件已存在"); throw new Exception("上传的文件已存在");
} }
@ -408,15 +392,12 @@ public class EDDataServiceImpl implements EDDataService {
fileParames.setDataId(edDataInfo.getDataId()); fileParames.setDataId(edDataInfo.getDataId());
if(fileInput.getSize() == saveFile.length()) if (fileInput.getSize() == saveFile.length()) {
{
Path source = Paths.get(fileCacheFullPath); Path source = Paths.get(fileCacheFullPath);
Path target = Paths.get(fileSaveFullPath); Path target = Paths.get(fileSaveFullPath);
Files.move(source, target); Files.move(source, target);
fileParames.setSaveStatus("success"); fileParames.setSaveStatus("success");
} } else {
else
{
saveFile.delete(); saveFile.delete();
fileParames.setSaveStatus("failure"); fileParames.setSaveStatus("failure");
} }
@ -439,6 +420,7 @@ public class EDDataServiceImpl implements EDDataService {
/** /**
* 获取时间戳字符串 * 获取时间戳字符串
*
* @return * @return
*/ */
public String getTimeStampString() { public String getTimeStampString() {
@ -448,6 +430,7 @@ public class EDDataServiceImpl implements EDDataService {
/** /**
* 获取数据缓存目录 * 获取数据缓存目录
*
* @return * @return
*/ */
public String getDataCachePath() { public String getDataCachePath() {
@ -486,8 +469,7 @@ public class EDDataServiceImpl implements EDDataService {
.body(new InputStreamResource(fileSystemResource.getInputStream())); .body(new InputStreamResource(fileSystemResource.getInputStream()));
} }
private String getFilePathOfFolder1(String categoryId) private String getFilePathOfFolder1(String categoryId) {
{
String filePathOfFolder = ""; //文件存放在文件夹的路径 String filePathOfFolder = ""; //文件存放在文件夹的路径
String categoryIdHighest = categoryId; //最高级的目录编码 String categoryIdHighest = categoryId; //最高级的目录编码
@ -660,11 +642,9 @@ public class EDDataServiceImpl implements EDDataService {
} }
log.info("目录树数据+文件数据已成功复制到目标目录。" + enCodeZipPathFileName); log.info("目录树数据+文件数据已成功复制到目标目录。" + enCodeZipPathFileName);
} } catch (Exception e) {
catch (Exception e) {
log.error("导出数据异常..", e); log.error("导出数据异常..", e);
} } finally {
finally {
// 删除 导出数据的 缓存目录 // 删除 导出数据的 缓存目录
FileUtil.del(exportDataCachePath); FileUtil.del(exportDataCachePath);
} }
@ -874,8 +854,7 @@ public class EDDataServiceImpl implements EDDataService {
&& FileUtil.exist(importFileCachePath) && FileUtil.exist(importFileCachePath)
&& FileUtil.exist(importFileCacheFullPath) && FileUtil.exist(importFileCacheFullPath)
&& !FileUtil.exist(fileStorageFullPath) && !FileUtil.exist(fileStorageFullPath)
) ) {
{
if (fileInfo.getDataType().equals(dataTypeFolder)) { if (fileInfo.getDataType().equals(dataTypeFolder)) {
if (!FileUtil.exist(fileStorageFullPath)) { if (!FileUtil.exist(fileStorageFullPath)) {
FileUtil.mkdir(fileStorageFullPath); FileUtil.mkdir(fileStorageFullPath);
@ -887,9 +866,7 @@ public class EDDataServiceImpl implements EDDataService {
} }
importFileSuccess.add(fileInfo.getDataId() + FOLDER_NAME_SEPARATOR + fileInfo.getDataName()); importFileSuccess.add(fileInfo.getDataId() + FOLDER_NAME_SEPARATOR + fileInfo.getDataName());
} } else {
else
{
importFileFail.add(fileInfo.getDataId() + FOLDER_NAME_SEPARATOR + fileInfo.getDataName()); importFileFail.add(fileInfo.getDataId() + FOLDER_NAME_SEPARATOR + fileInfo.getDataName());
} }
} }

View File

@ -28,7 +28,6 @@ import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -45,6 +44,7 @@ public class UserServiceImpl implements UserService {
/** /**
* 用户登录 * 用户登录
*
* @param loginRequest * @param loginRequest
* @return * @return
*/ */
@ -106,6 +106,7 @@ public class UserServiceImpl implements UserService {
/** /**
* 新增用户信息 * 新增用户信息
*
* @param userRequest * @param userRequest
* @return * @return
*/ */
@ -124,6 +125,7 @@ public class UserServiceImpl implements UserService {
/** /**
* 修改用户信息 * 修改用户信息
*
* @param userModiRequest * @param userModiRequest
* @return * @return
*/ */
@ -137,6 +139,7 @@ public class UserServiceImpl implements UserService {
/** /**
* 发布用户信息 * 发布用户信息
*
* @param userPublishRequest * @param userPublishRequest
* @return * @return
*/ */

View File

@ -9,15 +9,12 @@ loggerPath=electromagnetic-data
logging.level.com.aliyun.fsi.insurance=${LOG_LEVEL:INFO} logging.level.com.aliyun.fsi.insurance=${LOG_LEVEL:INFO}
#日志配置 #日志配置
logging.config=classpath:${LOG_CONFIG:log4j2-spring.xml} 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
spring.datasource.password=2024*Comac spring.datasource.password=2024*Comac
spring.servlet.multipart.max-file-size=500MB spring.servlet.multipart.max-file-size=500MB
spring.servlet.multipart.max-request-size=10MB spring.servlet.multipart.max-request-size=10MB
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
mybatis-plus.mapper-locations=classpath:sqlmapper/*.xml mybatis-plus.mapper-locations=classpath:sqlmapper/*.xml
@ -25,7 +22,6 @@ 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=8888
#windows文件存储目录 #windows文件存储目录
data.windows.path=E:/comacFileStorage/ data.windows.path=E:/comacFileStorage/
#文件缓存路径 #文件缓存路径

View File

@ -4,7 +4,8 @@
<property name="LOG_LEVEL" value="INFO"/> <property name="LOG_LEVEL" value="INFO"/>
<property name="APP_NAME" value="electromagnetic-data"/> <property name="APP_NAME" value="electromagnetic-data"/>
<property name="LOG_HOME" value="./logs/${APP_NAME}"/> <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="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%"/> <property name="SIMPLE_LAYOUT" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %m%n%"/>
</properties> </properties>

View File

@ -4,7 +4,8 @@
<property name="LOG_LEVEL" value="DEBUG"/> <property name="LOG_LEVEL" value="DEBUG"/>
<property name="APP_NAME" value="electromagnetic-data"/> <property name="APP_NAME" value="electromagnetic-data"/>
<property name="LOG_HOME" value="./logs/${APP_NAME}"/> <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="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%"/> <property name="SIMPLE_LAYOUT" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %m%n%"/>
</properties> </properties>

View File

@ -18,8 +18,18 @@
</resultMap> </resultMap>
<sql id="selectUserVo"> <sql id="selectUserVo">
select category_type_id, parent_id, category_id, category_name, category_status, select category_type_id,
creator, creator_name, gmt_create, modifier, modifier_name, gmt_modified, effect_flag parent_id,
category_id,
category_name,
category_status,
creator,
creator_name,
gmt_create,
modifier,
modifier_name,
gmt_modified,
effect_flag
from ed_category from ed_category
</sql> </sql>

View File

@ -28,7 +28,8 @@
<result column="effect_flag" jdbcType="TINYINT" property="effectFlag"/> <result column="effect_flag" jdbcType="TINYINT" property="effectFlag"/>
</resultMap> </resultMap>
<sql id="Base_Column_list"> <sql id="Base_Column_list">
id,category_id,data_id,data_no,data_name,data_type,file_type,version,content, id
,category_id,data_id,data_no,data_name,data_type,file_type,version,content,
implant_json,data_status,note,editor,gmt_batch_upload,save_status,creator,creator_name,gmt_create,modifier,modifier_name, implant_json,data_status,note,editor,gmt_batch_upload,save_status,creator,creator_name,gmt_create,modifier,modifier_name,
gmt_modified,effect_flag gmt_modified,effect_flag
</sql> </sql>
@ -51,7 +52,8 @@
#{dataId,jdbcType=VARCHAR}, #{dataNo,jdbcType=VARCHAR}, #{dataName,jdbcType=VARCHAR}, #{dataId,jdbcType=VARCHAR}, #{dataNo,jdbcType=VARCHAR}, #{dataName,jdbcType=VARCHAR},
#{dataType,jdbcType=VARCHAR}, #{fileType,jdbcType=VARCHAR},#{version,jdbcType=VARCHAR}, #{dataType,jdbcType=VARCHAR}, #{fileType,jdbcType=VARCHAR},#{version,jdbcType=VARCHAR},
#{content,jdbcType=VARCHAR}, #{implantJson,jdbcType=VARCHAR}, #{dataStatus,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{implantJson,jdbcType=VARCHAR}, #{dataStatus,jdbcType=VARCHAR},
#{note,jdbcType=VARCHAR}, #{editor,jdbcType=VARCHAR}, #{gmtBatchUpload,jdbcType=TIMESTAMP}, #{saveStatus,jdbcType=VARCHAR}, #{note,jdbcType=VARCHAR}, #{editor,jdbcType=VARCHAR}, #{gmtBatchUpload,jdbcType=TIMESTAMP},
#{saveStatus,jdbcType=VARCHAR},
#{creator,jdbcType=VARCHAR}, #{creatorName,jdbcType=VARCHAR}, now(), #{modifier,jdbcType=VARCHAR}, #{creator,jdbcType=VARCHAR}, #{creatorName,jdbcType=VARCHAR}, now(), #{modifier,jdbcType=VARCHAR},
#{modifierName,jdbcType=VARCHAR},now(),1 #{modifierName,jdbcType=VARCHAR},now(),1
) )

View File

@ -11,7 +11,8 @@
</resultMap> </resultMap>
<sql id="selectTokenVo"> <sql id="selectTokenVo">
select id, user_id, token, is_long_term, created_at, expire_at from tokens select id, user_id, token, is_long_term, created_at, expire_at
from tokens
</sql> </sql>
<insert id="insert" parameterType="com.electromagnetic.industry.software.manage.pojo.models.Token"> <insert id="insert" parameterType="com.electromagnetic.industry.software.manage.pojo.models.Token">
@ -37,7 +38,9 @@
</select> </select>
<delete id="deleteToken" parameterType="String"> <delete id="deleteToken" parameterType="String">
delete from tokens where token=#{token} delete
from tokens
where token = #{token}
</delete> </delete>
</mapper> </mapper>

View File

@ -25,9 +25,25 @@
</resultMap> </resultMap>
<sql id="selectUserVo"> <sql id="selectUserVo">
select user_id, user_name, work_number, mobile, user_dept, user_title, user_pwd, select user_id,
join_time, is_published, salt, user_status, internship_end_date, user_name,
creator, creator_name, gmt_create, modifier, modifier_name, gmt_modified, effect_flag work_number,
mobile,
user_dept,
user_title,
user_pwd,
join_time,
is_published,
salt,
user_status,
internship_end_date,
creator,
creator_name,
gmt_create,
modifier,
modifier_name,
gmt_modified,
effect_flag
from ed_users from ed_users
</sql> </sql>
@ -102,7 +118,8 @@
</foreach> </foreach>
</update> </update>
<select id="search" parameterType="com.electromagnetic.industry.software.manage.pojo.other.SearchKeyWords" resultMap="UserResultMap"> <select id="search" parameterType="com.electromagnetic.industry.software.manage.pojo.other.SearchKeyWords"
resultMap="UserResultMap">
SELECT * SELECT *
FROM ed_users FROM ed_users
<where> <where>
@ -146,7 +163,8 @@
LIMIT #{pageSize} OFFSET #{pageIndex} LIMIT #{pageSize} OFFSET #{pageIndex}
</select> </select>
<select id="getTotalCount" parameterType="com.electromagnetic.industry.software.manage.pojo.other.SearchKeyWords" resultType="Integer"> <select id="getTotalCount" parameterType="com.electromagnetic.industry.software.manage.pojo.other.SearchKeyWords"
resultType="Integer">
SELECT COUNT(*) SELECT COUNT(*)
FROM ed_users FROM ed_users
<where> <where>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>

View File

@ -6,15 +6,23 @@ package com.electromagnetic.industry.software.common.enums;
*/ */
public interface ErrorLevels { public interface ErrorLevels {
/** INFO级别 */ /**
* INFO级别
*/
public static final String INFO = "1"; public static final String INFO = "1";
/** WARN级别 */ /**
* WARN级别
*/
public static final String WARN = "3"; public static final String WARN = "3";
/** ERROR级别 */ /**
* ERROR级别
*/
public static final String ERROR = "5"; public static final String ERROR = "5";
/** FATAL级别 */ /**
* FATAL级别
*/
public static final String FATAL = "7"; public static final String FATAL = "7";
} }

View File

@ -2,17 +2,25 @@ package com.electromagnetic.industry.software.common.enums;
public interface ErrorTypes { public interface ErrorTypes {
/** 系统错误 */ /**
* 系统错误
*/
public static final String SYSTEM = "0"; public static final String SYSTEM = "0";
/** 业务错误 */ /**
* 业务错误
*/
@Deprecated @Deprecated
public static final String BIZ = "1"; public static final String BIZ = "1";
/** 第三方错误 */ /**
* 第三方错误
*/
@Deprecated @Deprecated
public static final String THIRD_PARTY = "2"; public static final String THIRD_PARTY = "2";
/** 业务错误,客户感知 */ /**
* 业务错误客户感知
*/
public static final String BIZ_CUSTOMER = "9"; public static final String BIZ_CUSTOMER = "9";
} }

View File

@ -4,34 +4,52 @@ import java.io.Serializable;
public class ResultCode implements Serializable { public class ResultCode implements Serializable {
/** 序列ID */ /**
private static final long serialVersionUID = 3951948353107763580L; * 结果码固定前缀
*/
/** 结果码固定前缀 */
protected static final String PREFIX = "CE"; protected static final String PREFIX = "CE";
/**
/** 结果码版本 */ * 序列ID
*/
private static final long serialVersionUID = 3951948353107763580L;
/**
* 结果码版本
*/
private String version; private String version;
/** 结果码级别[第9位]INFO-1,WARN-3,ERROR-5,FATAL-7参见<code>ResultCodeLevel</code>定义 */ /**
* 结果码级别[第9位]INFO-1,WARN-3,ERROR-5,FATAL-7参见<code>ResultCodeLevel</code>定义
*/
private String codeLevel; private String codeLevel;
/** 结果码类型[第10位]SUCCESS-0,BIZ_ERROR-1,SYS_ERROR-2,THIRD_ERROR-3参见<code>ResultCodeType</code>定义 */ /**
* 结果码类型[第10位]SUCCESS-0,BIZ_ERROR-1,SYS_ERROR-2,THIRD_ERROR-3参见<code>ResultCodeType</code>定义
*/
private String codeType; private String codeType;
/** 系统编号[第11-13位],见<code>SystemCode</code>定义 */ /**
* 系统编号[第11-13位]<code>SystemCode</code>定义
*/
private String systemCode; private String systemCode;
/** 系统名称 */ /**
* 系统名称
*/
private String systemName; private String systemName;
/** 具体结果码[第14-17位] */ /**
* 具体结果码[第14-17位]
*/
private String errorSpecific; private String errorSpecific;
/** 错误英文简称 */ /**
* 错误英文简称
*/
private String errorName; private String errorName;
/** 结果码信息描述,可空 */ /**
* 结果码信息描述可空
*/
private String description; private String description;
// ~~~ 构造方法 // ~~~ 构造方法

View File

@ -4,7 +4,6 @@ package com.electromagnetic.industry.software.common.util;
import cn.hutool.core.codec.Base64; import cn.hutool.core.codec.Base64;
import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.bouncycastle.jce.provider.BouncyCastleProvider;
import javax.crypto.*; import javax.crypto.*;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
@ -15,6 +14,7 @@ import java.security.Security;
/** /**
* <p>Description: [AES对称加密和解密]</p> * <p>Description: [AES对称加密和解密]</p>
*
* @description: * @description:
* @author: * @author:
* @create: 2022/07/06 10:52 * @create: 2022/07/06 10:52
@ -24,6 +24,7 @@ public class AESUtils {
/** /**
* <p>Discription:[加密]</p> * <p>Discription:[加密]</p>
* Created on 2022/07/06 10:52 * Created on 2022/07/06 10:52
*
* @param content 明文 用JSON.toJSONString(Map<String, String> map)转换的json字符串 * @param content 明文 用JSON.toJSONString(Map<String, String> map)转换的json字符串
* @param key 加解密规则 访客系统提供key * @param key 加解密规则 访客系统提供key
* @return String 密文 * @return String 密文
@ -72,6 +73,7 @@ public class AESUtils {
/** /**
* 前端使用ECB后端解密方法 * 前端使用ECB后端解密方法
*
* @param enc * @param enc
* @param key * @param key
* @return * @return

View File

@ -6,8 +6,6 @@ import java.net.NetworkInterface;
public class IdWorker { public class IdWorker {
private static IdWorker idWorker=new IdWorker();
// 时间起始标记点作为基准一般取系统的最近时间一旦确定不能变动 // 时间起始标记点作为基准一般取系统的最近时间一旦确定不能变动
private final static long twepoch = 1288834974657L; private final static long twepoch = 1288834974657L;
// 机器标识位数 // 机器标识位数
@ -26,26 +24,24 @@ public class IdWorker {
private final static long datacenterIdShift = sequenceBits + workerIdBits; private final static long datacenterIdShift = sequenceBits + workerIdBits;
// 时间毫秒左移22位 // 时间毫秒左移22位
private final static long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits; private final static long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits;
private final static long sequenceMask = -1L ^ (-1L << sequenceBits); private final static long sequenceMask = -1L ^ (-1L << sequenceBits);
private static IdWorker idWorker = new IdWorker();
/* 上次生产id时间戳 */ /* 上次生产id时间戳 */
private static long lastTimestamp = -1L; private static long lastTimestamp = -1L;
// 0并发控制
private long sequence = 0L;
private final long workerId; private final long workerId;
// 数据标识id部分 // 数据标识id部分
private final long datacenterId; private final long datacenterId;
// 0并发控制
private long sequence = 0L;
public IdWorker() { public IdWorker() {
this.datacenterId = getDatacenterId(maxDatacenterId); this.datacenterId = getDatacenterId(maxDatacenterId);
this.workerId = getMaxWorkerId(datacenterId, maxWorkerId); this.workerId = getMaxWorkerId(datacenterId, maxWorkerId);
} }
/** /**
* @param workerId * @param workerId 工作机器ID
* 工作机器ID * @param datacenterId 序列号
* @param datacenterId
* 序列号
*/ */
public IdWorker(long workerId, long datacenterId) { public IdWorker(long workerId, long datacenterId) {
if (workerId > maxWorkerId || workerId < 0) { if (workerId > maxWorkerId || workerId < 0) {
@ -57,47 +53,6 @@ public class IdWorker {
this.workerId = workerId; this.workerId = workerId;
this.datacenterId = datacenterId; this.datacenterId = datacenterId;
} }
/**
* 获取下一个ID
*
* @return
*/
public synchronized long nextId() {
long timestamp = timeGen();
if (timestamp < lastTimestamp) {
throw new RuntimeException(String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
}
if (lastTimestamp == timestamp) {
// 当前毫秒内+1
sequence = (sequence + 1) & sequenceMask;
if (sequence == 0) {
// 当前毫秒内计数满了则等待下一秒
timestamp = tilNextMillis(lastTimestamp);
}
} else {
sequence = 0L;
}
lastTimestamp = timestamp;
// ID偏移组合生成最终的ID并返回ID
long nextId = ((timestamp - twepoch) << timestampLeftShift)
| (datacenterId << datacenterIdShift)
| (workerId << workerIdShift) | sequence;
return nextId;
}
private long tilNextMillis(final long lastTimestamp) {
long timestamp = this.timeGen();
while (timestamp <= lastTimestamp) {
timestamp = this.timeGen();
}
return timestamp;
}
private long timeGen() {
return System.currentTimeMillis();
}
/** /**
* <p> * <p>
@ -143,6 +98,7 @@ public class IdWorker {
} }
return id; return id;
} }
public static long getSnowFlakeId() { public static long getSnowFlakeId() {
return idWorker.nextId(); return idWorker.nextId();
} }
@ -151,4 +107,46 @@ public class IdWorker {
return String.valueOf(getSnowFlakeId()); return String.valueOf(getSnowFlakeId());
} }
/**
* 获取下一个ID
*
* @return
*/
public synchronized long nextId() {
long timestamp = timeGen();
if (timestamp < lastTimestamp) {
throw new RuntimeException(String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
}
if (lastTimestamp == timestamp) {
// 当前毫秒内+1
sequence = (sequence + 1) & sequenceMask;
if (sequence == 0) {
// 当前毫秒内计数满了则等待下一秒
timestamp = tilNextMillis(lastTimestamp);
}
} else {
sequence = 0L;
}
lastTimestamp = timestamp;
// ID偏移组合生成最终的ID并返回ID
long nextId = ((timestamp - twepoch) << timestampLeftShift)
| (datacenterId << datacenterIdShift)
| (workerId << workerIdShift) | sequence;
return nextId;
}
private long tilNextMillis(final long lastTimestamp) {
long timestamp = this.timeGen();
while (timestamp <= lastTimestamp) {
timestamp = this.timeGen();
}
return timestamp;
}
private long timeGen() {
return System.currentTimeMillis();
}
} }

View File

@ -55,16 +55,12 @@ public class SignUtils {
} }
public static Boolean equals(String v1, String v2) { public static Boolean equals(String v1, String v2) {
if (v1 == null && v2 == null) if (v1 == null && v2 == null) {
{
return true; return true;
} }
if (v1 != null && v2 != null && v1.equals(v2)) if (v1 != null && v2 != null && v1.equals(v2)) {
{
return true; return true;
} } else {
else
{
return false; return false;
} }
} }
@ -73,21 +69,15 @@ public class SignUtils {
String temp = null; String temp = null;
if (params.get(key) == null) { if (params.get(key) == null) {
return defaultValue; return defaultValue;
} } else if (params.get(key).getClass().isArray()) {
else if(params.get(key).getClass().isArray())
{
temp = getArray(params, key)[0]; temp = getArray(params, key)[0];
} } else {
else
{
temp = params.get(key).toString(); temp = params.get(key).toString();
} }
if (temp != null) { if (temp != null) {
temp = temp.replaceAll("%", "\\%"); temp = temp.replaceAll("%", "\\%");
} }
if(temp==null) if (temp == null) {
{
return defaultValue; return defaultValue;
} }
return temp; return temp;