This commit is contained in:
s2042968 2025-01-08 14:49:48 +08:00
commit 3107173133
5 changed files with 9 additions and 157 deletions

View File

@ -1,80 +0,0 @@
package com.electromagnetic.industry.software.manage.pojo.other;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
import java.io.Serializable;
import java.util.Date;
@Data
public class EDDataParams implements Serializable {
private static final long serialVersionUID = -4835122199589863011L;
/**
* 当前页
*/
private Integer pageIndex = 1;
/**
* 每页数据
*/
private Integer pageSize = 10;
/**
* 操作用户id
*/
private String userId;
/**
* 用户名
*/
private String userName;
/**
* 上级文件夹数据码,为空是顶级
*/
private String parentId;
/**
* 文件数据编码
*/
private String dataId;
/**
* 文件夹名称
*/
private String name;
/**
* 文件类型
*/
private String dataType;
/**
* 创建日期排序
*/
private String gmtCreate;
/**
* 文件数据状态
*/
private String dataStatus;
/**
* 备注
*/
private String note;
/**
* 是否有效
*/
private String effectFlag;
/**
* 关键词
*/
private String keyWord;
/**
* 批量上传时间
*/
private Date gmtBatchUpload;
/**
* 保存状态
*/
private String saveStatus;
/**
* 文件数据编码数组
*/
private String[] dataIdArr;
/**
* 文件数据
*/
private MultipartFile fileData;
}

View File

@ -211,7 +211,7 @@ public class CommonService {
} }
} }
public List<String> queryAllPrjInfo(boolean isAdminQuery) { public List<String> queryAllPrjInfo(boolean isAdminQuery, List<String> prjIds) {
try { try {
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class) LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
@ -219,7 +219,7 @@ public class CommonService {
.eq(EdFileInfo::getParentId, PRJ_PARENT_ID) .eq(EdFileInfo::getParentId, PRJ_PARENT_ID)
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code); .eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code);
if (!isAdminQuery) { if (!isAdminQuery) {
queryWrapper.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.PUBLISHED.code); queryWrapper.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.PUBLISHED.code).in(EdFileInfo::getId, prjIds);
} }
List<String> ids = edFileInfoMapper.selectList(queryWrapper).stream().map(EdFileInfo::getId).collect(Collectors.toList()); List<String> ids = edFileInfoMapper.selectList(queryWrapper).stream().map(EdFileInfo::getId).collect(Collectors.toList());

View File

@ -171,7 +171,11 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
*/ */
@Override @Override
public ElectromagneticResult<?> tree() { public ElectromagneticResult<?> tree() {
List<String> strings = commonService.queryAllPrjInfo(false); List<String> prjIds = permissionService.getAccessibleTree();
if (CollUtil.isEmpty(prjIds)) {
return ElectromagneticResultUtil.success(new ArrayList<>());
}
List<String> strings = commonService.queryAllPrjInfo(false, prjIds);
List<FileProjectVO> res = new ArrayList<>(); List<FileProjectVO> res = new ArrayList<>();
strings.forEach(e -> { strings.forEach(e -> {
FileProjectVO fileProjectVO = JSONUtil.toList(e, FileProjectVO.class).get(0); FileProjectVO fileProjectVO = JSONUtil.toList(e, FileProjectVO.class).get(0);
@ -686,6 +690,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ElectromagneticResult<?> upload(String parentId, MultipartFile file, Integer strategy) { public ElectromagneticResult<?> upload(String parentId, MultipartFile file, Integer strategy) {
Assert.isTrue(!file.isEmpty(), "禁止上传空文件");
Assert.isTrue(EleCommonUtil.isFileNameValid(file.getOriginalFilename()), NAME_VALID_MSG); Assert.isTrue(EleCommonUtil.isFileNameValid(file.getOriginalFilename()), NAME_VALID_MSG);
// 查找下一层看是否存在顶级定义相关文件如果存在则该层属于管理员层级定义的不允许上传文件 // 查找下一层看是否存在顶级定义相关文件如果存在则该层属于管理员层级定义的不允许上传文件
long dirCount = this.baseMapper.selectCount(Wrappers.lambdaQuery(EdFileInfo.class) long dirCount = this.baseMapper.selectCount(Wrappers.lambdaQuery(EdFileInfo.class)

View File

@ -222,7 +222,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
*/ */
@Override @Override
public ElectromagneticResult<?> queryAllPrjInfo() { public ElectromagneticResult<?> queryAllPrjInfo() {
List<String> res = commonService.queryAllPrjInfo(true); List<String> res = commonService.queryAllPrjInfo(true, null);
List<ProjectVO> projectVOS = new ArrayList<>(); List<ProjectVO> projectVOS = new ArrayList<>();
res.forEach(e -> { res.forEach(e -> {
ProjectVO projectVO = JSONUtil.toList(e, ProjectVO.class).get(0); ProjectVO projectVO = JSONUtil.toList(e, ProjectVO.class).get(0);

View File

@ -1,32 +1,9 @@
package com.electromagnetic.industry.software.common.util; package com.electromagnetic.industry.software.common.util;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.util.Map;
public class SignUtils { public class SignUtils {
public static char[] hexDigits =
{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
public static String md5(String string) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
byte[] bytes = md5.digest(string.getBytes("utf-8"));
char[] chars = new char[bytes.length * 2];
for (int i = 0; i < bytes.length; ++i) {
int b = bytes[i];
chars[i * 2] = hexDigits[(b & 240) >> 4];
chars[i * 2 + 1] = hexDigits[b & 15];
}
return new String(chars);
} catch (Exception var6) {
var6.printStackTrace();
return null;
}
}
/** /**
* 获取MD5加密后的字符串 * 获取MD5加密后的字符串
* *
@ -54,54 +31,4 @@ public class SignUtils {
} }
} }
public static Boolean equals(String v1, String v2) {
if (v1 == null && v2 == null) {
return true;
}
if (v1 != null && v2 != null && v1.equals(v2)) {
return true;
} else {
return false;
}
}
public static String getString(Map<String, Object> params, String key, String defaultValue) {
String temp = null;
if (params.get(key) == null) {
return defaultValue;
} else if (params.get(key).getClass().isArray()) {
temp = getArray(params, key)[0];
} else {
temp = params.get(key).toString();
}
if (temp != null) {
temp = temp.replaceAll("%", "\\%");
}
if (temp == null) {
return defaultValue;
}
return temp;
}
public static String[] getArray(Map<String, Object> params, String key) {
return getArray(params, key, null);
}
public static String[] getArray(Map<String, Object> params, String
key, String[] defaultValue) {
if (params == null) {
return defaultValue;
}
if (params.get(key) == null) {
return defaultValue;
}
try {
String[] values = (String[]) params.get(key);
return values;
} catch (ClassCastException e) {
return defaultValue;
}
}
} }