Commit f7e8ce7a73048c065196aede19edeb772731d7e3

Authored by 潘钊
1 parent 13e708cc

update

src/main/java/com/bsth/StartCommand.java
@@ -12,8 +12,8 @@ import org.springframework.boot.CommandLineRunner; @@ -12,8 +12,8 @@ import org.springframework.boot.CommandLineRunner;
12 import org.springframework.stereotype.Component; 12 import org.springframework.stereotype.Component;
13 13
14 import com.bsth.security.SecurityMetadataSourceService; 14 import com.bsth.security.SecurityMetadataSourceService;
15 -import com.bsth.util.DateUtils;  
16 -import com.bsth.vehicle.GetSchedulePlanThread; 15 +import com.bsth.service.realcontrol.GetSchedulePlanThread;
  16 +import com.bsth.service.realcontrol.SchedulePersistenceThread;
17 import com.bsth.vehicle.common.CommonRefreshThread; 17 import com.bsth.vehicle.common.CommonRefreshThread;
18 import com.bsth.vehicle.directive.DirectivePersistenceThread; 18 import com.bsth.vehicle.directive.DirectivePersistenceThread;
19 import com.bsth.vehicle.gpsdata.GpsRefreshThread; 19 import com.bsth.vehicle.gpsdata.GpsRefreshThread;
@@ -31,7 +31,7 @@ public class StartCommand implements CommandLineRunner{ @@ -31,7 +31,7 @@ public class StartCommand implements CommandLineRunner{
31 @Autowired 31 @Autowired
32 SecurityMetadataSourceService invocationSecurityMetadataSourceService; 32 SecurityMetadataSourceService invocationSecurityMetadataSourceService;
33 33
34 - public static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(4); 34 + public static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(5);
35 35
36 @Autowired 36 @Autowired
37 GpsRefreshThread gpsRefreshThread; 37 GpsRefreshThread gpsRefreshThread;
@@ -45,6 +45,9 @@ public class StartCommand implements CommandLineRunner{ @@ -45,6 +45,9 @@ public class StartCommand implements CommandLineRunner{
45 @Autowired 45 @Autowired
46 DirectivePersistenceThread directivePersistenceThread; 46 DirectivePersistenceThread directivePersistenceThread;
47 47
  48 + @Autowired
  49 + SchedulePersistenceThread SchedulePersistenceThread;
  50 +
48 @Override 51 @Override
49 public void run(String... arg0){ 52 public void run(String... arg0){
50 53
@@ -61,10 +64,13 @@ public class StartCommand implements CommandLineRunner{ @@ -61,10 +64,13 @@ public class StartCommand implements CommandLineRunner{
61 , 60 * 60 * 24, TimeUnit.SECONDS);*/ 64 , 60 * 60 * 24, TimeUnit.SECONDS);*/
62 65
63 //两分钟调度指令入库一次 66 //两分钟调度指令入库一次
64 - //scheduler.scheduleWithFixedDelay(directivePersistenceThread, 20, 60 * 1, TimeUnit.SECONDS); 67 + //scheduler.scheduleWithFixedDelay(directivePersistenceThread, 20, 60 * 2, TimeUnit.SECONDS);
65 68
66 //两小时刷新一次对照数据 69 //两小时刷新一次对照数据
67 - scheduler.scheduleWithFixedDelay(commonRefreshThread, 0, 60 * 60 * 2, TimeUnit.SECONDS); 70 + //scheduler.scheduleWithFixedDelay(commonRefreshThread, 0, 60 * 60 * 2, TimeUnit.SECONDS);
  71 +
  72 + //一分钟持久化一次实际排班
  73 + scheduler.scheduleWithFixedDelay(SchedulePersistenceThread, 60 * 1, 60 * 1, TimeUnit.SECONDS);
68 } catch (Exception e) { 74 } catch (Exception e) {
69 e.printStackTrace(); 75 e.printStackTrace();
70 } 76 }
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
@@ -5,6 +5,7 @@ import java.util.Map; @@ -5,6 +5,7 @@ import java.util.Map;
5 5
6 import org.springframework.beans.factory.annotation.Autowired; 6 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.web.bind.annotation.RequestMapping; 7 import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
8 import org.springframework.web.bind.annotation.RequestParam; 9 import org.springframework.web.bind.annotation.RequestParam;
9 import org.springframework.web.bind.annotation.RestController; 10 import org.springframework.web.bind.annotation.RestController;
10 11
@@ -14,7 +15,7 @@ import com.bsth.service.realcontrol.ScheduleRealInfoService; @@ -14,7 +15,7 @@ import com.bsth.service.realcontrol.ScheduleRealInfoService;
14 15
15 @RestController 16 @RestController
16 @RequestMapping("/realSchedule") 17 @RequestMapping("/realSchedule")
17 -public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, Integer>{ 18 +public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, Long>{
18 19
19 @Autowired 20 @Autowired
20 ScheduleRealInfoService scheduleRealInfoService; 21 ScheduleRealInfoService scheduleRealInfoService;
@@ -33,8 +34,8 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -33,8 +34,8 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
33 * @param @param dfsj 待发时间(HH:mm) 34 * @param @param dfsj 待发时间(HH:mm)
34 * @throws 35 * @throws
35 */ 36 */
36 - public Map<String, Object> outgoAdjust(@RequestParam Integer id, @RequestParam String remarks,@RequestParam String dfsj){  
37 -  
38 - return null; 37 + @RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST)
  38 + public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks,@RequestParam String dfsj){
  39 + return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj);
39 } 40 }
40 } 41 }
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
@@ -126,6 +126,12 @@ public class ScheduleRealInfo { @@ -126,6 +126,12 @@ public class ScheduleRealInfo {
126 * 待发时间(格式 HH:mm) 126 * 待发时间(格式 HH:mm)
127 */ 127 */
128 private String dfsj; 128 private String dfsj;
  129 +
  130 + /**
  131 + * 发车时间戳
  132 + */
  133 + @Transient
  134 + private Long fcsjT;
129 135
130 public Long getId() { 136 public Long getId() {
131 return id; 137 return id;
@@ -430,5 +436,12 @@ public class ScheduleRealInfo { @@ -430,5 +436,12 @@ public class ScheduleRealInfo {
430 public void setDfsj(String dfsj) { 436 public void setDfsj(String dfsj) {
431 this.dfsj = dfsj; 437 this.dfsj = dfsj;
432 } 438 }
433 - 439 +
  440 + public Long getFcsjT() {
  441 + return fcsjT;
  442 + }
  443 +
  444 + public void setFcsjT(Long fcsjT) {
  445 + this.fcsjT = fcsjT;
  446 + }
434 } 447 }
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
@@ -9,7 +9,7 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo; @@ -9,7 +9,7 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo;
9 import com.bsth.repository.BaseRepository; 9 import com.bsth.repository.BaseRepository;
10 10
11 @Repository 11 @Repository
12 -public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealInfo, Integer>{ 12 +public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealInfo, Long>{
13 13
14 @Query("select s from ScheduleRealInfo s where s.xlBm in ?1") 14 @Query("select s from ScheduleRealInfo s where s.xlBm in ?1")
15 List<ScheduleRealInfo> findByLines(List<String> lines); 15 List<ScheduleRealInfo> findByLines(List<String> lines);
src/main/java/com/bsth/service/realcontrol/GetSchedulePlanThread.java
@@ -58,8 +58,7 @@ public class GetSchedulePlanThread extends Thread{ @@ -58,8 +58,7 @@ public class GetSchedulePlanThread extends Thread{
58 item.setFcsjT(sdf2.parse(dateStr + " " + item.getFcsj()).getTime()); 58 item.setFcsjT(sdf2.parse(dateStr + " " + item.getFcsj()).getTime());
59 } 59 }
60 60
61 - //scheduleRealInfoRepository.save(realList);  
62 - new BatchSaveUtils<ScheduleRealInfo>().saveListMysql(realList, ScheduleRealInfo.class); 61 + //new BatchSaveUtils<ScheduleRealInfo>().saveList(realList, ScheduleRealInfo.class);
63 //写入缓存 62 //写入缓存
64 ScheduleBuffer.init(realList); 63 ScheduleBuffer.init(realList);
65 logger.info("结束................." + sdf3.format(new Date(System.currentTimeMillis()))); 64 logger.info("结束................." + sdf3.format(new Date(System.currentTimeMillis())));
src/main/java/com/bsth/service/realcontrol/ScheduleBuffer.java 0 → 100644
  1 +package com.bsth.service.realcontrol;
  2 +
  3 +import java.util.Collections;
  4 +import java.util.Comparator;
  5 +import java.util.HashMap;
  6 +import java.util.LinkedList;
  7 +import java.util.List;
  8 +import java.util.Map;
  9 +
  10 +import org.slf4j.Logger;
  11 +import org.slf4j.LoggerFactory;
  12 +
  13 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  14 +import com.google.common.collect.ArrayListMultimap;
  15 +
  16 +/**
  17 + *
  18 + * @ClassName: ScheduleRealInfoBuffer
  19 + * @Description: TODO(当天实际排班缓存)
  20 + * @author PanZhao
  21 + * @date 2016年6月14日 上午9:40:38
  22 + *
  23 + */
  24 +public class ScheduleBuffer {
  25 +
  26 + static Logger logger = LoggerFactory.getLogger(ScheduleBuffer.class);
  27 +
  28 + /**
  29 + * 当天实际排班
  30 + * K 线路编码 V 按时间升序的班次
  31 + */
  32 + public static ArrayListMultimap<String, ScheduleRealInfo> schedulListMap;
  33 +
  34 + /**
  35 + * 主键 和 排班映射
  36 + */
  37 + public static Map<Long, ScheduleRealInfo> pkSchedulMap;
  38 +
  39 + /**
  40 + * 需要持久化的排班
  41 + */
  42 + public static LinkedList<ScheduleRealInfo> persistentList;
  43 +
  44 + static{
  45 + schedulListMap = ArrayListMultimap.create();
  46 + pkSchedulMap = new HashMap<>();
  47 + persistentList = new LinkedList<>();
  48 + }
  49 +
  50 + public static int init(List<ScheduleRealInfo> list){
  51 +
  52 + try{
  53 + //发车时间排序
  54 + Collections.sort(list, new Comparator<ScheduleRealInfo>() {
  55 +
  56 + @Override
  57 + public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) {
  58 + return (int) (o1.getFcsjT() - o2.getFcsjT());
  59 + }
  60 + });
  61 +
  62 + for(ScheduleRealInfo schedul : list){
  63 + schedulListMap.put(schedul.getXlBm(), schedul);
  64 + pkSchedulMap.put(schedul.getId(), schedul);
  65 + }
  66 + }catch(Exception e){
  67 + logger.error("缓存排班数据失败...", e);
  68 + return -1;
  69 + }
  70 + return 0;
  71 + }
  72 +}
src/main/java/com/bsth/service/realcontrol/SchedulePersistenceThread.java 0 → 100644
  1 +package com.bsth.service.realcontrol;
  2 +
  3 +import java.util.LinkedList;
  4 +
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.stereotype.Component;
  7 +
  8 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  9 +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
  10 +
  11 +/**
  12 + *
  13 + * @ClassName: SchedulePersistenceThread
  14 + * @Description: TODO(排班缓存 修改 持久化)
  15 + * @author PanZhao
  16 + * @date 2016年6月14日 下午1:11:49
  17 + *
  18 + */
  19 +@Component
  20 +public class SchedulePersistenceThread extends Thread {
  21 +
  22 + @Autowired
  23 + ScheduleRealInfoRepository scheduleRepository;
  24 +
  25 + @Override
  26 + public void run() {
  27 + LinkedList<ScheduleRealInfo> list = ScheduleBuffer.persistentList;
  28 +
  29 + ScheduleRealInfo schedule;
  30 + for (int i = 0; i < 1000; i++) {
  31 + schedule = list.poll();
  32 +
  33 + if (null == schedule)
  34 + break;
  35 +
  36 + scheduleRepository.save(schedule);
  37 + }
  38 + }
  39 +}
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
@@ -9,8 +9,10 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo; @@ -9,8 +9,10 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo;
9 import com.bsth.service.BaseService; 9 import com.bsth.service.BaseService;
10 10
11 @Service 11 @Service
12 -public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, Integer>{ 12 +public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, Long>{
13 13
14 Map<String, Collection<ScheduleRealInfo>> findByLines(String lines); 14 Map<String, Collection<ScheduleRealInfo>> findByLines(String lines);
15 15
  16 + Map<String, Object> outgoAdjust(Long id, String remarks, String dfsj);
  17 +
16 } 18 }
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
1 package com.bsth.service.realcontrol.impl; 1 package com.bsth.service.realcontrol.impl;
2 2
3 import java.util.Collection; 3 import java.util.Collection;
  4 +import java.util.HashMap;
4 import java.util.List; 5 import java.util.List;
5 import java.util.Map; 6 import java.util.Map;
6 7
  8 +import org.slf4j.Logger;
  9 +import org.slf4j.LoggerFactory;
7 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.stereotype.Service; 11 import org.springframework.stereotype.Service;
9 12
  13 +import com.bsth.common.ResponseCode;
10 import com.bsth.entity.realcontrol.ScheduleRealInfo; 14 import com.bsth.entity.realcontrol.ScheduleRealInfo;
11 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; 15 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
12 import com.bsth.service.impl.BaseServiceImpl; 16 import com.bsth.service.impl.BaseServiceImpl;
  17 +import com.bsth.service.realcontrol.ScheduleBuffer;
13 import com.bsth.service.realcontrol.ScheduleRealInfoService; 18 import com.bsth.service.realcontrol.ScheduleRealInfoService;
14 import com.google.common.base.Splitter; 19 import com.google.common.base.Splitter;
15 import com.google.common.collect.ArrayListMultimap; 20 import com.google.common.collect.ArrayListMultimap;
@@ -17,11 +22,13 @@ import com.google.common.collect.Lists; @@ -17,11 +22,13 @@ import com.google.common.collect.Lists;
17 import com.google.common.collect.Multimap; 22 import com.google.common.collect.Multimap;
18 23
19 @Service 24 @Service
20 -public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Integer> implements ScheduleRealInfoService{ 25 +public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Long> implements ScheduleRealInfoService{
21 26
22 @Autowired 27 @Autowired
23 ScheduleRealInfoRepository scheduleRealInfoRepository; 28 ScheduleRealInfoRepository scheduleRealInfoRepository;
24 29
  30 + Logger logger = LoggerFactory.getLogger(this.getClass());
  31 +
25 @Override 32 @Override
26 public Map<String, Collection<ScheduleRealInfo>> findByLines(String lines) { 33 public Map<String, Collection<ScheduleRealInfo>> findByLines(String lines) {
27 List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lines)); 34 List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lines));
@@ -36,4 +43,29 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -36,4 +43,29 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
36 43
37 return mMap.asMap(); 44 return mMap.asMap();
38 } 45 }
  46 +
  47 + @Override
  48 + public Map<String, Object> outgoAdjust(Long id, String remarks, String dfsj) {
  49 + Map<String, Object> map = new HashMap<>();
  50 + try{
  51 +
  52 + ScheduleRealInfo schedule = ScheduleBuffer.pkSchedulMap.get(id);
  53 + schedule.setDfsj(dfsj);
  54 + String newRem = schedule.getRemarks();
  55 + if(null == newRem)
  56 + newRem = "";
  57 + newRem += "[待发调整] " + remarks +";";
  58 + schedule.setRemarks(newRem);
  59 + //持久化到数据库
  60 + ScheduleBuffer.persistentList.add(schedule);
  61 +
  62 + map.put("status", ResponseCode.SUCCESS);
  63 + map.put("dfsj", dfsj);
  64 + map.put("remarks", newRem);
  65 + }catch(Exception e){
  66 + logger.error("", e);
  67 + map.put("status", ResponseCode.ERROR);
  68 + }
  69 + return map;
  70 + }
39 } 71 }
src/main/java/com/bsth/vehicle/directive/DirectivePersistenceThread.java
1 package com.bsth.vehicle.directive; 1 package com.bsth.vehicle.directive;
2 2
3 -import java.util.ArrayList;  
4 import java.util.LinkedList; 3 import java.util.LinkedList;
5 -import java.util.List;  
6 4
7 import org.slf4j.Logger; 5 import org.slf4j.Logger;
8 import org.slf4j.LoggerFactory; 6 import org.slf4j.LoggerFactory;
@@ -33,8 +31,6 @@ public class DirectivePersistenceThread extends Thread{ @@ -33,8 +31,6 @@ public class DirectivePersistenceThread extends Thread{
33 public void run() { 31 public void run() {
34 LinkedList<Directive> list = DirectiveBuffer.transientList; 32 LinkedList<Directive> list = DirectiveBuffer.transientList;
35 33
36 - List<Directive> persList = new ArrayList<>();  
37 -  
38 Directive directive; 34 Directive directive;
39 for(int i = 0; i < 1000; i ++){ 35 for(int i = 0; i < 1000; i ++){
40 directive = list.poll(); 36 directive = list.poll();
@@ -42,15 +38,7 @@ public class DirectivePersistenceThread extends Thread{ @@ -42,15 +38,7 @@ public class DirectivePersistenceThread extends Thread{
42 if(null == directive) 38 if(null == directive)
43 break; 39 break;
44 40
45 - persList.add(directive);  
46 - }  
47 -  
48 - if(persList.size() > 0){  
49 - try{  
50 - directiveRepository.save(persList);  
51 - }catch(Exception e){  
52 - logger.error("", e);  
53 - } 41 + directiveRepository.save(directive);
54 } 42 }
55 } 43 }
56 } 44 }
src/main/resources/static/pages/control/line/css/lineControl.css
@@ -864,7 +864,7 @@ height: 400px; @@ -864,7 +864,7 @@ height: 400px;
864 width: 9%; 864 width: 9%;
865 } 865 }
866 .pb-table tr td:nth-child(5){ 866 .pb-table tr td:nth-child(5){
867 - width: 15%; 867 + /* width: 15%; */
868 } 868 }
869 .pb-table tr td:nth-child(6){ 869 .pb-table tr td:nth-child(6){
870 width: 10%; 870 width: 10%;
@@ -873,7 +873,10 @@ height: 400px; @@ -873,7 +873,10 @@ height: 400px;
873 width: 10%; 873 width: 10%;
874 } 874 }
875 .pb-table tr td:nth-child(8){ 875 .pb-table tr td:nth-child(8){
876 - width: 15%; 876 + /* width: 15%; */
  877 +}
  878 +.pb-table tr td:nth-child(9){
  879 + width: 55px;
877 } 880 }
878 .pb-table tr td:nth-child(10){ 881 .pb-table tr td:nth-child(10){
879 width: 47px; 882 width: 47px;
@@ -1298,6 +1301,9 @@ height: 400px; @@ -1298,6 +1301,9 @@ height: 400px;
1298 border: 1px solid #d3cfc8; 1301 border: 1px solid #d3cfc8;
1299 padding: 8px 0 4px 5px; 1302 padding: 8px 0 4px 5px;
1300 color: black; 1303 color: black;
  1304 +
  1305 + height: 240px;
  1306 + overflow: auto;
1301 } 1307 }
1302 1308
1303 1309
@@ -1458,4 +1464,12 @@ height: 400px; @@ -1458,4 +1464,12 @@ height: 400px;
1458 .hide-lt-1080{ 1464 .hide-lt-1080{
1459 display: none; 1465 display: none;
1460 } 1466 }
  1467 +}
  1468 +
  1469 +.tab_line .panel-wrap ._panel ._body .pb-table a.remarks-popover{
  1470 + color: gray;text-decoration: none;
  1471 +}
  1472 +
  1473 +.form-custom hr{
  1474 + margin: 15px 0;
1461 } 1475 }
1462 \ No newline at end of file 1476 \ No newline at end of file
src/main/resources/static/pages/control/line/js/alone.js
@@ -39,12 +39,36 @@ var _alone = (function(){ @@ -39,12 +39,36 @@ var _alone = (function(){
39 trigger: 'hover', 39 trigger: 'hover',
40 container: '.portlet-fullscreen' 40 container: '.portlet-fullscreen'
41 }); 41 });
  42 +
  43 + //备注POPOVER
  44 + $('.remarks-popover').popover({trigger: 'hover',container: '.portlet-fullscreen',placement:'bottom'});
