【fix sonar】SysCheckRuleServiceImpl文件
This commit is contained in:
+11
-3
@@ -9,6 +9,7 @@ import org.apache.commons.lang.StringUtils;
|
||||
import com.jero.modules.system.entity.SysCheckRule;
|
||||
import com.jero.modules.system.mapper.SysCheckRuleMapper;
|
||||
import com.jero.modules.system.service.ISysCheckRuleService;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
@@ -46,6 +47,15 @@ public class SysCheckRuleServiceImpl extends ServiceImpl<SysCheckRuleMapper, Sys
|
||||
if (checkRule != null && StringUtils.isNotBlank(value)) {
|
||||
String ruleJson = checkRule.getRuleJson();
|
||||
if (StringUtils.isNotBlank(ruleJson)) {
|
||||
JSONObject result = getJsonObject(value, ruleJson);
|
||||
if (result != null) return result;
|
||||
}
|
||||
}
|
||||
return new JSONObject();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private JSONObject getJsonObject(String value, String ruleJson) {
|
||||
// 开始截取的下标,根据规则的顺序递增,但是 * 号不计入递增范围
|
||||
int beginIndex = 0;
|
||||
JSONArray rules = JSON.parseArray(ruleJson);
|
||||
@@ -90,9 +100,7 @@ public class SysCheckRuleServiceImpl extends ServiceImpl<SysCheckRuleMapper, Sys
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return new JSONObject();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user