From 3a86c9c6879971051ab1e01a5b9b88eed27e55db Mon Sep 17 00:00:00 2001 From: lishuai <260038442@qq.com> Date: 星期五, 15 十二月 2023 17:57:29 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- server/dmvisit_admin/src/main/java/com/doumee/task/ScheduleTool.java | 80 +++++++++------------------------------- 1 files changed, 18 insertions(+), 62 deletions(-) diff --git a/server/dmvisit_admin/src/main/java/com/doumee/task/ScheduleTool.java b/server/dmvisit_admin/src/main/java/com/doumee/task/ScheduleTool.java index 9369302..3ad095e 100644 --- a/server/dmvisit_admin/src/main/java/com/doumee/task/ScheduleTool.java +++ b/server/dmvisit_admin/src/main/java/com/doumee/task/ScheduleTool.java @@ -1,23 +1,13 @@ package com.doumee.task; -import com.doumee.biz.system.SystemDictDataBiz; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.utils.URIBuilder; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; +import com.doumee.service.business.impl.hksync.HkSyncImgServiceImpl; +import com.doumee.service.business.impl.hksync.HkSyncOrgUserServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; - -import java.io.IOException; -import java.net.URI; -import java.util.Date; -import java.util.Map; /** * 瀹氭椂浠诲姟 @@ -29,9 +19,10 @@ @EnableScheduling public class ScheduleTool { - @Autowired - private SystemDictDataBiz systemDictDataBiz; + private HkSyncImgServiceImpl hkSyncImgService; + @Autowired + private HkSyncOrgUserServiceImpl hkSyncOrgUserService; /** * 鏄惁寮�鍙戣�� */ @@ -43,60 +34,25 @@ * 缂撳瓨鐪佸競鍖� * @throws Exception */ - @Scheduled(fixedDelay=24*60*60*1000) - public void cacheCampus() throws Exception { + @Scheduled(fixedDelay= 60*1000) + public void downloadHkImg() throws Exception { + hkSyncImgService.downHKImgs(0); } - /** - * 姣忓ぉ鍑屾櫒閲嶇疆鎵�鏈夎鍗昪ode绫诲垵濮嬪�� + /** + * 瀹氭椂鍚屾缁勭粐淇℃伅鍒版捣搴风郴缁� * @throws Exception */ - @Scheduled(cron="0 0 0 * * ?") - public void resetOrderCodes() throws Exception { + @Scheduled(fixedDelay= 60*1000) + public void syncOrgData() { + hkSyncOrgUserService.syncOrgData(); } - - - /** - * 鍙戦�乬et璇锋眰 - * @param url 璇锋眰URL - * @param param 璇锋眰鍙傛暟 key:value url鎼哄甫鍙傛暟 鎴栬�呮棤鍙傚彲涓嶅~ - * @return + * 瀹氭椂鍚屾鐢ㄦ埛淇℃伅鍒版捣搴风郴缁� + * @throws Exception */ - public String doGet(String url, Map<String, String> param) { - // 鍒涘缓Httpclient瀵硅薄 - CloseableHttpClient httpclient = HttpClients.createDefault(); - String resultString = ""; - CloseableHttpResponse response = null; - try { - // 鍒涘缓uri - URIBuilder builder = new URIBuilder(url); - if (param != null) { - for (String key : param.keySet()) { - builder.addParameter(key, param.get(key)); - } - } - URI uri = builder.build(); - // 鍒涘缓http GET璇锋眰 - HttpGet httpGet = new HttpGet(uri); - // 鎵ц璇锋眰 - response = httpclient.execute(httpGet); - // 鍒ゆ柇杩斿洖鐘舵�佹槸鍚︿负200 - if (response.getStatusLine().getStatusCode() == 200) { - resultString = EntityUtils.toString(response.getEntity(), "UTF-8"); - } - } catch (Exception e) { - e.printStackTrace(); - } finally { - try { - if (response != null) { - response.close(); - } - httpclient.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - return resultString; + @Scheduled(fixedDelay= 60*1000) + public void syncUserData() { + hkSyncImgService.syncUserData(); } } -- Gitblit v1.9.3