Commit 3b394d445b09597a22c3c0f74fe07e63ae6b7393
1 parent
480095ac
update...
Showing
3 changed files
with
10 additions
and
4 deletions
src/main/java/com/bsth/redis/OilRedisService.java
| 1 | 1 | package com.bsth.redis; |
| 2 | 2 | |
| 3 | +import com.bsth.Application; | |
| 3 | 4 | import com.bsth.entity.OilInfo; |
| 4 | 5 | import com.bsth.redis.util.RedisUtils; |
| 5 | 6 | import com.bsth.repository.OilInfoRepository; |
| ... | ... | @@ -18,6 +19,7 @@ import org.springframework.stereotype.Component; |
| 18 | 19 | import org.springframework.stereotype.Service; |
| 19 | 20 | |
| 20 | 21 | import java.util.*; |
| 22 | +import java.util.concurrent.TimeUnit; | |
| 21 | 23 | |
| 22 | 24 | /** |
| 23 | 25 | * 油量数据Redis缓存 |
| ... | ... | @@ -122,7 +124,7 @@ public class OilRedisService implements CommandLineRunner { |
| 122 | 124 | @Override |
| 123 | 125 | public void run(String... strings) throws Exception { |
| 124 | 126 | //定时刷新油耗信息 |
| 125 | - //Application.mainServices.scheduleWithFixedDelay(oilRefreshThread, 40, 60 * 40, TimeUnit.SECONDS); | |
| 127 | + Application.mainServices.scheduleWithFixedDelay(oilRefreshThread, 40, 60 * 40, TimeUnit.SECONDS); | |
| 126 | 128 | } |
| 127 | 129 | |
| 128 | 130 | /** | ... | ... |
src/main/java/com/bsth/redis/PlanScheduleRedisService.java
| 1 | 1 | package com.bsth.redis; |
| 2 | 2 | |
| 3 | +import com.bsth.Application; | |
| 3 | 4 | import com.bsth.entity.SchedulePlanInfo; |
| 5 | +import com.bsth.redis.util.DateUtils; | |
| 4 | 6 | import com.bsth.redis.util.RedisUtils; |
| 5 | 7 | import com.bsth.repository.SchedulePlanInfoRepository; |
| 6 | 8 | import com.bsth.server_rs.base_info.line.Line; |
| ... | ... | @@ -16,6 +18,7 @@ import org.springframework.boot.CommandLineRunner; |
| 16 | 18 | import org.springframework.core.annotation.Order; |
| 17 | 19 | import org.springframework.data.redis.core.ListOperations; |
| 18 | 20 | import org.springframework.data.redis.core.RedisTemplate; |
| 21 | +import org.springframework.data.redis.serializer.StringRedisSerializer; | |
| 19 | 22 | import org.springframework.stereotype.Component; |
| 20 | 23 | import org.springframework.stereotype.Service; |
| 21 | 24 | |
| ... | ... | @@ -23,6 +26,7 @@ import java.util.ArrayList; |
| 23 | 26 | import java.util.Date; |
| 24 | 27 | import java.util.Iterator; |
| 25 | 28 | import java.util.List; |
| 29 | +import java.util.concurrent.TimeUnit; | |
| 26 | 30 | |
| 27 | 31 | /** |
| 28 | 32 | * 计调的 计划排班redis缓存 |
| ... | ... | @@ -120,7 +124,7 @@ public class PlanScheduleRedisService implements CommandLineRunner { |
| 120 | 124 | |
| 121 | 125 | @Override |
| 122 | 126 | public void run(String... strings) throws Exception { |
| 123 | - /*int cacheDays = Integer.parseInt(ConfigUtil.get("cache.days")); | |
| 127 | + int cacheDays = Integer.parseInt(ConfigUtil.get("cache.days")); | |
| 124 | 128 | //设置key 序列化器 |
| 125 | 129 | redisTemplate.setKeySerializer(new StringRedisSerializer()); |
| 126 | 130 | |
| ... | ... | @@ -135,7 +139,7 @@ public class PlanScheduleRedisService implements CommandLineRunner { |
| 135 | 139 | long diff = (DateUtils.getTimestamp() + 1000 * 60 * 5) - System.currentTimeMillis(); |
| 136 | 140 | if (diff < 0) |
| 137 | 141 | diff += (1000 * 60 * 60 * 24); |
| 138 | - Application.mainServices.scheduleAtFixedRate(planClearThread, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS);*/ | |
| 142 | + Application.mainServices.scheduleAtFixedRate(planClearThread, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | |
| 139 | 143 | } |
| 140 | 144 | |
| 141 | 145 | public List<SchedulePlanInfo> findByMultiLine(List<String> lineArray, String rq) { | ... | ... |
src/main/resources/application.properties