Commit f7331a8709c1e1770a942f069ec59c8fa1c7b558
1 parent
b39a2ab8
1.在线调线路title上显示线路等级
Showing
7 changed files
with
107 additions
and
25 deletions
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| 1 | package com.bsth.controller.realcontrol; | 1 | package com.bsth.controller.realcontrol; |
| 2 | 2 | ||
| 3 | import java.util.ArrayList; | 3 | import java.util.ArrayList; |
| 4 | +import java.util.Arrays; | ||
| 4 | import java.util.Collection; | 5 | import java.util.Collection; |
| 5 | import java.util.HashMap; | 6 | import java.util.HashMap; |
| 6 | import java.util.List; | 7 | import java.util.List; |
| @@ -722,4 +723,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -722,4 +723,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 722 | public List<RepairReport> repairReportList(@RequestParam String line, @RequestParam String date, @RequestParam String code, @RequestParam String type){ | 723 | public List<RepairReport> repairReportList(@RequestParam String line, @RequestParam String date, @RequestParam String code, @RequestParam String type){ |
| 723 | return scheduleRealInfoService.repairReportList(line, date, code, type); | 724 | return scheduleRealInfoService.repairReportList(line, date, code, type); |
| 724 | } | 725 | } |
| 726 | + | ||
| 727 | + @RequestMapping(value = "lineLevel", method = RequestMethod.GET) | ||
| 728 | + public Map<String, String> lineLevel(@RequestParam String idx){ | ||
| 729 | + return scheduleRealInfoService.getLevelsByLines(Arrays.asList(idx.split(","))); | ||
| 730 | + } | ||
| 725 | } | 731 | } |
src/main/java/com/bsth/data/BasicData.java
| 1 | package com.bsth.data; | 1 | package com.bsth.data; |
| 2 | 2 | ||
| 3 | -import com.bsth.data.gpsdata_v2.cache.GeoCacheData; | ||
| 4 | -import com.bsth.data.pinyin.PersionPinYinBuffer; | ||
| 5 | -import com.bsth.entity.*; | ||
| 6 | -import com.bsth.entity.schedule.CarConfigInfo; | ||
| 7 | -import com.bsth.repository.*; | ||
| 8 | -import com.bsth.repository.schedule.CarConfigInfoRepository; | ||
| 9 | -import com.google.common.collect.BiMap; | ||
| 10 | -import com.google.common.collect.HashBiMap; | 3 | +import java.text.DateFormat; |
| 4 | +import java.text.SimpleDateFormat; | ||
| 5 | +import java.util.ArrayList; | ||
| 6 | +import java.util.Calendar; | ||
| 7 | +import java.util.Date; | ||
| 8 | +import java.util.HashMap; | ||
| 9 | +import java.util.Iterator; | ||
| 10 | +import java.util.List; | ||
| 11 | +import java.util.Map; | ||
| 12 | + | ||
| 11 | import org.apache.commons.lang3.StringUtils; | 13 | import org.apache.commons.lang3.StringUtils; |
| 12 | import org.slf4j.Logger; | 14 | import org.slf4j.Logger; |
| 13 | import org.slf4j.LoggerFactory; | 15 | import org.slf4j.LoggerFactory; |
| 14 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | import org.springframework.stereotype.Component; | 17 | import org.springframework.stereotype.Component; |
| 16 | 18 | ||
| 17 | -import java.util.*; | 19 | +import com.bsth.data.gpsdata_v2.cache.GeoCacheData; |
| 20 | +import com.bsth.data.pinyin.PersionPinYinBuffer; | ||
| 21 | +import com.bsth.entity.Business; | ||
| 22 | +import com.bsth.entity.CarPark; | ||
| 23 | +import com.bsth.entity.Cars; | ||
| 24 | +import com.bsth.entity.Line; | ||
| 25 | +import com.bsth.entity.Personnel; | ||
| 26 | +import com.bsth.entity.StationRoute; | ||
| 27 | +import com.bsth.entity.calc.CalcInterval; | ||
| 28 | +import com.bsth.entity.schedule.CarConfigInfo; | ||
| 29 | +import com.bsth.repository.BusinessRepository; | ||
| 30 | +import com.bsth.repository.CarParkRepository; | ||
| 31 | +import com.bsth.repository.CarsRepository; | ||
| 32 | +import com.bsth.repository.LineRepository; | ||
| 33 | +import com.bsth.repository.PersonnelRepository; | ||
| 34 | +import com.bsth.repository.StationRepository; | ||
| 35 | +import com.bsth.repository.StationRouteRepository; | ||
| 36 | +import com.bsth.repository.calc.CalcIntervalRepository; | ||
| 37 | +import com.bsth.repository.schedule.CarConfigInfoRepository; | ||
| 38 | +import com.google.common.collect.BiMap; | ||
| 39 | +import com.google.common.collect.HashBiMap; | ||
| 18 | 40 | ||
| 19 | /** | 41 | /** |
| 20 | * @author PanZhao | 42 | * @author PanZhao |
| @@ -77,6 +99,8 @@ public class BasicData { | @@ -77,6 +99,8 @@ public class BasicData { | ||
| 77 | //站点名和运管处编号 对照 | 99 | //站点名和运管处编号 对照 |
| 78 | public static Map<String, Integer> stationName2YgcNumber; | 100 | public static Map<String, Integer> stationName2YgcNumber; |
| 79 | 101 | ||
| 102 | + // 线路编码_日期 等级 | ||
| 103 | + public static Map<String, String> lineDate2Level; | ||
| 80 | 104 | ||
| 81 | static Logger logger = LoggerFactory.getLogger(BasicData.class); | 105 | static Logger logger = LoggerFactory.getLogger(BasicData.class); |
| 82 | 106 | ||
| @@ -132,7 +156,9 @@ public class BasicData { | @@ -132,7 +156,9 @@ public class BasicData { | ||
| 132 | 156 | ||
| 133 | @Autowired | 157 | @Autowired |
| 134 | PersionPinYinBuffer persionPinYinBuffer; | 158 | PersionPinYinBuffer persionPinYinBuffer; |
| 135 | - | 159 | + |
| 160 | + @Autowired | ||
| 161 | + CalcIntervalRepository calcIntervalRepository; | ||
| 136 | 162 | ||
| 137 | @Override | 163 | @Override |
| 138 | public void run() { | 164 | public void run() { |
| @@ -158,7 +184,9 @@ public class BasicData { | @@ -158,7 +184,9 @@ public class BasicData { | ||
| 158 | loadPersonnelInfo(); | 184 | loadPersonnelInfo(); |
| 159 | //公司信息 | 185 | //公司信息 |
| 160 | loadBusinessInfo(); | 186 | loadBusinessInfo(); |
| 161 | - | 187 | + // 线路等级信息 |
| 188 | + loadLineLevel(); | ||
| 189 | + | ||
| 162 | logger.info("load geo cache..,"); | 190 | logger.info("load geo cache..,"); |
| 163 | geoCacheData.loadData(); | 191 | geoCacheData.loadData(); |
| 164 | station2ParkBuffer.saveAll(); | 192 | station2ParkBuffer.saveAll(); |
| @@ -365,5 +393,30 @@ public class BasicData { | @@ -365,5 +393,30 @@ public class BasicData { | ||
| 365 | //人员拼音转换 | 393 | //人员拼音转换 |
| 366 | persionPinYinBuffer.refresh(); | 394 | persionPinYinBuffer.refresh(); |
| 367 | } | 395 | } |
| 396 | + | ||
| 397 | + /** | ||
| 398 | + * 加载线路级别信息 按当前日期取(当前+前后一天)的数据 | ||
| 399 | + */ | ||
| 400 | + public void loadLineLevel() { | ||
| 401 | + List<String> dates = new ArrayList<>(); | ||
| 402 | + Map<String, String> result = new HashMap<>(); | ||
| 403 | + DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 404 | + | ||
| 405 | + Calendar c = Calendar.getInstance(); | ||
| 406 | + c.setTime(new Date(System.currentTimeMillis() - 86400000)); | ||
| 407 | + dates.add(df.format(c.getTime())); | ||
| 408 | + | ||
| 409 | + for (int i = 0;i < 2;i++) { | ||
| 410 | + c.add(Calendar.DATE, 1); | ||
| 411 | + dates.add(df.format(c.getTime())); | ||
| 412 | + } | ||
| 413 | + | ||
| 414 | + List<CalcInterval> l = calcIntervalRepository.selectByDates(dates); | ||
| 415 | + for (CalcInterval ci : l) { | ||
| 416 | + result.put(ci.getXlBm() + "_" + ci.getDate(), ci.getLevel()); | ||
| 417 | + } | ||
| 418 | + | ||
| 419 | + lineDate2Level = result; | ||
| 420 | + } | ||
| 368 | } | 421 | } |
| 369 | } | 422 | } |
src/main/java/com/bsth/repository/calc/CalcIntervalRepository.java
| 1 | package com.bsth.repository.calc; | 1 | package com.bsth.repository.calc; |
| 2 | 2 | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | -import java.util.Map; | ||
| 5 | 4 | ||
| 6 | -import javax.transaction.Transactional; | 5 | +import org.springframework.data.jpa.repository.Query; |
| 6 | +import org.springframework.data.repository.query.Param; | ||
| 7 | +import org.springframework.stereotype.Repository; | ||
| 7 | 8 | ||
| 8 | import com.bsth.entity.calc.CalcInterval; | 9 | import com.bsth.entity.calc.CalcInterval; |
| 9 | import com.bsth.repository.BaseRepository; | 10 | import com.bsth.repository.BaseRepository; |
| 10 | 11 | ||
| 11 | -import org.springframework.data.jpa.repository.Modifying; | ||
| 12 | -import org.springframework.data.jpa.repository.Query; | ||
| 13 | -import org.springframework.stereotype.Repository; | ||
| 14 | - | ||
| 15 | /** | 12 | /** |
| 16 | * | 13 | * |
| 17 | */ | 14 | */ |
| @@ -48,5 +45,7 @@ public interface CalcIntervalRepository extends BaseRepository<CalcInterval, Int | @@ -48,5 +45,7 @@ public interface CalcIntervalRepository extends BaseRepository<CalcInterval, Int | ||
| 48 | + " group by xl_bm,gsbm,fgsbm",nativeQuery=true) | 45 | + " group by xl_bm,gsbm,fgsbm",nativeQuery=true) |
| 49 | List<Object[]> countByDateAndLine(String xlbm,String date,String date2); | 46 | List<Object[]> countByDateAndLine(String xlbm,String date,String date2); |
| 50 | 47 | ||
| 51 | - | 48 | + // 按日期查询 |
| 49 | + @Query(value="select c from CalcInterval c where c.date in (:dates)") | ||
| 50 | + List<CalcInterval> selectByDates(@Param("dates")List<String> dates); | ||
| 52 | } | 51 | } |
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
| @@ -199,4 +199,6 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | @@ -199,4 +199,6 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | ||
| 199 | Map<String, Object> repairReport(Map<String, Object> map, boolean isActive); | 199 | Map<String, Object> repairReport(Map<String, Object> map, boolean isActive); |
| 200 | 200 | ||
| 201 | List<RepairReport> repairReportList(String line,String date,String code, String type); | 201 | List<RepairReport> repairReportList(String line,String date,String code, String type); |
| 202 | + | ||
| 203 | + Map<String, String> getLevelsByLines(List<String> lines); | ||
| 202 | } | 204 | } |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -6428,6 +6428,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -6428,6 +6428,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 6428 | 6428 | ||
| 6429 | return result; | 6429 | return result; |
| 6430 | } | 6430 | } |
| 6431 | + | ||
| 6432 | + @Override | ||
| 6433 | + public Map<String, String> getLevelsByLines(List<String> lines) { | ||
| 6434 | + Map<String, String> result = new HashMap<String, String>(), currSchDate = dayOfSchedule.getCurrSchDate(); | ||
| 6435 | + for (String line : lines) { | ||
| 6436 | + String level = BasicData.lineDate2Level.get(line + "_" + currSchDate.get(line)); | ||
| 6437 | + result.put(line, level == null ? "" : level); | ||
| 6438 | + } | ||
| 6439 | + | ||
| 6440 | + return result; | ||
| 6441 | + } | ||
| 6431 | 6442 | ||
| 6432 | 6443 | ||
| 6433 | @Override | 6444 | @Override |
src/main/resources/static/pages/control/lineallot_v2/main.html
| @@ -484,13 +484,12 @@ | @@ -484,13 +484,12 @@ | ||
| 484 | $.each(items, function () { | 484 | $.each(items, function () { |
| 485 | ls_line_data.push(codeMapps[$(this).data('id')]); | 485 | ls_line_data.push(codeMapps[$(this).data('id')]); |
| 486 | }); | 486 | }); |
| 487 | - //将线路基础信息写入localStorage | ||
| 488 | - storage.setItem('lineControlItems', JSON.stringify(ls_line_data)); | ||
| 489 | //监控模式还是主调模式 | 487 | //监控模式还是主调模式 |
| 490 | storage.setItem('operationMode', $('.pattern_type_label>input')[0].checked?1:0); | 488 | storage.setItem('operationMode', $('.pattern_type_label>input')[0].checked?1:0); |
| 491 | 489 | ||
| 492 | //进入线调 | 490 | //进入线调 |
| 493 | - var eq = EventProxy.create('cache_route', 'check_line_config', function () { | 491 | + var eq = EventProxy.create('cache_line_level', 'cache_mv_route', 'cache_route', 'check_line_config', function (lineLevel) { |
| 492 | + debugger; | ||
| 494 | var newWinOpen = $('input','.new_window_open_label')[0].checked; | 493 | var newWinOpen = $('input','.new_window_open_label')[0].checked; |
| 495 | if(!newWinOpen) | 494 | if(!newWinOpen) |
| 496 | top.window.location.href = "/real_control/v2"; | 495 | top.window.location.href = "/real_control/v2"; |
| @@ -498,6 +497,13 @@ | @@ -498,6 +497,13 @@ | ||
| 498 | window.open("/real_control/v2"); | 497 | window.open("/real_control/v2"); |
| 499 | $('#go_to_real_system_btn').html('已经尝试打开新窗口,如看不到,可能被浏览器阻止了'); | 498 | $('#go_to_real_system_btn').html('已经尝试打开新窗口,如看不到,可能被浏览器阻止了'); |
| 500 | } | 499 | } |
| 500 | + | ||
| 501 | + // 将线路级别赋值 | ||
| 502 | + $.each(ls_line_data, function () { | ||
| 503 | + this.lineLevel = lineLevel[this.lineCode]; | ||
| 504 | + }); | ||
| 505 | + // 将线路基础信息写入localStorage | ||
| 506 | + storage.setItem('lineControlItems', JSON.stringify(ls_line_data)); | ||
| 501 | }); | 507 | }); |
| 502 | 508 | ||
| 503 | //拼接线路编码 | 509 | //拼接线路编码 |
| @@ -508,15 +514,20 @@ | @@ -508,15 +514,20 @@ | ||
| 508 | //缓存路由 | 514 | //缓存路由 |
| 509 | idx=idx.substr(0, idx.length - 1); | 515 | idx=idx.substr(0, idx.length - 1); |
| 510 | 516 | ||
| 511 | - $.ajaxSettings.async = false; | 517 | + $.get('/realSchedule/lineLevel', {idx: idx}, function (rs) { |
| 518 | + if (rs) { | ||
| 519 | + eq.emit('cache_line_level', rs); | ||
| 520 | + } | ||
| 521 | + }); | ||
| 522 | + | ||
| 512 | $.get('/realMap/findRouteAndVersionByLine', {idx: idx}, function (rs) { | 523 | $.get('/realMap/findRouteAndVersionByLine', {idx: idx}, function (rs) { |
| 513 | if (rs) { | 524 | if (rs) { |
| 514 | for(var lineCode in rs) | 525 | for(var lineCode in rs) |
| 515 | storage.setItem(lineCode + '_route', JSON.stringify(rs[lineCode])); | 526 | storage.setItem(lineCode + '_route', JSON.stringify(rs[lineCode])); |
| 516 | - //eq.emit('cache_route'); | 527 | + eq.emit('cache_mv_route'); |
| 517 | } | 528 | } |
| 518 | }); | 529 | }); |
| 519 | - $.ajaxSettings.async = true; | 530 | + |
| 520 | $.get('/realMap/findRouteByLine', {idx: idx}, function (rs) { | 531 | $.get('/realMap/findRouteByLine', {idx: idx}, function (rs) { |
| 521 | if (rs) { | 532 | if (rs) { |
| 522 | for(var lineCode in rs) | 533 | for(var lineCode in rs) |
src/main/resources/static/real_control_v2/fragments/north/tabs.html
| @@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
| 4 | <li class="uk-active" ><a>主页</a></li> | 4 | <li class="uk-active" ><a>主页</a></li> |
| 5 | <li id="north_tabs_map_btn"><a>地图</a></li> | 5 | <li id="north_tabs_map_btn"><a>地图</a></li> |
| 6 | {{each list as line i}} | 6 | {{each list as line i}} |
| 7 | - <li class="tab-line {{line.destroy==1?'destroy':''}}" data-code="{{line.lineCode}}"><a>{{line.name}}(<span id="badge_untreated_num_{{line.lineCode}}">0</span>, <span id="badge_yfwf_num_{{line.lineCode}}">0</span>)</a></li> | 7 | + <li class="tab-line {{line.destroy==1?'destroy':''}}" data-code="{{line.lineCode}}"><a>{{line.name}} (<span id="badge_untreated_num_{{line.lineCode}}">0</span>, <span id="badge_yfwf_num_{{line.lineCode}}">0</span>, <span id="level_{{line.lineCode}}">{{line.lineLevel}}</span>)</a></li> |
| 8 | {{/each}} | 8 | {{/each}} |
| 9 | </ul> | 9 | </ul> |
| 10 | </script> | 10 | </script> |