NeedBraceRule解决

This commit is contained in:
dftre 2025-01-07 11:41:53 +08:00
parent 7d633941f6
commit 7b9a801b2e
4 changed files with 23 additions and 14 deletions

View File

@ -33,7 +33,7 @@ public class MailServiceImpl implements IMailService {
private TokenService tokenService; private TokenService tokenService;
@Autowired @Autowired
private UserDetailsServiceImpl userDetailsServiceImpl; private UserDetailsServiceImpl userDetailsServiceImpl;
private static final Logger log = LoggerFactory.getLogger(MailServiceImpl.class); private static final Logger log = LoggerFactory.getLogger(MailServiceImpl.class);
@Override @Override
@ -54,12 +54,14 @@ public class MailServiceImpl implements IMailService {
@Override @Override
public boolean checkCode(String email, String code, OauthVerificationUse use) { public boolean checkCode(String email, String code, OauthVerificationUse use) {
if (StringUtils.isEmpty(code)) if (StringUtils.isEmpty(code)) {
return false; return false;
}
String cachedCode = CacheUtils.get(CacheConstants.EMAIL_CODES, use.getValue() + email, String.class); // 从缓存中获取验证码 String cachedCode = CacheUtils.get(CacheConstants.EMAIL_CODES, use.getValue() + email, String.class); // 从缓存中获取验证码
boolean isValid = code.equals(cachedCode); boolean isValid = code.equals(cachedCode);
if (isValid) if (isValid) {
CacheUtils.remove(CacheConstants.EMAIL_CODES, use.getValue() + email); CacheUtils.remove(CacheConstants.EMAIL_CODES, use.getValue() + email);
}
return isValid; return isValid;
} }

View File

@ -64,12 +64,14 @@ public class DySmsServiceImpl implements DySmsService {
@Override @Override
public boolean checkCode(String phone, String code, OauthVerificationUse use) { public boolean checkCode(String phone, String code, OauthVerificationUse use) {
if (StringUtils.isEmpty(code)) if (StringUtils.isEmpty(code)) {
return false; return false;
}
String cachedCode = CacheUtils.get(CacheConstants.PHONE_CODES, use.getValue() + phone, String.class); // 从缓存中获取验证码 String cachedCode = CacheUtils.get(CacheConstants.PHONE_CODES, use.getValue() + phone, String.class); // 从缓存中获取验证码
boolean isValid = code.equals(cachedCode); boolean isValid = code.equals(cachedCode);
if (isValid) if (isValid) {
CacheUtils.remove(CacheConstants.PHONE_CODES, use.getValue() + phone); CacheUtils.remove(CacheConstants.PHONE_CODES, use.getValue() + phone);
}
return isValid; return isValid;
} }

View File

@ -73,8 +73,9 @@ public class OnLineController extends BaseController {
} }
public Boolean checkPermission(String permissionType, String permissionValue) { public Boolean checkPermission(String permissionType, String permissionValue) {
if (permissionType == null) if (permissionType == null) {
return true; return true;
}
return switch (permissionType) { return switch (permissionType) {
case "hasPermi" -> permissionService.hasPermi(permissionValue); case "hasPermi" -> permissionService.hasPermi(permissionValue);
case "lacksPermi" -> permissionService.lacksPermi(permissionValue); case "lacksPermi" -> permissionService.lacksPermi(permissionValue);
@ -124,16 +125,15 @@ public class OnLineController extends BaseController {
return AjaxResult.error(500, "系统错误,在线接口重复"); return AjaxResult.error(500, "系统错误,在线接口重复");
} else { } else {
OnlineMb onlineMb = selectOnlineMbList.get(0); OnlineMb onlineMb = selectOnlineMbList.get(0);
if (!checkPermission(onlineMb.getPermissionType(), onlineMb.getPermissionValue())) if (!checkPermission(onlineMb.getPermissionType(), onlineMb.getPermissionValue())) {
return AjaxResult.error(403, "没有权限,请联系管理员授权"); return AjaxResult.error(403, "没有权限,请联系管理员授权");
}
if (onlineMb.getDeptId() != null && onlineMb.getDeptId().equals("1")) { if (onlineMb.getDeptId() != null && onlineMb.getDeptId().equals("1")) {
object.put("deptId", SecurityUtils.getDeptId()); object.put("deptId", SecurityUtils.getDeptId());
} }
if (onlineMb.getUserId() != null && onlineMb.getUserId().equals("1")) { if (onlineMb.getUserId() != null && onlineMb.getUserId().equals("1")) {
object.put("userId", SecurityUtils.getUserId()); object.put("userId", SecurityUtils.getUserId());
} }
return processingMapper(onlineMb.getSql(), onlineMb.getActuator(), object); return processingMapper(onlineMb.getSql(), onlineMb.getActuator(), object);
} }
} }

View File

@ -84,12 +84,14 @@ public class SQBServiceImpl {
String result = httpPost(url, params.toString(), sign, sqbConfig.getVendorSn()); String result = httpPost(url, params.toString(), sign, sqbConfig.getVendorSn());
JSONObject retObj = JSON.parseObject(result); JSONObject retObj = JSON.parseObject(result);
String resCode = retObj.get("result_code").toString(); String resCode = retObj.get("result_code").toString();
if (!"200".equals(resCode)) if (!"200".equals(resCode)) {
return null; return null;
}
String responseStr = retObj.get("biz_response").toString(); String responseStr = retObj.get("biz_response").toString();
JSONObject terminal = JSON.parseObject(responseStr); JSONObject terminal = JSON.parseObject(responseStr);
if (terminal.get("terminal_sn") == null || terminal.get("terminal_key") == null) if (terminal.get("terminal_sn") == null || terminal.get("terminal_key") == null) {
return null; return null;
}
return terminal; return terminal;
} catch (Exception e) { } catch (Exception e) {
return null; return null;
@ -113,12 +115,14 @@ public class SQBServiceImpl {
String result = httpPost(url, params.toString(), sign, sqbConfig.getTerminalSn()); String result = httpPost(url, params.toString(), sign, sqbConfig.getTerminalSn());
JSONObject retObj = JSON.parseObject(result); JSONObject retObj = JSON.parseObject(result);
String resCode = retObj.get("result_code").toString(); String resCode = retObj.get("result_code").toString();
if (!"200".equals(resCode)) if (!"200".equals(resCode)){
return null; return null;
}
String responseStr = retObj.get("biz_response").toString(); String responseStr = retObj.get("biz_response").toString();
JSONObject terminal = JSON.parseObject(responseStr); JSONObject terminal = JSON.parseObject(responseStr);
if (terminal.get("terminal_sn") == null || terminal.get("terminal_key") == null) if (terminal.get("terminal_sn") == null || terminal.get("terminal_key") == null){
return null; return null;
}
return terminal; return terminal;
} catch (Exception e) { } catch (Exception e) {
return null; return null;
@ -166,8 +170,9 @@ public class SQBServiceImpl {
String result = httpPost(url, params, sign, sqbConfig.getTerminalSn()); String result = httpPost(url, params, sign, sqbConfig.getTerminalSn());
JSONObject retObj = JSON.parseObject(result); JSONObject retObj = JSON.parseObject(result);
String resCode = retObj.get("result_code").toString(); String resCode = retObj.get("result_code").toString();
if (!"200".equals(resCode)) if (!"200".equals(resCode)){
return null; return null;
}
String responseStr = retObj.get("biz_response").toString(); String responseStr = retObj.get("biz_response").toString();
return JSONObject.parseObject(responseStr); return JSONObject.parseObject(responseStr);
} catch (Exception e) { } catch (Exception e) {