update 日常校验 统一重构到 StringUtils 便于维护扩展

This commit is contained in:
疯狂的狮子li
2021-08-02 19:28:41 +08:00
parent 5740561cd3
commit c813046594
48 changed files with 493 additions and 239 deletions

View File

@@ -107,9 +107,9 @@ public class CaptchaController {
private String getCodeResult(String capStr) {
int numberLength = captchaProperties.getNumberLength();
int a = Convert.toInt(StringUtils.sub(capStr, 0, numberLength).trim());
int a = Convert.toInt(StringUtils.substring(capStr, 0, numberLength).trim());
char operator = capStr.charAt(numberLength);
int b = Convert.toInt(StringUtils.sub(capStr, numberLength + 1, numberLength + 1 + numberLength).trim());
int b = Convert.toInt(StringUtils.substring(capStr, numberLength + 1, numberLength + 1 + numberLength).trim());
switch (operator) {
case '*':
return a * b + "";

View File

@@ -72,9 +72,9 @@ public class CommonController
// 本地资源路径
String localPath = RuoYiConfig.getProfile();
// 数据库资源地址
String downloadPath = localPath + StringUtils.subAfter(resource, Constants.RESOURCE_PREFIX,false);
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
// 下载名称
String downloadName = StringUtils.subAfter(downloadPath, "/",true);
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
File file = new File(downloadPath);
FileUtils.setAttachmentResponseHeader(response, downloadName);