42 }); 45 });
43 46
44 //$('.tab-pane.aloneline') 47 //$('.tab-pane.aloneline')
45 /*_data.queryStationRoute('10904' , 'lineSvg10904' , drawSvg.init); 48 /*_data.queryStationRoute('10904' , 'lineSvg10904' , drawSvg.init);
46 */ 49 */
  50 + },
  51 + //刷新班次
  52 + refreshSchedule: function(schedule){
  53 + //xlBm
  54 + var tr = $('tr[data-id='+schedule.id+']', '#tab_line_' + schedule.xlBm)[0]
  55 + ,cells = tr.cells, name;
47 56
  57 + $.each(cells, function(i, cell){
  58 + name = $(cell).data('name');
  59 + if(name == 'remarks'){
  60 + var link = $(cell).find('a');
  61 + if(link.length == 0){
  62 + $(cell).append('<a class="remarks-popover" href="javascript:;" data-toggle="popover" data-content="'+schedule[name]+'" >备注</a>')
  63 + }
  64 + else{
  65 + link.attr('data-content', schedule[name]);
  66 + }
  67 + }
  68 + else{
  69 + $(cell).text(schedule[name]);
  70 + }
  71 + });
48 } 72 }
49 } 73 }
50 74
src/main/resources/static/pages/control/line/js/data.js
@@ -14,7 +14,8 @@ var _data = (function(){ @@ -14,7 +14,8 @@ var _data = (function(){
14 14
15 var dateStr = moment().format('YYYY-MM-DD'); 15 var dateStr = moment().format('YYYY-MM-DD');
16 //实际排班 16 //实际排班
17 - var schedules = {}; 17 + var schedules = {}
  18 + ,scheduleList = [];
18 19
19 var dataObject = { 20 var dataObject = {
20 getLines: function(){ 21 getLines: function(){
@@ -68,10 +69,10 @@ var _data = (function(){ @@ -68,10 +69,10 @@ var _data = (function(){
68 }, 69 },
69 //查询实际排班计划 70 //查询实际排班计划
70 queryRealSchedule: function(lineArrayStr, cb){ 71 queryRealSchedule: function(lineArrayStr, cb){
71 - $.get('/realSchedule/lines', {lines: lineArrayStr} ,function(scheduls){ 72 + $.get('/realSchedule/lines', {lines: lineArrayStr} ,function(rs){
72 var list, sm, em; 73 var list, sm, em;
73 - for(var lineCode in scheduls){  
74 - list = scheduls[lineCode]; 74 + for(var lineCode in rs){
  75 + list = rs[lineCode];
75 $.each(list, function(){ 76 $.each(list, function(){
76 //发车时间 + 历时 = 终点时间 77 //发车时间 + 历时 = 终点时间
77 if(this.bcsj){ 78 if(this.bcsj){
@@ -82,9 +83,11 @@ var _data = (function(){ @@ -82,9 +83,11 @@ var _data = (function(){
82 this.zdsj = em.format('HH:mm'); 83 this.zdsj = em.format('HH:mm');
83 //终点时间戳 84 //终点时间戳
84 this.zdsjT = em.valueOf(); 85 this.zdsjT = em.valueOf();
85 - //缓存实际排班计划  
86 - schedules[this.id] = this;  
87 } 86 }
  87 +
  88 + //缓存实际排班计划
  89 + schedules[this.id] = this;
  90 + scheduleList.push(this);
88 }); 91 });
89 92
90 //按发车时间排序 93 //按发车时间排序
@@ -92,13 +95,21 @@ var _data = (function(){ @@ -92,13 +95,21 @@ var _data = (function(){
92 return a.fcsjT - b.fcsjT; 95 return a.fcsjT - b.fcsjT;
93 }); 96 });
94 } 97 }
95 -  
96 - cb && cb(scheduls); 98 + cb && cb(rs);
97 }); 99 });
98 }, 100 },
99 //根据排班ID获取排班 101 //根据排班ID获取排班
100 getSchedulById: function(id){ 102 getSchedulById: function(id){
101 return schedules[id]; 103 return schedules[id];
  104 + },
  105 + //根据车辆内部编码获取排班数组
  106 + getSchedulByVeh: function(nbbm){
  107 + var array = [];
  108 + $.each(scheduleList, function(){
  109 + if(this.clZbh == nbbm)
  110 + array.push(this);
  111 + });
  112 + return array;
102 } 113 }
103 }; 114 };
104 115
src/main/resources/static/pages/control/line/js/rightMenu.js
@@ -15,7 +15,6 @@ var _menu = (function() { @@ -15,7 +15,6 @@ var _menu = (function() {
15 layer.alert('无法找到当前项对应的班次信息,请尝试刷新页面!', {icon: 2, title: '异常'}); 15 layer.alert('无法找到当前项对应的班次信息,请尝试刷新页面!', {icon: 2, title: '异常'});
16 return; 16 return;
17 } 17 }
18 - console.log(schedul);  
19 menuObject[method](schedul); 18 menuObject[method](schedul);
20 }); 19 });
21 20
@@ -44,7 +43,7 @@ var _menu = (function() { @@ -44,7 +43,7 @@ var _menu = (function() {
44 }, 43 },
45 //待发调整 44 //待发调整
46 outgoAdjust: function(schedul){ 45 outgoAdjust: function(schedul){
47 - layer.open({ 46 + var index = layer.open({
48 type: 1, 47 type: 1,
49 area: ['630px', '545px'], 48 area: ['630px', '545px'],
50 maxmin: true, 49 maxmin: true,
@@ -55,25 +54,50 @@ var _menu = (function() { @@ -55,25 +54,50 @@ var _menu = (function() {
55 success: function(){ 54 success: function(){
56 $('#outgoAdjustForm button.confirm').one('click', function(){ 55 $('#outgoAdjustForm button.confirm').one('click', function(){
57 var params = $('#outgoAdjustForm').serializeJSON(); 56 var params = $('#outgoAdjustForm').serializeJSON();
58 - console.log(params); 57 + $post('/realSchedule/outgoAdjust', params, function(rs){
  58 + layer.close(index);
  59 + layer.msg('调整成功!');
  60 + schedul.dfsj = rs.dfsj;
  61 + schedul.remarks = rs.remarks;
  62 + _alone.refreshSchedule(schedul);
  63 + });
59 }); 64 });
60 } 65 }
61 }); 66 });
62 }, 67 },
63 //计划烂班 68 //计划烂班
64 - planDestroy: function(){ 69 + planDestroy: function(schedul){
  70 + var data = {item: schedul, array : _data.getSchedulByVeh(schedul.clZbh)}
65 layer.open({ 71 layer.open({
66 type: 1, 72 type: 1,
67 - area: ['370px', '585px'], 73 + area: ['370px', '605px'],
68 maxmin: true, 74 maxmin: true,
69 skin:'layui-layer-molv', 75 skin:'layui-layer-molv',
70 - content: template('plan_destroy_body_temp', {}), 76 + content: template('plan_destroy_body_temp', data),
71 shift: 5, 77 shift: 5,
72 title: '计划烂班设置', 78 title: '计划烂班设置',
73 success: function(){ 79 success: function(){
74 - $('#planDestroyForm .icheck').iCheck({  
75 - checkboxClass: 'icheckbox_square-red',  
76 - increaseArea: '20%' 80 + var f = $('#planDestroyForm');
  81 + $('.icheck', f).iCheck({
  82 + checkboxClass: 'icheckbox_square-red',
  83 + increaseArea: '20%'
  84 + });
  85 + //滚动到选中项
  86 + var cont = $('.custom-check-box', f)
  87 + ,checked = $('.icheck:checked', f);
  88 + if(checked.length > 0){
  89 + cont.animate({
  90 + scrollTop: checked.offset().top - cont.offset().top + checked.scrollTop()
  91 + }, 500);
  92 + }
  93 + //确定
  94 + $('button.confirm', f).one('click', function(){
  95 + var params = f.serializeJSON()
  96 + ,text = '确定烂掉部分班次?,';
  97 + $.each(params.ids, function(i, id){
  98 + var s = _data.getSchedulById(id);
  99 + text += (s.)
  100 + });
77 }); 101 });
78 } 102 }
79 }); 103 });
src/main/resources/static/pages/control/line/temps/alone_tp.html
@@ -30,14 +30,18 @@ @@ -30,14 +30,18 @@
30 {{each up as item i}} 30 {{each up as item i}}
31 <tr data-id={{item.id}}> 31 <tr data-id={{item.id}}>
32 <td name="lineNo">{{i + 1}}</td> 32 <td name="lineNo">{{i + 1}}</td>
33 - <td><a href="javascript:;">{{item.lpName}}</a></td>  
34 - <td>{{item.clZbh}}</td>  
35 - <td>{{item.zdsj}}</td> 33 + <td data-name="lpName"><a href="javascript:;">{{item.lpName}}</a></td>
  34 + <td data-name="clZbh">{{item.clZbh}}</td>
  35 + <td data-name="zdsj">{{item.zdsj}}</td>
36 <td></td> 36 <td></td>
37 - <td>{{item.fcsj}}</td>  
38 - <td>{{item.dfsj}}</td> 37 + <td data-name="fcsj">{{item.fcsj}}</td>
  38 + <td data-name="dfsj">{{item.dfsj}}</td>
39 <td></td> 39 <td></td>
40 - <td class="hide-lt-1080"></td> 40 + <td class="hide-lt-1080" data-name="remarks">
  41 + {{if item.remarks != null}}
  42 + <a class="remarks-popover" href="javascript:;" data-toggle="popover" data-content="{{item.remarks}}" >备注</a>
  43 + {{/if}}
  44 + </td>
41 <td><a href="javascript:;">主</a></td> 45 <td><a href="javascript:;">主</a></td>
42 </tr> 46 </tr>
43 {{/each}} 47 {{/each}}
@@ -71,16 +75,20 @@ @@ -71,16 +75,20 @@
71 <table class="table table-striped table-bordered table-advance pb-table data"> 75 <table class="table table-striped table-bordered table-advance pb-table data">
72 <tbody> 76 <tbody>
73 {{each down as item i}} 77 {{each down as item i}}
74 - <tr> 78 + <tr data-id={{item.id}}>
75 <td name="lineNo">{{i + 1}}</td> 79 <td name="lineNo">{{i + 1}}</td>
76 - <td><a href="javascript:;">{{item.lpName}}</a></td>  
77 - <td>{{item.clZbh}}</td>  
78 - <td>{{item.zdsj}}</td> 80 + <td data-name="lpName"><a href="javascript:;">{{item.lpName}}</a></td>
  81 + <td data-name="clZbh">{{item.clZbh}}</td>
  82 + <td data-name="zdsj">{{item.zdsj}}</td>
79 <td></td> 83 <td></td>
80 - <td>{{item.fcsj}}</td>  
81 - <td>{{item.dfsj}}</td> 84 + <td data-name="fcsj">{{item.fcsj}}</td>
  85 + <td data-name="dfsj">{{item.dfsj}}</td>
82 <td></td> 86 <td></td>
83 - <td class="hide-lt-1080"></td> 87 + <td class="hide-lt-1080" data-name="remarks">
  88 + {{if item.remarks != null}}
  89 + <a class="remarks-popover" href="javascript:;" data-toggle="popover" data-content="{{item.remarks}}" >备注</a>
  90 + {{/if}}
  91 + </td>
84 <td><a href="javascript:;">主</a></td> 92 <td><a href="javascript:;">主</a></td>
85 </tr> 93 </tr>
86 {{/each}} 94 {{/each}}
@@ -214,6 +222,7 @@ @@ -214,6 +222,7 @@
214 <!-- 待发调整 --> 222 <!-- 待发调整 -->
215 <script id="outgo_adjust_body_temp" type="text/html"> 223 <script id="outgo_adjust_body_temp" type="text/html">
216 <form action="#" class="form-horizontal form-custom" id="outgoAdjustForm"> 224 <form action="#" class="form-horizontal form-custom" id="outgoAdjustForm">
  225 + <input value={{id}} type="hidden" name="id">
217 <div class="form-body"> 226 <div class="form-body">
218 <div class="form-custom-row"> 227 <div class="form-custom-row">
219 <div class="item"> 228 <div class="item">
@@ -292,7 +301,7 @@ @@ -292,7 +301,7 @@
292 <div class="form-custom-row"> 301 <div class="form-custom-row">
293 <div class="item full"> 302 <div class="item full">
294 <span class="item-label" style="width: 80px;">内部编码: </span> 303 <span class="item-label" style="width: 80px;">内部编码: </span>
295 - <input disabled class="form-control" value="W2B-095"> 304 + <input disabled class="form-control" value="{{item.clZbh}}">
296 </div> 305 </div>
297 </div> 306 </div>
298 307
@@ -301,27 +310,12 @@ @@ -301,27 +310,12 @@
301 <span class="item-label" style="width: 80px;vertical-align: top;">执行班次: </span> 310 <span class="item-label" style="width: 80px;vertical-align: top;">执行班次: </span>
302 <div class="custom-check-box" > 311 <div class="custom-check-box" >
303 <div class="checkbox-list"> 312 <div class="checkbox-list">
  313 +{{each array as obj i}}
304 <label> 314 <label>
305 - <div class="checker"><span><input type="checkbox" class="icheck"></span></div> 11:56  
306 - </label>  
307 - <label>  
308 - <div class="checker"><span><input type="checkbox" class="icheck"></span></div> 16:31  
309 - </label>  
310 - <label>  
311 - <div class="checker"><span><input type="checkbox" class="icheck"></span></div> 16:46  
312 - </label>  
313 - <label>  
314 - <div class="checker"><span><input type="checkbox" class="icheck"></span></div> 17:34  
315 - </label>  
316 - <label>  
317 - <div class="checker"><span><input type="checkbox" class="icheck"></span></div> 18:48  
318 - </label>  
319 - <label>  
320 - <div class="checker"><span><input type="checkbox" class="icheck"></span></div> 19:40  
321 - </label>  
322 - <label>  
323 - <div class="checker"><span><input type="checkbox" class="icheck"></span></div> 20:33 315 + <div class="checker">
  316 + <span><input type="checkbox" value={{obj.id}} name="ids[]" class="icheck" {{if obj.fcsj==item.fcsj}}checked{{/if}}></span></div> {{obj.fcsj}}
324 </label> 317 </label>
  318 +{{/each}}
325 </div> 319 </div>
326 </div> 320 </div>
327 </div> 321 </div>
@@ -352,7 +346,7 @@ @@ -352,7 +346,7 @@
352 346
353 <div class="form-custom-row"> 347 <div class="form-custom-row">
354 <div class="item full" > 348 <div class="item full" >
355 - <textarea class="form-control" rows="4" placeholder="不超过50个字符"></textarea> 349 + <textarea class="form-control" rows="4" name="remarks" placeholder="烂班说明!不超过50个字符,必填"></textarea>
356 </div> 350 </div>
357 </div> 351 </div>
358 352