浏览代码

规范日志 去除冗余打印

yumeng 5 年之前
父节点
当前提交
35b5db09a8

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/RefreshTokenJob.java

@@ -17,7 +17,7 @@ public class RefreshTokenJob implements Job {
      * @throws JobExecutionException
      */
     @Override
-    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+    public void execute(JobExecutionContext jobExecutionContext) {
         refreshTokenService.getRefresh();
     }
 }

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/ICTopOauthTokenService.java

@@ -1,7 +1,7 @@
 package org.jeecg.modules.ctop.service;
 
-import org.jeecg.modules.ctop.entity.CTopOauthToken;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.ctop.entity.CTopOauthToken;
 
 import java.util.Map;
 
@@ -17,5 +17,5 @@ public interface ICTopOauthTokenService extends IService<CTopOauthToken> {
 
     Map<String, Object> getByteDanceAccessToken(String accountId);
 
-    Map<String,Object> getKuaiShouRefreshToken(Long accountId,String refreshToken);
+    Map<String, Object> getKuaiShouRefreshToken(Long accountId, String refreshToken);
 }

+ 1 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IRefreshTokenService.java

@@ -1,9 +1,5 @@
 package org.jeecg.modules.ctop.service;
 
-import org.jeecg.modules.ctop.entity.CTopOauthToken;
-
-import java.util.List;
-
 public interface IRefreshTokenService {
-    List<CTopOauthToken> getRefresh();
+    void getRefresh();
 }

+ 5 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CTopOauthTokenServiceImpl.java

@@ -3,7 +3,6 @@ package org.jeecg.modules.ctop.service.impl;
 import cn.com.ctop.common.utils.Check;
 import cn.com.ctop.common.utils.HttpUtils;
 import cn.com.ctop.common.utils.PropertiesUtils;
-import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
 import cn.com.ctop.toutiao.common.BytedanceInterfaceConstant;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -120,7 +119,11 @@ public class CTopOauthTokenServiceImpl extends ServiceImpl<CTopOauthTokenMapper,
                             Date refreshTokenExpireInDate = new Date(now + refreshTokenExpireIn);
                             oauthToken.setRefreshTokenExpiresIn(refreshTokenExpireInDate);
                             oauthToken.setUpdateTime(new Date());
-                            cTopOauthTokenMapper.updateByPrimaryKeySelective(oauthToken);
+                            int i = cTopOauthTokenMapper.updateByPrimaryKeySelective(oauthToken);
+                            if (i > 0) {
+                                logger.info("快手刷新token成功,accountId:{}", accountId);
+
+                            }
                         }
                     }
                 } else {

+ 7 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/RefreshTokenServiceImpl.java

@@ -5,6 +5,8 @@ import org.jeecg.modules.ctop.entity.CTopOauthToken;
 import org.jeecg.modules.ctop.mapper.CTopOauthTokenMapper;
 import org.jeecg.modules.ctop.service.ICTopOauthTokenService;
 import org.jeecg.modules.ctop.service.IRefreshTokenService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -12,6 +14,7 @@ import java.util.List;
 
 @Service
 public class RefreshTokenServiceImpl implements IRefreshTokenService {
+    private static final Logger logger = LoggerFactory.getLogger(RefreshTokenServiceImpl.class);
     @Autowired
     private CTopOauthTokenMapper oauthTokenMapper;
     @Autowired
@@ -23,10 +26,9 @@ public class RefreshTokenServiceImpl implements IRefreshTokenService {
      * @return
      */
     @Override
-    public List<CTopOauthToken> getRefresh() {
-
+    public void getRefresh() {
         List<CTopOauthToken> oauthTokens = oauthTokenMapper.selectAll();
-
+        logger.info("需要刷新token列表长度:{}", oauthTokens.size());
         if (!Check.isNull(oauthTokens)) {
             for (CTopOauthToken oauthToken : oauthTokens) {
                 if ("1".equals(oauthToken.getMediaId().trim())) { //头条
@@ -37,9 +39,8 @@ public class RefreshTokenServiceImpl implements IRefreshTokenService {
                 }
 
             }
+        } else {
+            logger.error("----------------------刷新token获取数据返回结果为空----------------------------------");
         }
-
-        System.err.println(oauthTokens);
-        return null;
     }
 }