1、动态任务增加发送指令下发信号
2、动态规则批量删除增加使用中判断 3、静态规则返回字段为‘’自动处理为null 4、修复防护对象查询返回ip没有转为ip格式错误
This commit is contained in:
@@ -64,7 +64,7 @@ public class DynamicRuleController implements DynamicRuleControllerApi {
|
||||
@Override
|
||||
@DeleteMapping("/{id}/delete")
|
||||
public ResponseResult deleteDynamicRuleObject(@PathVariable Integer id) {
|
||||
log.info("删除动态规则: {}", id);
|
||||
// log.info("删除动态规则: {}", id);
|
||||
//调用service删除
|
||||
dynamicRuleService.deleteDynamicRuleObject(id);
|
||||
|
||||
|
||||
@@ -77,4 +77,7 @@ public interface DynamicRuleMapper {
|
||||
List<DynamicRuleObject> queryHistory(Integer id, Integer page, Integer pageSize);
|
||||
|
||||
void removeUsedTaskId(Long taskId);
|
||||
|
||||
|
||||
List<Integer> queryAuditStatusByIdList(@Param("ids") List<Integer> ids);
|
||||
}
|
||||
|
||||
@@ -135,6 +135,21 @@ public class DynamicRuleService {
|
||||
}
|
||||
// 批量删除
|
||||
public Boolean deleteDynamicRuleObjects(List<Integer> dynamicRuleIds) {
|
||||
|
||||
//根据是否处于已使用 审核状态 判断能否删除
|
||||
List<Integer> taskStatus = dynamicRuleMapper.queryAuditStatusByIdList(dynamicRuleIds);
|
||||
int index = 0;
|
||||
List<Integer> errorIds = new ArrayList<>();
|
||||
for(Integer status: taskStatus) {
|
||||
if (status == 3) {
|
||||
errorIds.add(dynamicRuleIds.get(index));
|
||||
}
|
||||
index++;
|
||||
}
|
||||
if (!errorIds.isEmpty()){
|
||||
throw new IllegalArgumentException("动态规则使用中, 错误id:" + errorIds);
|
||||
}
|
||||
|
||||
Function<DynamicRuleMapper, Function<List<Integer>, Boolean>> deleteDynamicRuleFunction =
|
||||
mapper -> list -> {
|
||||
if (list == null || list.isEmpty()) {
|
||||
@@ -196,7 +211,7 @@ public class DynamicRuleService {
|
||||
String auditUserName, Integer auditUserId, String auditUserDepart) {
|
||||
Integer originalAuditStatus = dynamicRuleMapper.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");
|
||||
|
||||
Reference in New Issue
Block a user