mirror of
https://gitee.com/xiaonuobase/snowy.git
synced 2026-10-06 06:52:58 +08:00
style:优化代码命名与格式
This commit is contained in:
+2
-2
@@ -82,8 +82,8 @@ public class AuthOidcWeLinkRequest extends AuthDefaultRequest {
|
||||
if (object.containsKey("errorCode")) {
|
||||
throw new AuthException(object.getString("errorMessage"));
|
||||
}
|
||||
if (object.containsKey("code") && !object.getString("code").equals("0") &&
|
||||
!object.getString("code").equals("60001")) {
|
||||
if (object.containsKey("code") && !"0".equals(object.getString("code")) &&
|
||||
!"60001".equals(object.getString("code"))) {
|
||||
throw new AuthException(object.getString("message"));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ public class AuthOidcYunZhiJiaRequest extends AuthDefaultRequest {
|
||||
|
||||
public JSONObject getAccessToken(String scopeType) {
|
||||
JSONObject param = JSONUtil.createObj();
|
||||
if(scopeType.equals("app")) {
|
||||
if("app".equals(scopeType)) {
|
||||
param.set("appId", this.config.getClientId());
|
||||
param.set("secret", this.config.getClientSecret());
|
||||
} else {
|
||||
|
||||
+3
-3
@@ -173,7 +173,7 @@ public class SamlClient {
|
||||
this.credentials =
|
||||
certificates.stream().map(SamlClient::getCredential).collect(Collectors.toList());
|
||||
this.samlBinding = samlBinding;
|
||||
this.domParser = XMLHelper.createDOMParser();
|
||||
this.domParser = XmlHelper.createDOMParser();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -463,7 +463,7 @@ public class SamlClient {
|
||||
private static DOMMetadataResolver createMetadataResolver(InputStream metadata)
|
||||
throws SamlException {
|
||||
try {
|
||||
BasicParserPool parser = XMLHelper.createDOMParser();
|
||||
BasicParserPool parser = XmlHelper.createDOMParser();
|
||||
Document metadataDocument = parser.parse(metadata);
|
||||
DOMMetadataResolver resolver = new DOMMetadataResolver(metadataDocument.getDocumentElement());
|
||||
resolver.setId(
|
||||
@@ -994,7 +994,7 @@ public class SamlClient {
|
||||
if (marshaller != null) {
|
||||
dom = marshaller.marshall(object);
|
||||
}
|
||||
XMLHelper.writeNode(dom, stringWriter);
|
||||
XmlHelper.writeNode(dom, stringWriter);
|
||||
|
||||
return stringWriter;
|
||||
}
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ import org.w3c.dom.ls.LSSerializerFilter;
|
||||
import java.io.Writer;
|
||||
import java.util.Map;
|
||||
|
||||
public class XMLHelper {
|
||||
public class XmlHelper {
|
||||
/**
|
||||
* Writes a Node out to a Writer using the DOM, level 3, Load/Save serializer. The written content is encoded using
|
||||
* the encoding specified in the writer configuration.
|
||||
+16
-14
@@ -92,30 +92,32 @@ public class AuthPhoneUtil {
|
||||
String ippfx4 = substring(telNum,0, 4);
|
||||
|
||||
if (telNum.length() > 7
|
||||
&& (substring(telNum, 5, 1).equals("0")
|
||||
|| substring(telNum, 5, 1).equals("1") || substring(
|
||||
telNum, 5, 3).equals("400") || substring(
|
||||
telNum, 5, 3).equals("+86"))
|
||||
&& (inArray(ippfx5, IPPFXS5) || inArray(ippfx4, IPPFXS4)))
|
||||
&& ("0".equals(substring(telNum, 5, 1))
|
||||
|| "1".equals(substring(telNum, 5, 1)) || "400".equals(substring(
|
||||
telNum, 5, 3)) || "+86".equals(substring(
|
||||
telNum, 5, 3)))
|
||||
&& (inArray(ippfx5, IPPFXS5) || inArray(ippfx4, IPPFXS4))) {
|
||||
telNum = substring(telNum, 5);
|
||||
else if (telNum.length() > 8
|
||||
&& (substring(telNum, 6, 1).equals("0")
|
||||
|| substring(telNum, 6, 1).equals("1") || substring(
|
||||
telNum, 6, 3).equals("400") || substring(
|
||||
telNum, 6, 3).equals("+86"))
|
||||
&& inArray(ippfx6, IPPFXS6))
|
||||
} else if (telNum.length() > 8
|
||||
&& ("0".equals(substring(telNum, 6, 1))
|
||||
|| "1".equals(substring(telNum, 6, 1)) || "400".equals(substring(
|
||||
telNum, 6, 3)) || "+86".equals(substring(
|
||||
telNum, 6, 3)))
|
||||
&& inArray(ippfx6, IPPFXS6)) {
|
||||
telNum = substring(telNum, 6);
|
||||
}
|
||||
// remove ip dial
|
||||
|
||||
telNum = telNum.replace("-", "");
|
||||
telNum = telNum.replace(" ", "");
|
||||
|
||||
if (substring(telNum, 0, 4).equals("0086"))
|
||||
if ("0086".equals(substring(telNum, 0, 4))) {
|
||||
telNum = substring(telNum, 4);
|
||||
else if (substring(telNum, 0, 3).equals("+86"))
|
||||
} else if ("+86".equals(substring(telNum, 0, 3))) {
|
||||
telNum = substring(telNum, 3);
|
||||
else if (substring(telNum, 0, 5).equals("00186"))
|
||||
} else if ("00186".equals(substring(telNum, 0, 5))) {
|
||||
telNum = substring(telNum, 5);
|
||||
}
|
||||
|
||||
return telNum;
|
||||
}
|
||||
|
||||
+1
-1
@@ -724,7 +724,7 @@ public class AuthThirdServiceImpl extends ServiceImpl<AuthThirdMapper, AuthThird
|
||||
*/
|
||||
private String autoCreateUser(AuthUser authUser, String platform, String clientType) {
|
||||
String email = authUser.getEmail();
|
||||
String phone = platform.equalsIgnoreCase("phone") ? authUser.getUsername() : null;
|
||||
String phone = "phone".equalsIgnoreCase(platform) ? authUser.getUsername() : null;
|
||||
String userId;
|
||||
|
||||
// 生成账号:来源 + "_" + 完整UUID,保证全局唯一性,避免截取导致的冲突
|
||||
|
||||
+3
-1
@@ -205,7 +205,9 @@ public class BizOrgServiceImpl extends ServiceImpl<BizOrgMapper, BizOrg> impleme
|
||||
* 递归标记叶子节点(没有children的节点设置isLeaf=true)
|
||||
*/
|
||||
private void markLeafNodes(List<JSONObject> nodes) {
|
||||
if (nodes == null) return;
|
||||
if (nodes == null) {
|
||||
return;
|
||||
}
|
||||
for (JSONObject node : nodes) {
|
||||
List<JSONObject> children = node.getBeanList("children", JSONObject.class);
|
||||
if (children == null || children.isEmpty()) {
|
||||
|
||||
+9
-6
@@ -28,14 +28,17 @@ public class WebSocketConfig {
|
||||
*/
|
||||
@Bean
|
||||
public ServerEndpointExporter serverEndpointExporter() {
|
||||
if (!(applicationContext instanceof WebApplicationContext webAppContext)) return null;
|
||||
|
||||
if (!(applicationContext instanceof WebApplicationContext webAppContext)) {
|
||||
return null;
|
||||
}
|
||||
ServletContext servletContext = webAppContext.getServletContext();
|
||||
if (servletContext == null) return null;
|
||||
|
||||
if (servletContext == null) {
|
||||
return null;
|
||||
}
|
||||
ServerContainer serverContainer = (ServerContainer) servletContext.getAttribute(ServerContainer.class.getName());
|
||||
if (serverContainer == null) return null;
|
||||
|
||||
if (serverContainer == null) {
|
||||
return null;
|
||||
}
|
||||
return new ServerEndpointExporter();
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -59,10 +59,10 @@ public class DevLogServiceImpl extends ServiceImpl<DevLogMapper, DevLog> impleme
|
||||
QueryWrapper<DevLog> queryWrapper = new QueryWrapper<DevLog>().checkSqlInjection();
|
||||
// page查询中排除较大的字段(提升查询速度)
|
||||
queryWrapper.select(DevLog.class, info ->
|
||||
!info.getColumn().equalsIgnoreCase("param_json")
|
||||
&& !info.getColumn().equalsIgnoreCase("result_json")
|
||||
&& !info.getColumn().equalsIgnoreCase("exe_message")
|
||||
&& !info.getColumn().equalsIgnoreCase("sign_data")
|
||||
!"param_json".equalsIgnoreCase(info.getColumn())
|
||||
&& !"result_json".equalsIgnoreCase(info.getColumn())
|
||||
&& !"exe_message".equalsIgnoreCase(info.getColumn())
|
||||
&& !"sign_data".equalsIgnoreCase(info.getColumn())
|
||||
);
|
||||
if(ObjectUtil.isNotEmpty(devLogPageParam.getCategory())) {
|
||||
queryWrapper.lambda().eq(DevLog::getCategory, devLogPageParam.getCategory());
|
||||
|
||||
+3
-1
@@ -443,7 +443,9 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
|
||||
* 递归标记叶子节点(没有children的节点设置isLeaf=true)
|
||||
*/
|
||||
private void markLeafNodes(List<JSONObject> nodes) {
|
||||
if (nodes == null) return;
|
||||
if (nodes == null) {
|
||||
return;
|
||||
}
|
||||
for (JSONObject node : nodes) {
|
||||
List<JSONObject> children = node.getBeanList("children", JSONObject.class);
|
||||
if (children == null || children.isEmpty()) {
|
||||
|
||||
+3
-3
@@ -149,7 +149,7 @@ public class SysUserApiProvider implements SysUserApi {
|
||||
// 查询结果
|
||||
String resultUserId = result.get();
|
||||
// 如果要求查最高层级主管
|
||||
if(supervisorLevel.equals("-1")) {
|
||||
if("-1".equals(supervisorLevel)) {
|
||||
if(ObjectUtil.isEmpty(resultUserId)) {
|
||||
// 查不到,则当前用户就是最高层级主管
|
||||
if(ObjectUtil.isEmpty(userIdList)) {
|
||||
@@ -178,7 +178,7 @@ public class SysUserApiProvider implements SysUserApi {
|
||||
// 由最低级向高级查,首先主管级别减1
|
||||
String nextLevel = Convert.toStr(Convert.toInt(supervisorLevel) - 1);
|
||||
// 如果减1后级别为0,表示查一级直属主管
|
||||
if(nextLevel.equals("0")) {
|
||||
if("0".equals(nextLevel)) {
|
||||
// 则当前结果就是一级直属主管
|
||||
return JSONUtil.createObj().set("id", resultUserId).set("idList", CollectionUtil.newArrayList(resultUserId));
|
||||
} else {
|
||||
@@ -200,7 +200,7 @@ public class SysUserApiProvider implements SysUserApi {
|
||||
@Override
|
||||
public List<String> getMulSupervisorIdListByEndLevel(String initiator, String orgId, String endLevel) {
|
||||
List<String> resultList = CollectionUtil.newArrayList();
|
||||
if(endLevel.equals("-1")) {
|
||||
if("-1".equals(endLevel)) {
|
||||
List<String> idList = this.getSupervisorIdBySupervisorLevel(initiator, CollectionUtil.newArrayList(), orgId, endLevel)
|
||||
.getBeanList("idList", String.class);
|
||||
if(ObjectUtil.isNotEmpty(idList)) {
|
||||
|
||||
Reference in New Issue
Block a user