From 1beab335e114e2587fefba2fac8b433ee46cdd11 Mon Sep 17 00:00:00 2001 From: k94314517 <8417338+k94314517@user.noreply.gitee.com> Date: 星期五, 22 十二月 2023 16:07:14 +0800 Subject: [PATCH] ERP接口 --- server/dmvisit_web/src/main/java/com/doumee/api/ScheduleTool.java | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/server/dmvisit_web/src/main/java/com/doumee/api/ScheduleTool.java b/server/dmvisit_web/src/main/java/com/doumee/api/ScheduleTool.java index 63d5a5a..a0fc90a 100644 --- a/server/dmvisit_web/src/main/java/com/doumee/api/ScheduleTool.java +++ b/server/dmvisit_web/src/main/java/com/doumee/api/ScheduleTool.java @@ -7,6 +7,7 @@ import com.doumee.core.utils.HttpsUtil; import com.doumee.core.wx.WXConstant; import com.doumee.dao.system.model.SystemDictData; +import com.doumee.service.system.SystemDictDataService; import lombok.extern.slf4j.Slf4j; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; @@ -14,6 +15,8 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.mgt.DefaultSecurityManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.EnableScheduling; @@ -32,14 +35,16 @@ * @date 2021-10-10 14:40:35 * https://www.bejson.com/othertools/cron/ cron 琛ㄨ揪寮忕敓鎴愬湴鍧� */ -@Slf4j @Component @EnableScheduling +@Slf4j public class ScheduleTool { @Autowired private SystemDictDataBiz systemDictDataBiz; + @Autowired + private SystemDictDataService systemDictDataService; /** * 鏄惁寮�鍙戣�� */ @@ -52,6 +57,9 @@ */ @Scheduled(fixedDelay=1000 * 60 * 90) public void updAccessToken(){ + DefaultSecurityManager securityManager = new DefaultSecurityManager(); + SecurityUtils.setSecurityManager(securityManager); + String appId = systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_APPID).getCode(); String appSecret = systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_SECRET).getCode(); //鐢熸垚寰俊token @@ -62,7 +70,7 @@ if(!Objects.isNull(systemDictData)){ systemDictData.setCode(json.getString("access_token")); systemDictData.setUpdateTime(new Date()); - systemDictDataBiz.updateByIdNew(systemDictData); + systemDictDataService.updateById(systemDictData); log.info(" 鏇存柊寰俊鍏紬鍙� ACCESS_TOKEN =========> " + systemDictData.getCode() ); } } -- Gitblit v1.9.3