xyc
2025-02-21 664db98c9e8595ce4dd636a27f480e3a08b81ff5
starter/src/main/java/com/zt/life/AdminApplication.java
@@ -19,10 +19,9 @@
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.annotation.EnableScheduling;
import java.io.File;
import java.text.ParseException;
/**
 * @author hehz
@@ -34,6 +33,7 @@
        org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class})
@EnableCaching
@EnableAsync
@EnableScheduling
public class AdminApplication extends SpringBootServletInitializer {
    @Value("${zt.oss.local-path}")
@@ -59,12 +59,12 @@
        return factory;
    }
    @Scheduled(cron = "0 0 3 * * ?") //每天3点执行
    public void timerListener() throws ParseException {
/*        projectService.dropTemporaryTable();
        projectService.updateHasLifeData();
        this.deleteTempFile();*/
    }
//    @Scheduled(cron = "0 0 3 * * ?") //每天3点执行
//    public void timerListener() throws ParseException {
///*        projectService.dropTemporaryTable();
//        projectService.updateHasLifeData();
//        this.deleteTempFile();*/
//    }
    private void deleteTempFile() {
        String tempUploadDir = localPath + File.separator + "TEMP_UPLOAD";
@@ -78,10 +78,6 @@
    @Bean
    public RedisTemplate<String, Object> redisTemplate() {
        try {
            this.timerListener();
        } catch (Exception e) {
        }
        RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
        // 暂时先设置key和value的序列化都是字符串
        redisTemplate.setKeySerializer(new StringRedisSerializer());