1、错误信息改为中文

2、任务审核bug
3、指令查询不判断指令是否被删除
4、bugfix
This commit is contained in:
PushM
2024-05-30 02:51:14 +08:00
parent cef4505ba7
commit c8c5b53476
9 changed files with 32 additions and 24 deletions

View File

@@ -112,10 +112,10 @@ public class TemplateService {
public Map<String, Object> updateAuditStatus(Integer id, Integer auditStatus) {
Integer originalAuditStatus = templateMapper.queryAuditStatusById(id);
if (originalAuditStatus == null) {
throw new IllegalArgumentException("cannot find audit status of static rule " + id + ", maybe static rule doesn't exist?");
throw new IllegalArgumentException("不能找到静态规则:" + id + ", 可能静态规则不存在?");
}
if (!AuditStatusValidator.setOriginal(originalAuditStatus).checkValidate(auditStatus)) {
throw new IllegalArgumentException("invalid audit status");
throw new IllegalArgumentException("审核状态修改不合逻辑");
}
Boolean success = templateMapper.updateAuditStatusById(id, auditStatus);

View File

@@ -88,17 +88,19 @@ public class TaskService {
});
taskMapper.newTaskDynamicRuleConcat(task.getTaskId(), task.getDynamicRuleIds());
}
if (task.getTaskType() != TaskTypeEnum.STATIC.getTaskType()){
//校验防护对象是否存在
boolean ProtectObjIdValid = task.getProtectObjectIds().stream()
.allMatch(dynamicRuleMapper::queryProtectObjectById);
if (!ProtectObjIdValid && !task.getProtectObjectIds().isEmpty()){
throw new IllegalArgumentException("部分防护对象不存在");
}
//任务和防护对象多对多关联建立
taskMapper.newTaskProtectObjectConcat(task.getTaskId(), task.getProtectObjectIds());
}
if (task.getTaskType() != TaskTypeEnum.STATIC.getTaskType()) {
if (task.getProtectObjectIds() != null && !task.getProtectObjectIds().isEmpty()) {
//校验防护对象是否存在
boolean ProtectObjIdValid = task.getProtectObjectIds().stream()
.allMatch(dynamicRuleMapper::queryProtectObjectById);
if (!ProtectObjIdValid) {
throw new IllegalArgumentException("部分防护对象不存在");
}
//任务和防护对象多对多关联建立
taskMapper.newTaskProtectObjectConcat(task.getTaskId(), task.getProtectObjectIds());
}
}
return task.getTaskId();
}

View File

@@ -151,7 +151,7 @@ public class WhiteListService {
StaticRuleObject staticRuleObject = staticRuleMapper.queryStaticRuleById(ruleId);
if (staticRuleObject == null) {
throw new IllegalArgumentException("invalid rule id");
throw new IllegalArgumentException("无效的静态规则");
}
// 命中的whitelist列表每一列包含ip port url
return whiteListMapper.existWhiteListObject(staticRuleObject);
@@ -192,11 +192,11 @@ public class WhiteListService {
//查询目前curStatus
Integer originalAuditStatus = whiteListMapper.queryWhiteListObjectAuditStuatusById(id);
if (originalAuditStatus == null){
throw new IllegalArgumentException("cannot find audit status of whitelist " + id + ", maybe whitelist doesn't exist?");
throw new IllegalArgumentException("不能找到白名单 " + id + ", 可能该白名单不存在");
}
//判断是否可以修改
if (!AuditStatusValidator.setOriginal(originalAuditStatus).checkValidate(auditStatus)) {
throw new IllegalArgumentException("invalid audit status");
throw new IllegalArgumentException("审核状态修改违规");
}
Boolean success = whiteListMapper.updateWhiteListObjectAuditStatus(id, auditStatus);