From fd52ede2e8987fdee8572b2305905f169d150e14 Mon Sep 17 00:00:00 2001 From: LuoYe Date: Mon, 16 Jan 2023 09:14:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=97=A5=E5=BF=97=E7=AD=89?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/io/qyi/e5/config/Start.java | 4 ++-- .../security/GithubAuth2AuthenticationConfig.java | 2 +- .../io/qyi/e5/config/security/SecurityConfig.java | 4 ++-- .../e5/config/security/UrlAccessDecisionManager.java | 4 ++-- .../UsernamePasswordAuthenticationToken.java | 4 ++-- .../filter/GithubLoginAuthenticationFilter.java | 2 +- .../e5/github/service/impl/GithubServiceImpl.java | 2 -- .../e5/outlook/service/impl/OutlookServiceImpl.java | 12 ++++++------ src/main/java/io/qyi/e5/util/StringUtil.java | 1 - src/main/resources/log4j2.xml | 2 +- src/test/java/influxdb2Test.java | 8 -------- 11 files changed, 17 insertions(+), 28 deletions(-) diff --git a/src/main/java/io/qyi/e5/config/Start.java b/src/main/java/io/qyi/e5/config/Start.java index 5390ae2..e495dc0 100644 --- a/src/main/java/io/qyi/e5/config/Start.java +++ b/src/main/java/io/qyi/e5/config/Start.java @@ -94,7 +94,7 @@ public class Start { } catch (InterruptedException e) { e.printStackTrace(); } - log.info("本轮调用完成!"); + log.debug("本轮调用完成!"); } /*任务执行*/ @@ -108,7 +108,7 @@ public class Start { @SneakyThrows @Override public void run() { - System.out.println("消费数据: " + value); + // System.out.println("消费数据: " + value); Task.listen(new OutlookMq(value.getGithubId(), value.getId())); this.cdl.countDown(); } diff --git a/src/main/java/io/qyi/e5/config/security/GithubAuth2AuthenticationConfig.java b/src/main/java/io/qyi/e5/config/security/GithubAuth2AuthenticationConfig.java index eb389b2..73ffe29 100644 --- a/src/main/java/io/qyi/e5/config/security/GithubAuth2AuthenticationConfig.java +++ b/src/main/java/io/qyi/e5/config/security/GithubAuth2AuthenticationConfig.java @@ -31,7 +31,7 @@ public class GithubAuth2AuthenticationConfig extends SecurityConfigurerAdapter() { @Override public O postProcess(O object) { - log.info("加载自定义url权限"); + log.debug("加载自定义url权限"); object.setAccessDecisionManager(myAccessDecisionManager); object.setSecurityMetadataSource(myInvocationSecurityMetadataSourceService); return object; diff --git a/src/main/java/io/qyi/e5/config/security/UrlAccessDecisionManager.java b/src/main/java/io/qyi/e5/config/security/UrlAccessDecisionManager.java index f40ca51..6224428 100644 --- a/src/main/java/io/qyi/e5/config/security/UrlAccessDecisionManager.java +++ b/src/main/java/io/qyi/e5/config/security/UrlAccessDecisionManager.java @@ -56,13 +56,13 @@ public class UrlAccessDecisionManager implements AccessDecisionManager { @Override public boolean supports(ConfigAttribute configAttribute) { - log.info("进入权限判断! ConfigAttribute configAttribute"); + log.debug("进入权限判断! ConfigAttribute configAttribute"); return true; } @Override public boolean supports(Class aClass) { - log.info("进入权限判断! Class aClass"); + log.debug("进入权限判断! Class aClass"); return true; } } diff --git a/src/main/java/io/qyi/e5/config/security/UsernamePasswordAuthenticationToken.java b/src/main/java/io/qyi/e5/config/security/UsernamePasswordAuthenticationToken.java index 43f626f..1324055 100644 --- a/src/main/java/io/qyi/e5/config/security/UsernamePasswordAuthenticationToken.java +++ b/src/main/java/io/qyi/e5/config/security/UsernamePasswordAuthenticationToken.java @@ -44,7 +44,7 @@ public class UsernamePasswordAuthenticationToken extends AbstractAuthenticationT super(null); this.code = code; super.setAuthenticated(false); - logger.info("创建未认证的用户名密码认证对象1 setAuthenticated ->false loading ..."); + logger.debug("创建未认证的用户名密码认证对象1 setAuthenticated ->false loading ..."); } // 创建未认证的用户名密码认证对象 @@ -53,7 +53,7 @@ public class UsernamePasswordAuthenticationToken extends AbstractAuthenticationT this.code = code; this.state = state; super.setAuthenticated(false); - logger.info("创建未认证的用户名密码认证对象2 setAuthenticated ->false loading ..."); + logger.debug("创建未认证的用户名密码认证对象2 setAuthenticated ->false loading ..."); } diff --git a/src/main/java/io/qyi/e5/config/security/filter/GithubLoginAuthenticationFilter.java b/src/main/java/io/qyi/e5/config/security/filter/GithubLoginAuthenticationFilter.java index 21a158c..d8d3f49 100644 --- a/src/main/java/io/qyi/e5/config/security/filter/GithubLoginAuthenticationFilter.java +++ b/src/main/java/io/qyi/e5/config/security/filter/GithubLoginAuthenticationFilter.java @@ -49,7 +49,7 @@ public class GithubLoginAuthenticationFilter extends AbstractAuthenticationProce @Override public Authentication attemptAuthentication(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws AuthenticationException, IOException, ServletException { - log.info("接收github回调参数!"); + log.debug("接收github回调参数!"); /*if (!httpServletRequest.getMethod().equals(HttpMethod.POST.name())) { throw new AuthenticationServiceException("不支持该验证方法: " + httpServletRequest.getMethod()); } else { diff --git a/src/main/java/io/qyi/e5/github/service/impl/GithubServiceImpl.java b/src/main/java/io/qyi/e5/github/service/impl/GithubServiceImpl.java index 2cef9d2..ad75054 100644 --- a/src/main/java/io/qyi/e5/github/service/impl/GithubServiceImpl.java +++ b/src/main/java/io/qyi/e5/github/service/impl/GithubServiceImpl.java @@ -46,7 +46,6 @@ public class GithubServiceImpl extends ServiceImpl impleme } catch (Exception e) { e.printStackTrace(); } - System.out.println(s); Map map = StringUtil.ParsingUrl(s); return map.get("access_token"); } @@ -57,7 +56,6 @@ public class GithubServiceImpl extends ServiceImpl impleme head.put("Authorization", "token " + access_token); head.put("Content-Type", "application/vnd.github.machine-man-preview+json"); String s = OkHttpClientUtil.doGet("https://api.github.com/user/emails", null,head, null); - System.out.println(s); JSONArray jsonArray = JSON.parseArray(s); if (!jsonArray.isEmpty()) { for (int i = 0; i < jsonArray.size(); i++) { diff --git a/src/main/java/io/qyi/e5/outlook/service/impl/OutlookServiceImpl.java b/src/main/java/io/qyi/e5/outlook/service/impl/OutlookServiceImpl.java index 0e79cb2..7c66b1b 100644 --- a/src/main/java/io/qyi/e5/outlook/service/impl/OutlookServiceImpl.java +++ b/src/main/java/io/qyi/e5/outlook/service/impl/OutlookServiceImpl.java @@ -61,7 +61,7 @@ public class OutlookServiceImpl extends ServiceImpl impl par.put("grant_type", grant_type); String s = OkHttpClientUtil.doPost("https://login.microsoftonline.com/" + tenantId + "/oauth2/v2.0/token", head, par); JSONObject jsonObject = JSON.parseObject(s); - logger.info("请求access_token返回数据:" + s); + logger.debug("请求access_token返回数据:" + s); if (jsonObject.get("error") != null) { logger.error("错授权误!"); throw new APIException(jsonObject.get("error_description").toString()); @@ -102,7 +102,7 @@ public class OutlookServiceImpl extends ServiceImpl impl outlook.setName(name); outlook.setDescribes(describe); outlook.setGithubId(github_id); - logger.info(outlook.toString()); + logger.debug(outlook.toString()); if (baseMapper.insert(outlook) != 1) { throw new APIException(APiCode.OUTLOOK_INSERT_ERROR); } @@ -233,7 +233,7 @@ public class OutlookServiceImpl extends ServiceImpl impl if (!errorCheck(message)) { throw new Exception("无法刷新令牌!code:3" + message); } - logger.info("令牌过期!"); + logger.debug("令牌过期!"); /*刷新令牌*/ String token = refresh_token(outlook); if (token == null) { @@ -320,10 +320,10 @@ public class OutlookServiceImpl extends ServiceImpl impl par.put("refresh_token", outlook.getRefreshToken()); String s = null; s = OkHttpClientUtil.doPost("https://login.microsoftonline.com/" + outlook.getTenantId() + "/oauth2/v2.0/token", head, par); - logger.info("请求刷新列表返回数据:" + s); + logger.debug("请求刷新列表返回数据:" + s); JSONObject jsonObject = JSON.parseObject(s); if (!jsonObject.containsKey("access_token")) { - logger.info("返回的access_token字段不存在"); + logger.debug("返回的access_token字段不存在"); throw new Exception("返回的access_token字段不存在,无法刷新令牌! 需要重新授权!"); } outlook.setRefreshToken(jsonObject.getString("refresh_token")); @@ -332,7 +332,7 @@ public class OutlookServiceImpl extends ServiceImpl impl QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("client_id", outlook.getClientId()); if (baseMapper.update(outlook, queryWrapper) != 1) { - logger.info("返更新行数不为1"); + logger.debug("返更新行数不为1"); throw new Exception("更新数据库时发现有重复的key"); } return outlook.getAccessToken(); diff --git a/src/main/java/io/qyi/e5/util/StringUtil.java b/src/main/java/io/qyi/e5/util/StringUtil.java index 1196112..da0ee61 100644 --- a/src/main/java/io/qyi/e5/util/StringUtil.java +++ b/src/main/java/io/qyi/e5/util/StringUtil.java @@ -17,7 +17,6 @@ public class StringUtil { for (int i = 0; i < split.length; i++) { String[] split1 = split[i].split("="); if (split1.length > 1) { - System.out.println(split1[0] + " --- " + split1[1]); map.put(split1[0], split1[1]); } else { map.put(split1[0], ""); diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml index 6531f06..2258e9a 100644 --- a/src/main/resources/log4j2.xml +++ b/src/main/resources/log4j2.xml @@ -84,7 +84,7 @@ - + diff --git a/src/test/java/influxdb2Test.java b/src/test/java/influxdb2Test.java index b32c266..15bc728 100644 --- a/src/test/java/influxdb2Test.java +++ b/src/test/java/influxdb2Test.java @@ -55,7 +55,6 @@ public class influxdb2Test { .addFields(beanMap); list1.add(point); }); - System.out.println("list 大小:" + list1.size()); Map aa = new HashMap<>(); aa.put("a1", 1); writeApi.writePoint("e5", org, list1.get(0)); @@ -125,9 +124,7 @@ public class influxdb2Test { for (FluxRecord fluxRecord : records) { // System.out.println(fluxRecord.getField()); - System.out.println(fluxRecord.getField() + " ->" + fluxRecord.getValueByKey("_value")); } - System.out.println("------------------------------------------"); } influxDBClient.close(); } @@ -140,16 +137,13 @@ public class influxdb2Test { "|> filter(fn: (r) => r[\"outlookId\"] == \"38\")" + "|> pivot(rowKey:[\"_time\"], columnKey: [\"_field\"], valueColumn: \"_value\")"; QueryApi queryApi = influxDBClient.getQueryApi(); - System.out.println(System.currentTimeMillis()); List tables = queryApi.query(flux, org, OutlookLog.class); - System.out.println(System.currentTimeMillis()); for (OutlookLog table : tables) { if (table.getMsg() == null) { continue; } // System.out.println(table); } - System.out.println("tables 大小:" + tables.size()); influxDBClient.close(); } @@ -163,11 +157,9 @@ public class influxdb2Test { QueryApi queryApi = influxDBClient.getQueryApi(); queryApi.query(flux, org, OutlookLog.class, (cancellable, outlookLog) -> { if (outlookLog.getMsg() != null) { - System.out.println(outlookLog); } }); - System.out.println("查询完成"); Thread.sleep(5_000); influxDBClient.close(); }