Commit 4694ac94ad092c6c65f53099bb963bbf642a4d3f
1 parent
eaf80057
1.
Showing
2 changed files
with
22 additions
and
2 deletions
src/main/java/com/bsth/entity/DailyMileage.java
| @@ -36,6 +36,10 @@ public class DailyMileage { | @@ -36,6 +36,10 @@ public class DailyMileage { | ||
| 36 | 36 | ||
| 37 | private double outServiceMileage; | 37 | private double outServiceMileage; |
| 38 | 38 | ||
| 39 | + private int realOutCount; | ||
| 40 | + | ||
| 41 | + private int realInCount; | ||
| 42 | + | ||
| 39 | public String getScheduleDate() { | 43 | public String getScheduleDate() { |
| 40 | return scheduleDate; | 44 | return scheduleDate; |
| 41 | } | 45 | } |
| @@ -147,4 +151,20 @@ public class DailyMileage { | @@ -147,4 +151,20 @@ public class DailyMileage { | ||
| 147 | public void setOutServiceMileage(double outServiceMileage) { | 151 | public void setOutServiceMileage(double outServiceMileage) { |
| 148 | this.outServiceMileage = outServiceMileage; | 152 | this.outServiceMileage = outServiceMileage; |
| 149 | } | 153 | } |
| 154 | + | ||
| 155 | + public int getRealOutCount() { | ||
| 156 | + return realOutCount; | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + public void setRealOutCount(int realOutCount) { | ||
| 160 | + this.realOutCount = realOutCount; | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + public int getRealInCount() { | ||
| 164 | + return realInCount; | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + public void setRealInCount(int realInCount) { | ||
| 168 | + this.realInCount = realInCount; | ||
| 169 | + } | ||
| 150 | } | 170 | } |
src/main/java/com/bsth/server_rs/mileage/MileageCache.java
| @@ -29,15 +29,15 @@ public class MileageCache { | @@ -29,15 +29,15 @@ public class MileageCache { | ||
| 29 | @Autowired | 29 | @Autowired |
| 30 | private JdbcTemplate jdbcTemplate; | 30 | private JdbcTemplate jdbcTemplate; |
| 31 | 31 | ||
| 32 | - @Scheduled(cron = "0 30 3/1 * * ?") | 32 | + @Scheduled(cron = "0 30 0/1 * * ?") |
| 33 | public void load() { | 33 | public void load() { |
| 34 | Map<String, List<DailyMileage>> date2mileages = new ConcurrentHashMap<>(); | 34 | Map<String, List<DailyMileage>> date2mileages = new ConcurrentHashMap<>(); |
| 35 | DateTime dateTime = new DateTime(); | 35 | DateTime dateTime = new DateTime(); |
| 36 | for (int i = 0;i < days;i++) { | 36 | for (int i = 0;i < days;i++) { |
| 37 | - dateTime = dateTime.minusDays(1); | ||
| 38 | String date = dateTime.toString("yyyy-MM-dd"); | 37 | String date = dateTime.toString("yyyy-MM-dd"); |
| 39 | List<DailyMileage> dailyMileages = jdbcTemplate.query("SELECT * FROM statistics.bsth_c_mileage_statistic WHERE schedule_date = ?", new Object[]{ date }, BeanPropertyRowMapper.newInstance(DailyMileage.class)); | 38 | List<DailyMileage> dailyMileages = jdbcTemplate.query("SELECT * FROM statistics.bsth_c_mileage_statistic WHERE schedule_date = ?", new Object[]{ date }, BeanPropertyRowMapper.newInstance(DailyMileage.class)); |
| 40 | date2mileages.put(date, dailyMileages); | 39 | date2mileages.put(date, dailyMileages); |
| 40 | + dateTime = dateTime.minusDays(1); | ||
| 41 | } | 41 | } |
| 42 | if (date2mileages.size() > 0) { | 42 | if (date2mileages.size() > 0) { |
| 43 | DATE_MILEAGES.clear(); | 43 | DATE_MILEAGES.clear(); |