From d3e9ae0b5f000e52bd54962644be8e9feec0df4a Mon Sep 17 00:00:00 2001 From: zhaowenxuan <chacca165@163.com> Date: 星期四, 19 十二月 2024 18:04:42 +0800 Subject: [PATCH] 20241219 --- src/main/java/com/example/scheudleds/DictSync.java | 27 ++++++++++++++++++++++----- 1 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/example/scheudleds/DictSync.java b/src/main/java/com/example/scheudleds/DictSync.java index 96f1800..a66ba58 100644 --- a/src/main/java/com/example/scheudleds/DictSync.java +++ b/src/main/java/com/example/scheudleds/DictSync.java @@ -1,6 +1,9 @@ package com.example.scheudleds; +import cn.hutool.core.util.StrUtil; +import com.example.config.ConfigValue; import com.example.utils.DictionaryUtil; +import com.example.utils.DictionaryUtilNew; import lombok.extern.slf4j.Slf4j; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -9,6 +12,7 @@ import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; +import java.io.FileWriter; import java.io.IOException; @Slf4j @@ -17,17 +21,30 @@ public class DictSync { @Autowired private DictionaryUtil dictionaryUtil; + @Autowired + private DictionaryUtilNew dictionaryUtilNew; + @Autowired + private ConfigValue configValue; /** * 瀛楀吀鍚屾 */ @Scheduled(cron = "0 0 22 * * ? ") public void execDict(){ + String open = configValue.getConfigValue("sjpt_open"); + if (StrUtil.isNotBlank(open) && open.equals("false")) return; + FileWriter fileWriter = null; try { - dictionaryUtil.exec1(); - } catch (IOException e) { - log.error("瀹氭椂浠诲姟寮傚父"); - e.printStackTrace(); - } + fileWriter = new FileWriter("src/main/resources/log.log"); + fileWriter.write(""); + fileWriter.close(); + } catch (IOException ignored) {} +// try { +// dictionaryUtil.exec1(); +// } catch (IOException e) { +// log.error("瀹氭椂浠诲姟寮傚父"); +// e.printStackTrace(); +// } + dictionaryUtilNew.exec1(); } } -- Gitblit v1.8.0