| | |
| | | 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; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.FileWriter; |
| | | import java.io.IOException; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @EnableScheduling |
| | | 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 { |
| | | fileWriter = new FileWriter("src/main/resources/log.log"); |
| | | fileWriter.write(""); |
| | | fileWriter.close(); |
| | | } catch (IOException ignored) {} |
| | | //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; |
| | | //import org.springframework.beans.factory.annotation.Autowired; |
| | | //import org.springframework.scheduling.annotation.EnableScheduling; |
| | | //import org.springframework.scheduling.annotation.Scheduled; |
| | | //import org.springframework.stereotype.Component; |
| | | // |
| | | //import java.io.FileWriter; |
| | | //import java.io.IOException; |
| | | // |
| | | //@Slf4j |
| | | //@Component |
| | | //@EnableScheduling |
| | | //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(); |
| | | // } |
| | | dictionaryUtilNew.exec1(); |
| | | } |
| | | } |
| | | // 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(); |
| | | // } |
| | | //} |