Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
appKey : e9eb516aa02a43a29e227a0d901ec5f1
|
||||
appSecret : 9fac43db08634aaf8a9fe5fb9468de9d
|
||||
# 海葵云url
|
||||
HK_CLOUD_URL : https:#url.lyhhaikuicloud.com
|
||||
HK_CLOUD_URL : https://url.lyhhaikuicloud.com
|
||||
# 海葵云获取用户token url后缀
|
||||
HK_USER_TOKEN_URL_SUFFIX : /merchant/openapi/user/login/jobNo
|
||||
# 海葵云获取单个用户信息url后缀
|
||||
@@ -15,7 +15,7 @@ HK_SIMPLE_USER_URL_SUFFIX : /merchant/api/user/getSimpleUserInfo
|
||||
# 海葵云上传文件url后缀
|
||||
HK_UPLOAD_FILE_URL_SUFFIX : /haikui-oa/autoCreateFlow/uploadFile
|
||||
# EP系统URL
|
||||
EP_URL : https:#ep-url.dev.haikuicloud.com
|
||||
EP_URL : https://ep-url.dev.haikuicloud.com
|
||||
# 推送代办状态url后缀
|
||||
QUERY_TODO_STATUS_SUFFIX : /todoApi/todo/emulation/dm/status
|
||||
# 查询待办结果url后缀
|
||||
|
||||
@@ -370,6 +370,35 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
return currentNodeDepth;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断字符串是否可以安全转换为Long类型
|
||||
* @param str 待校验的字符串
|
||||
* @return true-可以转换,false-不可以转换
|
||||
*/
|
||||
public static boolean isConvertibleToLong(String str) {
|
||||
// 1. 处理null、空字符串、全空格字符串
|
||||
if (str == null || str.trim().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
String trimmedStr = str.trim();
|
||||
|
||||
// 2. 正则校验数字格式(支持正负号,纯数字)
|
||||
// 正则说明:^-? 匹配开头的负号(可选);\\d+ 匹配1个及以上数字;$ 匹配结尾
|
||||
if (!trimmedStr.matches("^-?\\d+$")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 3. 校验数值范围,避免溢出
|
||||
try {
|
||||
// 直接调用Long.parseLong,利用其自带的范围校验
|
||||
Long.parseLong(trimmedStr);
|
||||
return true;
|
||||
} catch (NumberFormatException e) {
|
||||
// 捕获数值超出Long范围的异常
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void generateTaskTree(ProjectNodePo projectNodePo,List<String> addedIdList,List<String> currentAddedIdList) {
|
||||
currentAddedIdList.add(projectNodePo.getUuid());
|
||||
String currentNodeType = projectNodePo.getNodeType();
|
||||
@@ -442,10 +471,17 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
// 4883,4556;
|
||||
List<String> fileDirIdList = Arrays.stream(standard.split(";")).toList();
|
||||
for (String fileDirId : fileDirIdList) {
|
||||
if (!isConvertibleToLong(fileDirId.split(",")[1])) {
|
||||
continue;
|
||||
}
|
||||
fileIdList.add(Long.valueOf(fileDirId.split(",")[1]));
|
||||
}
|
||||
}else {
|
||||
fileIdList.addAll(Arrays.stream(standard.split(",")).toList().stream().map(Long::valueOf).toList());
|
||||
List<String> normalFileIdList = Arrays.stream(standard.split(",")).toList().stream().filter(ProjectServiceImpl::isConvertibleToLong).toList();
|
||||
if (CollectionUtils.isEmpty(normalFileIdList)) {
|
||||
continue;
|
||||
}
|
||||
fileIdList.addAll(normalFileIdList.stream().map(Long::valueOf).toList());
|
||||
}
|
||||
}
|
||||
QueryFileReq queryFileReq = new QueryFileReq();
|
||||
@@ -466,10 +502,17 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
// 4883,4556;
|
||||
List<String> fileDirIdList = Arrays.stream(standard.split(";")).toList();
|
||||
for (String fileDirId : fileDirIdList) {
|
||||
if (!isConvertibleToLong(fileDirId.split(",")[1])) {
|
||||
continue;
|
||||
}
|
||||
fileIdList.add(Long.valueOf(fileDirId.split(",")[1]));
|
||||
}
|
||||
}else {
|
||||
fileIdList.addAll(Arrays.stream(standard.split(",")).toList().stream().map(Long::valueOf).toList());
|
||||
List<String> normalFileIdList = Arrays.stream(standard.split(",")).toList().stream().filter(ProjectServiceImpl::isConvertibleToLong).toList();
|
||||
if (CollectionUtils.isEmpty(normalFileIdList)) {
|
||||
continue;
|
||||
}
|
||||
fileIdList.addAll(normalFileIdList.stream().map(Long::valueOf).toList());
|
||||
}
|
||||
for (Long fileId : fileIdList) {
|
||||
fileNameList.add(dataMap.get(fileId));
|
||||
|
||||
@@ -2282,10 +2282,17 @@ public class TaskServiceImpl implements ITaskService {
|
||||
if (standard.contains(";")) {
|
||||
List<String> fileDirIdList = Arrays.stream(standard.split(";")).toList();
|
||||
for (String fileDirId : fileDirIdList) {
|
||||
if (!isConvertibleToLong(fileDirId.split(",")[1])) {
|
||||
continue;
|
||||
}
|
||||
fileIdList.add(Long.valueOf(fileDirId.split(",")[1]));
|
||||
}
|
||||
}else {
|
||||
fileIdList.addAll(Arrays.stream(standard.split(",")).toList().stream().map(Long::valueOf).toList());
|
||||
List<String> normalFileIdList = Arrays.stream(standard.split(",")).toList().stream().filter(ProjectServiceImpl::isConvertibleToLong).toList();
|
||||
if (CollectionUtils.isEmpty(normalFileIdList)) {
|
||||
continue;
|
||||
}
|
||||
fileIdList.addAll(normalFileIdList.stream().map(Long::valueOf).toList());
|
||||
};
|
||||
}
|
||||
QueryFileReq queryFileReq = new QueryFileReq();
|
||||
@@ -2539,4 +2546,33 @@ public class TaskServiceImpl implements ITaskService {
|
||||
return SdmResponse.success(convertToJSONObjectList(taskDifficultStatisticsRespList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断字符串是否可以安全转换为Long类型
|
||||
* @param str 待校验的字符串
|
||||
* @return true-可以转换,false-不可以转换
|
||||
*/
|
||||
public static boolean isConvertibleToLong(String str) {
|
||||
// 1. 处理null、空字符串、全空格字符串
|
||||
if (str == null || str.trim().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
String trimmedStr = str.trim();
|
||||
|
||||
// 2. 正则校验数字格式(支持正负号,纯数字)
|
||||
// 正则说明:^-? 匹配开头的负号(可选);\\d+ 匹配1个及以上数字;$ 匹配结尾
|
||||
if (!trimmedStr.matches("^-?\\d+$")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 3. 校验数值范围,避免溢出
|
||||
try {
|
||||
// 直接调用Long.parseLong,利用其自带的范围校验
|
||||
Long.parseLong(trimmedStr);
|
||||
return true;
|
||||
} catch (NumberFormatException e) {
|
||||
// 捕获数值超出Long范围的异常
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user