Commit 59998e0947e32a187a3ba21c4dc2d960b45d0c54
1 parent
2c2f2fb2
update...
Showing
4 changed files
with
36 additions
and
23 deletions
src/main/java/com/bsth/controller/realcontrol/anomalyCheckController.java
| @@ -10,9 +10,9 @@ import org.springframework.web.bind.annotation.RequestMethod; | @@ -10,9 +10,9 @@ import org.springframework.web.bind.annotation.RequestMethod; | ||
| 10 | import org.springframework.web.bind.annotation.RequestParam; | 10 | import org.springframework.web.bind.annotation.RequestParam; |
| 11 | import org.springframework.web.bind.annotation.RestController; | 11 | import org.springframework.web.bind.annotation.RestController; |
| 12 | 12 | ||
| 13 | -import java.util.HashSet; | 13 | +import java.util.HashMap; |
| 14 | import java.util.List; | 14 | import java.util.List; |
| 15 | -import java.util.Set; | 15 | +import java.util.Map; |
| 16 | 16 | ||
| 17 | /** | 17 | /** |
| 18 | * 相关数据异常检测 | 18 | * 相关数据异常检测 |
| @@ -35,16 +35,19 @@ public class anomalyCheckController { | @@ -35,16 +35,19 @@ public class anomalyCheckController { | ||
| 35 | public void schRepeat(@RequestParam String nbbm){ | 35 | public void schRepeat(@RequestParam String nbbm){ |
| 36 | logger.info("前端通知,车辆 " + nbbm + "出现重复班次,开始检测..."); | 36 | logger.info("前端通知,车辆 " + nbbm + "出现重复班次,开始检测..."); |
| 37 | List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(nbbm); | 37 | List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(nbbm); |
| 38 | + logger.info("检测前,车辆班次数量:" + list.size()); | ||
| 38 | 39 | ||
| 39 | - Set<ScheduleRealInfo> set = new HashSet<>(); | 40 | + Map<Long, ScheduleRealInfo> map = new HashMap<>(); |
| 40 | for(ScheduleRealInfo sch : list){ | 41 | for(ScheduleRealInfo sch : list){ |
| 41 | - if(!set.add(sch)){ | ||
| 42 | - logger.info("出现一次重复班次,班次ID:" + sch.getId()); | 42 | + if(map.containsKey(sch.getId())){ |
| 43 | + logger.info("检测到重复ID: " + sch.getId()); | ||
| 43 | } | 44 | } |
| 45 | + map.put(sch.getId(), sch); | ||
| 44 | } | 46 | } |
| 45 | 47 | ||
| 46 | - if(set.size() > 0){ | ||
| 47 | - dayOfSchedule.replaceByNbbm(nbbm, set); | 48 | + logger.info("检测后,车辆班次数量:" + list.size()); |
| 49 | + if(map.values().size() > 0){ | ||
| 50 | + dayOfSchedule.replaceByNbbm(nbbm, map.values()); | ||
| 48 | } | 51 | } |
| 49 | } | 52 | } |
| 50 | } | 53 | } |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| @@ -480,7 +480,7 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -480,7 +480,7 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 480 | public List<ScheduleRealInfo> findByLineCode(String lineCode) { | 480 | public List<ScheduleRealInfo> findByLineCode(String lineCode) { |
| 481 | List<ScheduleRealInfo> rs = new ArrayList<>(); | 481 | List<ScheduleRealInfo> rs = new ArrayList<>(); |
| 482 | 482 | ||
| 483 | - Collection<ScheduleRealInfo> schs = nbbmScheduleMap.values(); | 483 | + Collection<ScheduleRealInfo> schs = id2SchedulMap.values(); |
| 484 | for (ScheduleRealInfo sch : schs) { | 484 | for (ScheduleRealInfo sch : schs) { |
| 485 | if (sch.getXlBm().equals(lineCode)) | 485 | if (sch.getXlBm().equals(lineCode)) |
| 486 | rs.add(sch); | 486 | rs.add(sch); |
| @@ -489,6 +489,22 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -489,6 +489,22 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 489 | } | 489 | } |
| 490 | 490 | ||
| 491 | /** | 491 | /** |
| 492 | + * @Title: findByLineCode | ||
| 493 | + * @Description: TODO(lineList 获取班次) | ||
| 494 | + */ | ||
| 495 | + public Map<String, Collection<ScheduleRealInfo>> findByLineCodes(List<String> lineList) { | ||
| 496 | + ArrayListMultimap<String, ScheduleRealInfo> mMap = ArrayListMultimap.create(); | ||
| 497 | + | ||
| 498 | + Collection<ScheduleRealInfo> schs = id2SchedulMap.values(); | ||
| 499 | + for (ScheduleRealInfo sch : schs) { | ||
| 500 | + if(lineList.contains(sch.getXlBm())){ | ||
| 501 | + mMap.put(sch.getXlBm(), sch); | ||
| 502 | + } | ||
| 503 | + } | ||
| 504 | + return mMap.asMap(); | ||
| 505 | + } | ||
| 506 | + | ||
| 507 | + /** | ||
| 492 | * @Title: findCarByLineCode | 508 | * @Title: findCarByLineCode |
| 493 | * @Description: TODO(线路下运营的车辆) | 509 | * @Description: TODO(线路下运营的车辆) |
| 494 | */ | 510 | */ |
| @@ -870,16 +886,14 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -870,16 +886,14 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 870 | */ | 886 | */ |
| 871 | public List<ScheduleRealInfo> changeCar(ScheduleRealInfo sch, String newClZbh) { | 887 | public List<ScheduleRealInfo> changeCar(ScheduleRealInfo sch, String newClZbh) { |
| 872 | List<ScheduleRealInfo> ups = new ArrayList<>(); | 888 | List<ScheduleRealInfo> ups = new ArrayList<>(); |
| 873 | - /*String oldClzbh = sch.getClZbh(); | ||
| 874 | - if (oldClzbh.equals(newClZbh)) | ||
| 875 | - return ups;*/ | ||
| 876 | - | ||
| 877 | 889 | ||
| 878 | //变更相关映射信息 | 890 | //变更相关映射信息 |
| 879 | nbbmScheduleMap.remove(sch.getClZbh(), sch); | 891 | nbbmScheduleMap.remove(sch.getClZbh(), sch); |
| 880 | 892 | ||
| 881 | sch.setClZbh(newClZbh); | 893 | sch.setClZbh(newClZbh); |
| 882 | - nbbmScheduleMap.put(newClZbh, sch); | 894 | + if(!nbbmScheduleMap.containsEntry(newClZbh, sch)){ |
| 895 | + nbbmScheduleMap.put(newClZbh, sch); | ||
| 896 | + } | ||
| 883 | 897 | ||
| 884 | //重新计算班次应到时间 | 898 | //重新计算班次应到时间 |
| 885 | //ups.addAll(updateQdzTimePlan(oldClzbh)); | 899 | //ups.addAll(updateQdzTimePlan(oldClzbh)); |
| @@ -996,11 +1010,9 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -996,11 +1010,9 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 996 | * @param nbbm | 1010 | * @param nbbm |
| 997 | * @param sets | 1011 | * @param sets |
| 998 | */ | 1012 | */ |
| 999 | - public void replaceByNbbm(String nbbm, Set<ScheduleRealInfo> sets){ | 1013 | + public void replaceByNbbm(String nbbm, Collection<ScheduleRealInfo> sets){ |
| 1000 | nbbmScheduleMap.removeAll(nbbm); | 1014 | nbbmScheduleMap.removeAll(nbbm); |
| 1001 | nbbmScheduleMap.putAll(nbbm, sets); | 1015 | nbbmScheduleMap.putAll(nbbm, sets); |
| 1002 | - //重新计算班次应到时间 | ||
| 1003 | - updateQdzTimePlan(nbbm); | ||
| 1004 | } | 1016 | } |
| 1005 | 1017 | ||
| 1006 | /** | 1018 | /** |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -49,10 +49,8 @@ import com.bsth.service.sys.DutyEmployeeService; | @@ -49,10 +49,8 @@ import com.bsth.service.sys.DutyEmployeeService; | ||
| 49 | import com.bsth.util.*; | 49 | import com.bsth.util.*; |
| 50 | import com.bsth.websocket.handler.SendUtils; | 50 | import com.bsth.websocket.handler.SendUtils; |
| 51 | import com.google.common.base.Splitter; | 51 | import com.google.common.base.Splitter; |
| 52 | -import com.google.common.collect.ArrayListMultimap; | ||
| 53 | import com.google.common.collect.BiMap; | 52 | import com.google.common.collect.BiMap; |
| 54 | import com.google.common.collect.Lists; | 53 | import com.google.common.collect.Lists; |
| 55 | -import com.google.common.collect.Multimap; | ||
| 56 | import org.apache.commons.lang3.StringEscapeUtils; | 54 | import org.apache.commons.lang3.StringEscapeUtils; |
| 57 | import org.apache.commons.lang3.StringUtils; | 55 | import org.apache.commons.lang3.StringUtils; |
| 58 | import org.joda.time.format.DateTimeFormat; | 56 | import org.joda.time.format.DateTimeFormat; |
| @@ -144,12 +142,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -144,12 +142,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 144 | public Map<String, Collection<ScheduleRealInfo>> findByLines(String lines) { | 142 | public Map<String, Collection<ScheduleRealInfo>> findByLines(String lines) { |
| 145 | List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lines)); | 143 | List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lines)); |
| 146 | 144 | ||
| 147 | - Multimap<String, ScheduleRealInfo> mMap = ArrayListMultimap.create(); | 145 | + /*Multimap<String, ScheduleRealInfo> mMap = ArrayListMultimap.create(); |
| 148 | 146 | ||
| 149 | for (String lineCode : lineList) { | 147 | for (String lineCode : lineList) { |
| 150 | mMap.putAll(lineCode, dayOfSchedule.findByLineCode(lineCode)); | 148 | mMap.putAll(lineCode, dayOfSchedule.findByLineCode(lineCode)); |
| 151 | - } | ||
| 152 | - return mMap.asMap(); | 149 | + }*/ |
| 150 | + return dayOfSchedule.findByLineCodes(lineList); | ||
| 153 | } | 151 | } |
| 154 | 152 | ||
| 155 | private final static long DAY_TIME = 1000 * 60 * 60 * 24L; | 153 | private final static long DAY_TIME = 1000 * 60 * 60 * 24L; |
src/main/resources/static/real_control_v2/js/main.js
| @@ -171,8 +171,8 @@ var disabled_submit_btn = function (form) { | @@ -171,8 +171,8 @@ var disabled_submit_btn = function (form) { | ||
| 171 | function showUpdateDescription() { | 171 | function showUpdateDescription() { |
| 172 | //更新说明 | 172 | //更新说明 |
| 173 | var updateDescription = { | 173 | var updateDescription = { |
| 174 | - date: '2017-04-26', | ||
| 175 | - text: '<h5>临加班次新增一项场到场</h5><h5>搜索框可按路牌搜索,lp 打头,st 和 et打头可搜索时间范围</h5>' | 174 | + date: '2017-04-28 下午', |
| 175 | + text: '<h5>修复在特定情况下出现线调界面班次显示不全,比路单少的情况。</h5><h5>尝试修复在特定情况下车辆走向不跟随班次执行结束而跳动的问题。</h5>' | ||
| 176 | }; | 176 | }; |
| 177 | 177 | ||
| 178 | var storage = window.localStorage | 178 | var storage = window.localStorage |