Commit 273f2bded29f5f84662e31e30d8708da5bd5ac90
1 parent
17b2c875
1.路单公里统计口径和调度系统统一
Showing
2 changed files
with
22 additions
and
17 deletions
src/main/java/com/bsth/redis/ScheduleRedisService.java
| ... | ... | @@ -192,17 +192,22 @@ public class ScheduleRedisService implements CommandLineRunner { |
| 192 | 192 | Application.mainServices.schedule(new Runnable() { |
| 193 | 193 | @Override |
| 194 | 194 | public void run() { |
| 195 | - int cacheDays = Integer.parseInt(ConfigUtil.get("cache.days")); | |
| 196 | - //设置key 序列化器 | |
| 197 | - redisTemplate.setKeySerializer(new StringRedisSerializer()); | |
| 198 | - | |
| 199 | - DateTime dt = new DateTime(); | |
| 200 | - dt = dt.minusDays(cacheDays); | |
| 201 | - List<ScheduleRealInfo> list = scheduleRealInfoRepository.findByDateLT(dt.toString("yyyy-MM-dd")); | |
| 202 | - calcTime(list); | |
| 203 | - //写入redis | |
| 204 | - wirte(list); | |
| 205 | - logger.info("redis 实际排班 over..."); | |
| 195 | + try { | |
| 196 | + logger.info("redis 实际排班 start..."); | |
| 197 | + int cacheDays = Integer.parseInt(ConfigUtil.get("cache.days")); | |
| 198 | + //设置key 序列化器 | |
| 199 | + redisTemplate.setKeySerializer(new StringRedisSerializer()); | |
| 200 | + | |
| 201 | + DateTime dt = new DateTime(); | |
| 202 | + dt = dt.minusDays(cacheDays); | |
| 203 | + List<ScheduleRealInfo> list = scheduleRealInfoRepository.findByDateLT(dt.toString("yyyy-MM-dd")); | |
| 204 | + calcTime(list); | |
| 205 | + //写入redis | |
| 206 | + wirte(list); | |
| 207 | + logger.info("redis 实际排班 over..."); | |
| 208 | + } catch (Exception e) { | |
| 209 | + logger.info("redis 实际排班 异常", e); | |
| 210 | + } | |
| 206 | 211 | } |
| 207 | 212 | }, 5, TimeUnit.SECONDS); |
| 208 | 213 | ... | ... |
src/main/java/com/bsth/server_ws/util/ScheduleCalculator.java
| ... | ... | @@ -61,7 +61,7 @@ public class ScheduleCalculator { |
| 61 | 61 | if (ct.getType2().equals("3")) |
| 62 | 62 | sum = Arith.add(sum, ct.getMileage()); |
| 63 | 63 | } |
| 64 | - } else if (sch.getBcType().equals("out") && sch.getStatus() != -1) { | |
| 64 | + } else if (sch.getBcType().equals("out") && sch.getStatus() != -1 && sch.getFcsjActual() != null && sch.getZdsjActual() != null) { | |
| 65 | 65 | sum = Arith.add(sum, sch.getJhlc()); |
| 66 | 66 | } |
| 67 | 67 | } |
| ... | ... | @@ -89,7 +89,7 @@ public class ScheduleCalculator { |
| 89 | 89 | if (ct.getType2().equals("2")) |
| 90 | 90 | sum = Arith.add(sum, ct.getMileage()); |
| 91 | 91 | } |
| 92 | - } else if (sch.getBcType().equals("in") && sch.getStatus() != -1) { | |
| 92 | + } else if (sch.getBcType().equals("in") && sch.getStatus() != -1 && sch.getFcsjActual() != null && sch.getZdsjActual() != null) { | |
| 93 | 93 | sum = Arith.add(sum, sch.getJhlc()); |
| 94 | 94 | } |
| 95 | 95 | } |
| ... | ... | @@ -131,20 +131,20 @@ public class ScheduleCalculator { |
| 131 | 131 | try { |
| 132 | 132 | Set<ChildTaskPlan> cts; |
| 133 | 133 | for (ScheduleRealInfo sch : list) { |
| 134 | - if (sch.getStatus() == -1) | |
| 135 | - continue; | |
| 136 | 134 | if (isInOut(sch) || sch.getBcType().equals("ldks")) |
| 137 | 135 | continue; |
| 138 | 136 | |
| 139 | 137 | cts = sch.getcTasks(); |
| 138 | + | |
| 140 | 139 | //有子任务 |
| 141 | 140 | if (cts != null && cts.size() > 0) { |
| 142 | 141 | for (ChildTaskPlan ct : cts) { |
| 143 | 142 | if (ct.getMileageType().equals("service") && !ct.isDestroy()) |
| 144 | 143 | sum = Arith.add(sum, ct.getMileage()); |
| 145 | 144 | } |
| 146 | - } else | |
| 145 | + } else if (sch.getStatus() != -1 && sch.getFcsjActual() != null && sch.getZdsjActual() != null) { | |
| 147 | 146 | sum = Arith.add(sum, sch.getJhlc()); |
| 147 | + } | |
| 148 | 148 | } |
| 149 | 149 | } catch (Exception e) { |
| 150 | 150 | logger.error("", e); |
| ... | ... | @@ -171,7 +171,7 @@ public class ScheduleCalculator { |
| 171 | 171 | if (ct.getMileageType().equals("empty")) |
| 172 | 172 | sum = Arith.add(sum, ct.getMileage()); |
| 173 | 173 | } |
| 174 | - } else if ((isInOut(sch) || sch.getBcType().equals("ldks")) && sch.getStatus() != -1) { | |
| 174 | + } else if ((isInOut(sch) || sch.getBcType().equals("ldks")) && sch.getStatus() != -1 && sch.getFcsjActual() != null && sch.getZdsjActual() != null) { | |
| 175 | 175 | sum = Arith.add(sum, sch.getJhlc()); |
| 176 | 176 | } |
| 177 | 177 | } | ... | ... |