Commit 1b1d237b2d8608c0ba81c517702544a087576e1f

Authored by 徐烜
2 parents 7c9a72d4 28d9bc72
Showing 49 changed files with 1234 additions and 268 deletions
... ... @@ -5,7 +5,7 @@
5 5 <groupId>com.bsth</groupId>
6 6 <artifactId>bsth_control</artifactId>
7 7 <version>0.0.1-SNAPSHOT</version>
8   - <packaging>jar</packaging>
  8 + <packaging>war</packaging>
9 9  
10 10 <parent>
11 11 <groupId>org.springframework.boot</groupId>
... ... @@ -19,11 +19,11 @@
19 19 <artifactId>spring-boot-starter-web</artifactId>
20 20 </dependency>
21 21  
22   - <!-- <dependency>
  22 + <dependency>
23 23 <groupId>org.springframework.boot</groupId>
24 24 <artifactId>spring-boot-starter-tomcat</artifactId>
25 25 <scope>provided</scope>
26   - </dependency> -->
  26 + </dependency>
27 27  
28 28 <dependency>
29 29 <groupId>org.springframework.boot</groupId>
... ...
src/main/java/com/bsth/Application.java
... ... @@ -4,21 +4,28 @@ import com.fasterxml.jackson.databind.ObjectMapper;
4 4 import com.fasterxml.jackson.databind.SerializationFeature;
5 5 import org.springframework.boot.SpringApplication;
6 6 import org.springframework.boot.autoconfigure.SpringBootApplication;
  7 +import org.springframework.boot.builder.SpringApplicationBuilder;
  8 +import org.springframework.boot.context.web.SpringBootServletInitializer;
7 9 import org.springframework.context.annotation.Bean;
8 10 import org.springframework.context.annotation.Primary;
9 11  
10 12 @SpringBootApplication
11   -public class Application{
  13 +public class Application extends SpringBootServletInitializer {
12 14  
13   - @Bean
14   - @Primary
15   - public ObjectMapper objectMapper() {
16   - ObjectMapper objectMapper = new ObjectMapper();
17   - objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
  15 + @Override
  16 + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
  17 + return application.sources(Application.class);
  18 + }
  19 +
  20 + @Bean
  21 + @Primary
  22 + public ObjectMapper objectMapper() {
  23 + ObjectMapper objectMapper = new ObjectMapper();
  24 + objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
  25 +
  26 + return objectMapper;
  27 + }
18 28  
19   - return objectMapper;
20   - }
21   -
22 29 public static void main(String[] args) throws Exception {
23 30 SpringApplication.run(Application.class, args);
24 31 }
... ...
src/main/java/com/bsth/StartCommand.java
... ... @@ -93,7 +93,7 @@ public class StartCommand implements CommandLineRunner{
93 93 * 每15秒从数据库抓取到离站信息和班次匹配
94 94 * (网关生成的到离站数据也是延迟批量入库,所以缩短该线程执行周期并不会提高 “实际到离站” 的实时性)
95 95 */
96   - scheduler.scheduleWithFixedDelay(gpsArrivalStationThread, 35, 1200, TimeUnit.SECONDS);
  96 + //scheduler.scheduleWithFixedDelay(gpsArrivalStationThread, 35, 1200, TimeUnit.SECONDS);
97 97  
98 98 /**
99 99 * 首个调度指令下发(2分钟运行一次)
... ...
src/main/java/com/bsth/controller/LineController.java
... ... @@ -51,8 +51,11 @@ public class LineController extends BaseController&lt;Line, Integer&gt; {
51 51 @RequestMapping(method = RequestMethod.POST)
52 52 public Map<String, Object> save(Line t){
53 53  
54   - t.setId(Integer.valueOf(t.getLineCode()));
55   -
  54 + if(t.getId()==null) {
  55 +
  56 + t.setId(Integer.valueOf(t.getLineCode()));
  57 +
  58 + }
56 59 return service.save(t);
57 60 }
58 61 }
... ...
src/main/java/com/bsth/controller/StationRouteController.java
... ... @@ -92,11 +92,10 @@ public class StationRouteController extends BaseController&lt;StationRoute, Integer
92 92 *
93 93 * @param map <id:线路ID>
94 94 *
95   - * @return Map<String, Object> <SUCCESS ; ERROR>
  95 + * @return Map<String, Object> <SUCCESS ; ERROR ; NOTDATA>
96 96 */
97 97 @RequestMapping(value = "/usingSingle",method = RequestMethod.POST)
98 98 public Map<String, Object> usingSingle(@RequestParam Map<String, Object> map) {
99   -
100 99 return service.usingSingle(map);
101 100 }
102 101  
... ...
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
... ... @@ -5,6 +5,7 @@ import java.util.List;
5 5 import java.util.Map;
6 6  
7 7 import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.web.bind.annotation.PathVariable;
8 9 import org.springframework.web.bind.annotation.RequestMapping;
9 10 import org.springframework.web.bind.annotation.RequestMethod;
10 11 import org.springframework.web.bind.annotation.RequestParam;
... ... @@ -205,6 +206,18 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
205 206 public Map<Integer, Integer> trustStatus(@RequestParam String lineCodes) {
206 207 return scheduleRealInfoService.trustStatus(lineCodes);
207 208 }
  209 +
  210 + /**
  211 + *
  212 + * @Title: outgoAdjustAll
  213 + * @Description: TODO(批量待发调整)
  214 + * @param @param list
  215 + * @throws
  216 + */
  217 + @RequestMapping(value = "/outgoAdjustAll", method = RequestMethod.POST)
  218 + public Map<String, Object> outgoAdjustAll(@RequestParam String params){
  219 + return scheduleRealInfoService.outgoAdjustAll(params);
  220 + }
208 221  
209 222 /**
210 223 *
... ... @@ -216,6 +229,29 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
216 229 ScheduleBuffer.trustMap.put(lineCode, status);
217 230 return 200;
218 231 }
  232 +
  233 + /**
  234 + *
  235 + * @Title: findByLineAndUpDown
  236 + * @Description: TODO(根据线路和走向获取班次)
  237 + * @param @param line
  238 + * @param @param upDown
  239 + */
  240 + @RequestMapping(value = "/findByLineAndUpDown")
  241 + public List<ScheduleRealInfo> findByLineAndUpDown(@RequestParam Integer line,@RequestParam Integer upDown){
  242 + return ScheduleBuffer.findByLineAndUpDown(line, upDown);
  243 + }
  244 +
  245 + /**
  246 + *
  247 + * @Title: findByLineCode
  248 + * @Description: TODO(根据线路获取班次信息)
  249 + * @param @param lineCode
  250 + */
  251 + @RequestMapping(value = "/lineCode/{lineCode}")
  252 + public List<ScheduleRealInfo> findByLineCode(@PathVariable("lineCode") String lineCode){
  253 + return ScheduleBuffer.schedulListMap.get(lineCode);
  254 + }
219 255  
220 256 @RequestMapping(value = "/queryUserInfo")
221 257 public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line, @RequestParam String date) {
... ...
src/main/java/com/bsth/entity/realcontrol/ChildTaskPlan.java
... ... @@ -95,7 +95,7 @@ public class ChildTaskPlan {
95 95 /**
96 96 * 主排班计划
97 97 */
98   - @ManyToOne(fetch = FetchType.LAZY)
  98 + @ManyToOne
99 99 private ScheduleRealInfo schedule;
100 100  
101 101 private String remarks;
... ...
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
... ... @@ -482,6 +482,17 @@ public class ScheduleRealInfo {
482 482 this.dfsj = sdfHHmm.format(new Date(this.dfsjT));
483 483 }
484 484  
  485 + public void setDfsjAll(String dfsj) {
  486 +
  487 + try {
  488 + String dfsjFull = sdfyyyyMMdd.format(this.scheduleDate) + " " + dfsj;
  489 + this.dfsjT = sdfyyyyMMddHHmm.parse(dfsjFull).getTime();
  490 + this.dfsj = dfsj;
  491 + } catch (ParseException e) {
  492 + e.printStackTrace();
  493 + }
  494 + }
  495 +
485 496 @Transient
486 497 static SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd");
487 498 @Transient
... ...
src/main/java/com/bsth/repository/SectionRouteRepository.java
... ... @@ -142,6 +142,13 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int
142 142 @Query(value = " select MAX(r.sectionroute_code) as sectionrouteCode from bsth_c_sectionroute r WHERE r.line=?1 and r.directions =?2 and r.sectionroute_code< ?3", nativeQuery=true)
143 143 List<Object[]> findUpSectionRouteCode(Integer lineId,Integer direction,Integer stationRouteCode);
144 144  
  145 + /**
  146 + * @Description :TODO(获取路段路由信息)
  147 + *
  148 + * @param lineId:线路ID;directions:方向
  149 + *
  150 + * @return List<Map<String, Object>> {[0]:directions(方向);[1]:bsection_vector(路段坐标);[2]:speed_limit(限速);[3]:section_name(路段名称)}
  151 + */
145 152 @Query(value = "SELECT " +
146 153 "c.directions," +
147 154 "AsText(s.bsection_vector) as bsection_vector," +
... ... @@ -149,5 +156,5 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int
149 156 "s.section_name " +
150 157 " FROM bsth_c_sectionroute c " +
151 158 " LEFT JOIN bsth_c_section s on c.section = s.id where c.line = ?1 and c.directions = ?2", nativeQuery=true)
152   -List<Object[]> sectionRouteVector(Integer lineId,Integer directions);
  159 + List<Object[]> sectionRouteVector(Integer lineId,Integer directions);
153 160 }
... ...
src/main/java/com/bsth/repository/StationRouteRepository.java
... ... @@ -7,6 +7,8 @@ import org.springframework.data.jpa.repository.Query;
7 7 import org.springframework.stereotype.Repository;
8 8 import org.springframework.transaction.annotation.Transactional;
9 9  
  10 +import com.bsth.entity.Line;
  11 +import com.bsth.entity.LineInformation;
10 12 import com.bsth.entity.StationRoute;
11 13  
12 14 /**
... ... @@ -124,7 +126,11 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
124 126 *
125 127 * @param lineId:线路ID
126 128 *
127   - * @return List<Object[]>
  129 + * @return List<Object[]>:{[0]:g_lonx(GPS经度);[1]:g_laty(GPS纬度);[2]:b_jwpoints(百度经纬度坐标)
  130 + *
  131 + * [3]:station_mark(站点类型);[4]:station_route_code(站点序号);[5]:station_cod(站点编码);
  132 + *
  133 + * [6]:distances(站点距离);[7]:station_name(站点名称);[8]:directions(方向)}
128 134 */
129 135 @Query(value = "SELECT * FROM ("+
130 136 "SELECT b.g_lonx," +
... ... @@ -212,4 +218,6 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
212 218 " s.update_date AS stationRouteUpdateDate FROM bsth_c_stationroute s WHERE s.id = ?1 ) a " +
213 219 " LEFT JOIN bsth_c_station b ON a.stationRouteStation = b.id", nativeQuery=true)
214 220 List<Object[]> findStationRouteInfo(Integer id);
  221 +
  222 + List<StationRoute> findByLine(Line line);
215 223 }
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -4,10 +4,6 @@ import java.util.Date;
4 4 import java.util.List;
5 5 import java.util.Map;
6 6  
7   -import org.springframework.data.domain.Page;
8   -import org.springframework.data.domain.Pageable;
9   -import org.springframework.data.jpa.domain.Specification;
10   -import org.springframework.data.jpa.repository.EntityGraph;
11 7 import org.springframework.data.jpa.repository.Query;
12 8 import org.springframework.stereotype.Repository;
13 9  
... ... @@ -20,9 +16,6 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
20 16 @Query("select s from ScheduleRealInfo s where s.xlBm in ?1")
21 17 List<ScheduleRealInfo> findByLines(List<String> lines);
22 18  
23   - @EntityGraph(value = "scheduleRealInfo_childTasks", type = EntityGraph.EntityGraphType.FETCH)
24   - @Override
25   - Page<ScheduleRealInfo> findAll(Specification<ScheduleRealInfo> spec, Pageable pageable);
26 19  
27 20 @Query(value="select s from ScheduleRealInfo s where s.xlName = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 group by jName,clZbh,lpName")
28 21 List<ScheduleRealInfo> queryUserInfo(String line,String date);
... ...
src/main/java/com/bsth/service/StationRouteService.java
... ... @@ -65,7 +65,7 @@ public interface StationRouteService extends BaseService&lt;StationRoute, Integer&gt;
65 65 *
66 66 * @param map <id:线路ID>
67 67 *
68   - * @return Map<String, Object> <SUCCESS ; ERROR>
  68 + * @return Map<String, Object> <SUCCESS ; ERROR ; NOTDATA>
69 69 */
70 70 Map<String, Object> usingSingle(Map<String, Object> map);
71 71  
... ...
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
1 1 package com.bsth.service.impl;
2 2  
3   -import java.awt.Point;
4 3 import java.io.ByteArrayInputStream;
5 4 import java.io.File;
6 5 import java.io.InputStream;
  6 +import java.text.DecimalFormat;
7 7 import java.util.ArrayList;
8 8 import java.util.HashMap;
9 9 import java.util.List;
... ... @@ -23,7 +23,7 @@ import com.bsth.repository.StationRepository;
23 23 import com.bsth.repository.StationRouteRepository;
24 24 import com.bsth.service.StationRouteService;
25 25 import com.bsth.util.FTPClientUtils;
26   -import com.bsth.util.Test;
  26 +import com.bsth.util.PackTarGZUtils;
27 27 import com.bsth.util.db.DBUtils_MS;
28 28  
29 29 /**
... ... @@ -505,11 +505,12 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
505 505 *
506 506 * @param map <lineId:线路ID>
507 507 *
508   - * @return Map<String, Object> <SUCCESS ; ERROR>
  508 + * @return Map<String, Object> <SUCCESS ; ERROR ; NOTDATA>
509 509 */
510 510 @Override
511 511 public Map<String, Object> usingSingle(Map<String, Object> map) {
512 512  
  513 + // 返回值map
513 514 Map<String, Object> resultMap = new HashMap<String,Object>();
514 515  
515 516 try {
... ... @@ -517,63 +518,75 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
517 518 // 获取线路ID
518 519 Integer lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString());
519 520  
520   - /** 查询线路信息 */
  521 + /** 查询线路信息 @param:<lineId:线路ID> */
521 522 Line line = lineRepository.findOne(lineId);
522 523  
  524 + /** 查询线路信息下的站点路由信息 @param:<lineId:线路ID> */
523 525 List<Object[]> objects = repository.usingSingle(lineId);
524 526  
525 527 if (objects.size()>0) {
526 528  
527   - /** 获取配置文件里的ftp参数 */
  529 + /** 获取配置文件里的ftp登录参数 */
528 530 Map<String, Object> FTPParamMap = readPropertiesGetFTPParam();
529 531  
530 532 // 压缩文件名
531 533 String odlGzFileName = line.getLineCode() + ".txt.gz";
532 534  
533   - // text文件名
  535 + // txt文件名
534 536 String textFileName = line.getLineCode() + ".txt";
535 537  
  538 + // 创建一个ftp上传实例
536 539 FTPClientUtils clientUtils = new FTPClientUtils();
537 540  
  541 + // IP
538 542 String url = FTPParamMap.get("url").toString();
539 543  
  544 + // 端口
540 545 int port = Integer.valueOf(FTPParamMap.get("port").toString());
541 546  
  547 + // 用户名
542 548 String username = FTPParamMap.get("username").toString();
543 549  
  550 + // 密码
544 551 String password = FTPParamMap.get("password").toString();
545 552  
  553 + // 相对路径
546 554 String remotePath = FTPParamMap.get("remotePath").toString();
547 555  
548   - /** 如果行单文件已存在则删除 */
  556 + /** 如果已存在相同行单文件名则先删除 */
549 557 clientUtils.deleteFtpFile(url, port, username, password, remotePath, odlGzFileName);
550 558  
551 559 clientUtils.deleteFtpFile(url, port, username, password, remotePath, textFileName);
552 560  
  561 + /** 行单文件内容 @param:<objects:站点路由;lineId:线路ID>*/
553 562 String textStr = newTextFileToFTP(objects,lineId);
554 563  
555   - /*textStr = line.getName() + "\t" + "2" + "\r\n" + textStr;*/
  564 + /*textStr = line.getName() + "\t" + "2" + "\r" + textStr;*/
556 565  
557   - textStr = line.getName() + "\t" + "2" + "\r" + textStr;
  566 + textStr = line.getName() + " " + "2" + "\r" + textStr;
558 567  
559 568 InputStream input = new ByteArrayInputStream(textStr.getBytes("gbk"));
560 569  
561   - /** 生成text文件 */
  570 + /** 生成txt文件,上传ftp */
562 571 clientUtils.uploadFile(url, port, username, password, remotePath, textFileName, input);
563 572  
564   - Test test= new Test();
  573 + // 创建打包实例
  574 + PackTarGZUtils packTarGZUtils= new PackTarGZUtils();
565 575  
  576 + /** 获取txt文件 */
566 577 File textFile = clientUtils.GetFtpFile(url, port, username, password, remotePath, textFileName);
567 578  
  579 + /*File[] sources = new File[] {textFile};*/
568 580 File[] sources = new File[] {textFile};
569 581  
570 582 File target = new File(odlGzFileName);
571   -
572   - File targetFile = test.pack(sources, target);
  583 +
  584 + // 将txt文件打包
  585 + File targetFile = packTarGZUtils.pack(sources, target);
573 586  
574 587 /*clientUtils.testUpLoadFromDisk(targetFile,targetFile.getName());*/
575 588  
576   - clientUtils.testUpLoadFromDisk(targetFile, targetFile.getName(), url, port, username, password, remotePath);
  589 + clientUtils.FTPUpLoadFromDisk(targetFile, targetFile.getName(), url, port, username, password, remotePath);
577 590  
578 591 resultMap.put("status", ResponseCode.SUCCESS);
579 592  
... ... @@ -593,12 +606,28 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
593 606 return resultMap;
594 607 }
595 608  
  609 + /**
  610 + * @Description : TODO(形成行单文件内容)
  611 + *
  612 + * @param objects :站点路由信息
  613 + *
  614 + * {[0]:g_lonx(GPS经度);[1]:g_laty(GPS纬度);[2]:b_jwpoints(百度经纬度坐标)
  615 + *
  616 + * [3]:station_mark(站点类型);[4]:station_route_code(站点序号);[5]:station_cod(站点编码);
  617 + *
  618 + * [6]:distances(站点距离);[7]:station_name(站点名称);[8]:directions(方向)}
  619 + *
  620 + * @param lineId :线路ID
  621 + *
  622 + * @return String
  623 + */
596 624 public String newTextFileToFTP(List<Object[]> objects,Integer lineId) {
597 625  
  626 + // 返回值String
598 627 String stationRStr = "";
599 628  
600 629 // windows下的文本文件换行符
601   - // String enterStr = "\r\n";
  630 + //String enterStr = "\r\n";
602 631  
603 632 // linux/unix下的文本文件换行符
604 633 String enterStr = "\r";
... ... @@ -616,15 +645,17 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
616 645 lat = "\t" + lat;
617 646  
618 647 // 站点类型
619   - String stationMake = objects.get(i)[3].equals("") ? "" : objects.get(i)[3].toString();
  648 + String stationMakeStr = objects.get(i)[3].equals("") ? "" : objects.get(i)[3].toString();
  649 +
  650 + String stationMake = "";
620 651  
621   - if(stationMake.equals("E")) {
  652 + if(stationMakeStr.equals("E")) {
622 653  
623   - stationMake = "\t" + "2";
  654 + stationMake = "\t2";
624 655  
625 656 }else {
626 657  
627   - stationMake ="\t" + "1";
  658 + stationMake ="\t1";
628 659  
629 660 }
630 661  
... ... @@ -638,30 +669,35 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
638 669  
639 670 stationCode = "\t" +stationCode;
640 671  
641   - double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString());
  672 + double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000;
642 673  
643   - double tempd = dis*1000;
  674 + String tempDistc = String.valueOf((int) dis);
644 675  
645 676 // 站点距离
646   - String staitondistance = "\t" + String.valueOf((int) tempd);
  677 + String staitondistance = "\t" + tempDistc;
647 678  
648 679 // 站点名称
649 680 String stationName = objects.get(i)[7].equals("") ? "" : objects.get(i)[7].toString();
650 681  
  682 + stationName = "\t" +stationName;
  683 +
651 684 // 限速
652 685 // String sleepStr = " " + "60";
653 686  
  687 + // 限速
654 688 String sleepStr = "";
655 689  
  690 + // 方向
656 691 int directions = objects.get(i)[8]==null ? null : Integer.valueOf(objects.get(i)[8].toString());
657 692  
  693 + /** 获取路段路由信息 @pararm:<lineId:线路ID;directions:方向> */
658 694 List<Object[]> sobje = routeRepository.sectionRouteVector(lineId,directions);
659 695  
660 696 if(sobje.size()==1) {
661 697  
662   - sleepStr = sobje.get(0)[2] == null ? "" : sobje.get(0)[2].toString();
  698 + double dsleepStr = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(0)[2].toString());
663 699  
664   - sleepStr = "\t" + sleepStr;
  700 + sleepStr = "\t" + new DecimalFormat("0").format(dsleepStr);
665 701  
666 702 }else if(sobje.size()>1){
667 703  
... ... @@ -674,9 +710,11 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
674 710  
675 711 if(stationName.equals(sectionNameA[0])){
676 712  
677   - sleepStr = sobje.get(j)[2].toString();
  713 + /*sleepStr = sobje.get(j)[2].toString();*/
  714 +
  715 + double dsleepStrt = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(j)[2].toString());
678 716  
679   - sleepStr = "\t" + sleepStr;
  717 + sleepStr = "\t" + new DecimalFormat("0").format(dsleepStrt);
680 718  
681 719 }
682 720  
... ... @@ -698,12 +736,6 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
698 736 sleepStr = sleepStr + GetFormPointOnPolylineSeleepLimit(pointsM,sobje);*/
699 737 }
700 738  
701   - if(sleepStr.equals(""))
702   - sleepStr = "\t" + "60";
703   -
704   -
705   - stationName = "\t" +stationName;
706   -
707 739 stationRStr = stationRStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr;
708 740  
709 741 }
... ... @@ -798,8 +830,14 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
798 830 return success;
799 831 }
800 832  
  833 + /**
  834 + * @Description:TOOD(获取FTP登录参数) 这里暂时只做一个map值返回,以后可以作为ftp登录类提出来
  835 + *
  836 + * @return : Map<String, Object> <url:IP;port:端口;username:用户名;password:密码;remotePath:相对路径>
  837 + */
801 838 public Map<String, Object> readPropertiesGetFTPParam(){
802 839  
  840 + // 返回值map
803 841 Map<String, Object> resultMap = new HashMap<String, Object>();
804 842  
805 843 Properties env = new Properties();
... ...
src/main/java/com/bsth/service/impl/StationServiceImpl.java
... ... @@ -161,6 +161,11 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
161 161 // 更新里程
162 162 updateLineInfoUpOrDownMileage( resultLine , directions, sumUpOrDownMileage);
163 163  
  164 + if(directions==0) {
  165 +
  166 + lineUpdateStationName(resultLine);
  167 +
  168 + }
164 169 resultMap.put("status", ResponseCode.SUCCESS);
165 170  
166 171 } catch (Exception e) {
... ... @@ -175,6 +180,53 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
175 180 }
176 181  
177 182  
  183 + public void lineUpdateStationName(Line resultLine) {
  184 +
  185 + List<StationRoute> stationRoutes = routeRepository.findByLine(resultLine);
  186 +
  187 + int sizeL = stationRoutes.size();
  188 +
  189 + if(sizeL<0) {
  190 +
  191 + return;
  192 +
  193 + }
  194 +
  195 + if(resultLine.getStartStationName()==null){
  196 +
  197 + for(int k =0;k<sizeL;k++) {
  198 +
  199 + StationRoute tempS = stationRoutes.get(k);
  200 +
  201 + if(tempS.getStationMark().equals("B") && tempS.getDirections()==0) {
  202 +
  203 + resultLine.setStartStationName(tempS.getStationName());
  204 +
  205 + lineRepository.save(resultLine);
  206 +
  207 + }
  208 + }
  209 +
  210 + };
  211 +
  212 + if(resultLine.getEndStationName()==null) {
  213 +
  214 + for(int k =0;k<sizeL;k++) {
  215 +
  216 + StationRoute tempS = stationRoutes.get(k);
  217 +
  218 + if(tempS.getStationMark().equals("E") && tempS.getDirections()==0) {
  219 +
  220 + resultLine.setEndStationName(tempS.getStationName());
  221 +
  222 + lineRepository.save(resultLine);
  223 +
  224 + }
  225 + }
  226 +
  227 + }
  228 + }
  229 +
178 230 /**
179 231 * @Description :保存站点和站点路由信息(系统规划)
180 232 *
... ... @@ -877,7 +929,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
877 929  
878 930 String stationRouteCodeArray [] = stationRouteCodeStr.split("_");
879 931  
880   - stationRouteCode = Integer.parseInt(stationRouteCodeArray[0]+1);
  932 + stationRouteCode = Integer.parseInt(stationRouteCodeArray[0].toString())+1;
881 933  
882 934  
883 935 }else {
... ... @@ -1436,6 +1488,12 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1436 1488 // 更新里程
1437 1489 updateLineInfoUpOrDownMileage( resultLine , directions, sumUpOrDownMileage);
1438 1490  
  1491 + if(directions==0) {
  1492 +
  1493 + lineUpdateStationName(resultLine);
  1494 +
  1495 + }
  1496 +
1439 1497 resultMap.put("status", ResponseCode.SUCCESS);
1440 1498  
1441 1499 } catch (Exception e) {
... ...
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
... ... @@ -78,4 +78,6 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
78 78  
79 79 Map<String, Object> schInfoFineTune(Map<String, String> map);
80 80  
  81 + Map<String, Object> outgoAdjustAll(String params);
  82 +
81 83 }
... ...
src/main/java/com/bsth/service/realcontrol/buffer/GetSchedulePlanThread.java
1 1 package com.bsth.service.realcontrol.buffer;
2 2  
  3 +import java.text.ParseException;
3 4 import java.text.SimpleDateFormat;
4 5 import java.util.Date;
5 6 import java.util.List;
... ... @@ -16,7 +17,7 @@ import com.bsth.entity.schedule.SchedulePlanInfo;
16 17 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
17 18 import com.bsth.repository.schedule.SchedulePlanInfoRepository;
18 19 import com.bsth.util.BatchSaveUtils;
19   -import com.fasterxml.jackson.databind.ObjectMapper;
  20 +import com.bsth.vehicle.directive.buffer.DirectiveBuffer;
20 21  
21 22 /**
22 23 *
... ... @@ -37,56 +38,65 @@ public class GetSchedulePlanThread extends Thread{
37 38 @Autowired
38 39 ScheduleRealInfoRepository scheduleRealInfoRepository;
39 40  
40   - @Autowired
41   - ObjectMapper objectMapper;
42   -
43 41 SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd");
44 42  
  43 + @Autowired
  44 + DirectiveBuffer directiveBuffer;
  45 +
45 46 @Override
46 47 public void run() {
47 48 try{
  49 + //清除缓存
48 50 ScheduleBuffer.clear();
  51 + //所有指令入库
  52 + directiveBuffer.saveAll();
  53 + DirectiveBuffer.clear();
49 54  
50   - List<ScheduleRealInfo> realList = null;
51   - String dateStr = sdfyyyyMMdd.format(new Date());
52   - Date cDate = sdfyyyyMMdd.parse(dateStr);
53   - //查询数据库是否有今日排班
54   - int size = scheduleRealInfoRepository.countByDate(cDate);
55   - if(size > 0){
56   - //从数据库恢复当日排班
57   - realList = scheduleRealInfoRepository.findByDate(cDate);
58   - logger.info("从数据库恢复当日排班 " + realList.size());
59   - //写入缓存
60   - ScheduleBuffer.init(realList);
61   - }
62   - else{
63   - List<SchedulePlanInfo> list = schedulePlanInfoRepository.findByDate(cDate);
64   -
65   - for(SchedulePlanInfo sp : list){
66   - sp.setSchedulePlan(null);
67   - }
68   -
69   - //实际排班计划
70   - realList = JSONArray.parseArray(JSON.toJSONString(list), ScheduleRealInfo.class);
71   - //查询数据库最大ID
72   - Long id = scheduleRealInfoRepository.getMaxId();
73   - if(null == id)
74   - id = 0L;
75   - id ++;
76   -
77   - for(ScheduleRealInfo item : realList){
78   - item.setSpId(item.getId());
79   - item.setId(id ++);//设置ID
80   - }
81   -
82   - //写入缓存
83   - ScheduleBuffer.init(realList);
84   - //入库
85   - new BatchSaveUtils<ScheduleRealInfo>().saveList(realList, ScheduleRealInfo.class);
86   - }
87   - logger.info("获取当天实际排班计划数量:" + realList.size());
  55 + //加载新的排班
  56 + loaSchedule();
88 57 }catch(Exception e){
89 58 logger.error("",e);
90 59 }
91 60 }
  61 +
  62 + public void loaSchedule() throws ParseException{
  63 + List<ScheduleRealInfo> realList = null;
  64 + String dateStr = sdfyyyyMMdd.format(new Date());
  65 + Date cDate = sdfyyyyMMdd.parse(dateStr);
  66 + //查询数据库是否有今日排班
  67 + int size = scheduleRealInfoRepository.countByDate(cDate);
  68 + if(size > 0){
  69 + //从数据库恢复当日排班
  70 + realList = scheduleRealInfoRepository.findByDate(cDate);
  71 + logger.info("从数据库恢复当日排班 " + realList.size());
  72 + //写入缓存
  73 + ScheduleBuffer.init(realList);
  74 + }
  75 + else{
  76 + List<SchedulePlanInfo> list = schedulePlanInfoRepository.findByDate(cDate);
  77 +
  78 + for(SchedulePlanInfo sp : list){
  79 + sp.setSchedulePlan(null);
  80 + }
  81 +
  82 + //实际排班计划
  83 + realList = JSONArray.parseArray(JSON.toJSONString(list), ScheduleRealInfo.class);
  84 + //查询数据库最大ID
  85 + Long id = scheduleRealInfoRepository.getMaxId();
  86 + if(null == id)
  87 + id = 0L;
  88 + id ++;
  89 +
  90 + for(ScheduleRealInfo item : realList){
  91 + item.setSpId(item.getId());
  92 + item.setId(id ++);//设置ID
  93 + }
  94 +
  95 + //写入缓存
  96 + ScheduleBuffer.init(realList);
  97 + //入库
  98 + new BatchSaveUtils<ScheduleRealInfo>().saveList(realList, ScheduleRealInfo.class);
  99 + }
  100 + logger.info("获取当天实际排班计划数量:" + realList.size());
  101 + }
92 102 }
... ...
src/main/java/com/bsth/service/realcontrol/buffer/ScheduleBuffer.java
... ... @@ -36,13 +36,19 @@ public class ScheduleBuffer {
36 36 /**
37 37 * K: 车辆自编号 V: 未完成班次链表
38 38 */
39   - public static Map<String, LinkedList<ScheduleRealInfo>> vehLinkedMap;
  39 + /*public static Map<String, LinkedList<ScheduleRealInfo>> vehLinkedMap;*/
  40 +
  41 + /**
  42 + * K: 车辆自编号 V: 班次链表
  43 + */
  44 + public static ArrayListMultimap<String, ScheduleRealInfo> vehSchListMap;
  45 + /*public static Map<String, LinkedList<ScheduleRealInfo>> vehSchLinkedMap;*/
40 46  
41 47  
42 48 /**
43 49 * K: 车辆自编号 V: 已执行班次链表
44 50 */
45   - public static LinkedListMultimap<String, ScheduleRealInfo> finishLinkedMap;
  51 + /*public static LinkedListMultimap<String, ScheduleRealInfo> finishLinkedMap;*/
46 52  
47 53  
48 54 /**
... ... @@ -73,8 +79,9 @@ public class ScheduleBuffer {
73 79 schedulListMap = ArrayListMultimap.create();
74 80 pkSchedulMap = new HashMap<>();
75 81 persistentList = new LinkedList<>();
76   - vehLinkedMap = new HashMap<>();
77   - finishLinkedMap = LinkedListMultimap.create();
  82 + /*vehLinkedMap = new HashMap<>();
  83 + finishLinkedMap = LinkedListMultimap.create();*/
  84 + vehSchListMap = ArrayListMultimap.create();
78 85 trustMap = new HashMap<>();
79 86 }
80 87  
... ... @@ -96,10 +103,11 @@ public class ScheduleBuffer {
96 103  
97 104 //初始化车辆和班次列表对照
98 105 zbh = schedul.getClZbh();
99   - if(!vehLinkedMap.containsKey(zbh))
  106 + vehSchListMap.put(zbh, schedul);
  107 + /*if(!vehLinkedMap.containsKey(zbh))
100 108 vehLinkedMap.put(zbh, new LinkedList<ScheduleRealInfo>());
101 109  
102   - vehLinkedMap.get(zbh).add(schedul);
  110 + vehLinkedMap.get(zbh).add(schedul);*/
103 111 }
104 112  
105 113 //计算起点应到时间
... ... @@ -152,18 +160,23 @@ public class ScheduleBuffer {
152 160  
153 161 public static int put(ScheduleRealInfo sch){
154 162 schedulListMap.put(sch.getXlBm(), sch);
155   - pkSchedulMap.put(sch.getId(), sch);
156 163  
  164 + pkSchedulMap.put(sch.getId(), sch);
157 165 String zbh = sch.getClZbh();
158   - if(!vehLinkedMap.containsKey(zbh))
  166 + vehSchListMap.put(zbh, sch);
  167 +
  168 + //List<ScheduleRealInfo> list = vehSchListMap.get(sch.getClZbh());
  169 +
  170 + /*if(!vehLinkedMap.containsKey(zbh))
159 171 vehLinkedMap.put(zbh, new LinkedList<ScheduleRealInfo>());
160   - vehLinkedMap.get(zbh).add(sch);
  172 + vehLinkedMap.get(zbh).add(sch);*/
161 173  
162 174 //重新排序
163   - //Collections.sort(vehLinkedMap.get(zbh), scheduleComparator);
  175 + Collections.sort(schedulListMap.get(sch.getXlBm()), scheduleComparator);
164 176  
165 177 //重新计算应到时间
166   - calcArrDateQd(vehLinkedMap.get(zbh));
  178 + //calcArrDateQd(vehLinkedMap.get(zbh));
  179 + calcArrDateQd(vehSchListMap.get(zbh));
167 180 return 0;
168 181 }
169 182  
... ... @@ -184,12 +197,15 @@ public class ScheduleBuffer {
184 197 * @throws
185 198 */
186 199 public static ScheduleRealInfo finishSch(ScheduleRealInfo sch){
187   - LinkedList<ScheduleRealInfo> list = vehLinkedMap.get(sch.getClZbh());
  200 + //LinkedList<ScheduleRealInfo> list = vehLinkedMap.get(sch.getClZbh());
188 201 //状态修改为已执行
189 202 sch.setStatus(2);
190 203 persistentList.add(sch);
191 204  
192   - ScheduleRealInfo temp;
  205 + //下一个班次
  206 + ScheduleRealInfo next = getNext(sch);
  207 + next.setQdzArrDateSJ(sch.getZdsjActual());
  208 + /*ScheduleRealInfo temp;
193 209 int len = list.size();
194 210 for(int i = 0; i < len; i ++){
195 211 temp = list.poll();
... ... @@ -199,8 +215,41 @@ public class ScheduleBuffer {
199 215 break;
200 216 }
201 217 }
202   - ScheduleRealInfo next = list.getFirst();
203   - next.setQdzArrDateSJ(sch.getZdsjActual());
  218 + ScheduleRealInfo next = list.getFirst();*/
  219 + //next.setQdzArrDateSJ(sch.getZdsjActual());
  220 + return next;
  221 + }
  222 +
  223 + public static ScheduleRealInfo getNext(ScheduleRealInfo sch){
  224 + List<ScheduleRealInfo> list = vehSchListMap.get(sch.getClZbh());
  225 +
  226 + boolean flag = false;
  227 + ScheduleRealInfo next = null;
  228 + for(ScheduleRealInfo temp : list){
  229 + if(temp.getId() == sch.getId()){
  230 + flag = true;
  231 + continue;
  232 + }
  233 + //忽略烂班
  234 + if(temp.getStatus() == -1)
  235 + continue;
  236 +
  237 + if(flag){
  238 + next = temp;
  239 + break;
  240 + }
  241 + }
  242 +
  243 +
  244 + /*int size = list.size();
  245 + for(int i = 0; i < size; i ++){
  246 + current = list.get(i);
  247 + if(current.getId() == sch.getId()
  248 + && i < (size - 1)){
  249 + next = list.get(i + 1);
  250 + break;
  251 + }
  252 + }*/
204 253 return next;
205 254 }
206 255  
... ... @@ -212,7 +261,56 @@ public class ScheduleBuffer {
212 261 * @throws
213 262 */
214 263 public static int getFinishSchNo(String nbbm){
215   - return finishLinkedMap.get(nbbm) == null ? 0 : finishLinkedMap.get(nbbm).size();
  264 + List<ScheduleRealInfo> list = vehSchListMap.get(nbbm);
  265 + int no = 0;
  266 + for(ScheduleRealInfo sch : list){
  267 + if(sch.getStatus() == 2)
  268 + no ++;
  269 + }
  270 + return no;
  271 + //return finishLinkedMap.get(nbbm) == null ? 0 : finishLinkedMap.get(nbbm).size();
  272 + }
  273 +
  274 + /**
  275 + *
  276 + * @Title: findCurrent
  277 + * @Description: TODO(获取车辆当前正在执行的班次)
  278 + * @param @param nbbm
  279 + * @throws
  280 + */
  281 + public static ScheduleRealInfo findCurrent(String nbbm){
  282 + List<ScheduleRealInfo> list = ScheduleBuffer.vehSchListMap.get(nbbm);
  283 +
  284 + int size = list.size();
  285 + ScheduleRealInfo sch;
  286 + //最后一个状态为 正在执行的班次
  287 + for(int i = size - 1; i > 0; i --){
  288 + sch = list.get(i);
  289 + if(sch.getStatus() == 1)
  290 + return sch;
  291 + }
  292 + return null;
  293 + }
  294 +
  295 + /**
  296 + *
  297 + * @Title: findNextList
  298 + * @Description: TODO(获取后续班次)
  299 + * @param @param sch
  300 + * @throws
  301 + */
  302 + public static List<ScheduleRealInfo> findNextList(ScheduleRealInfo sch){
  303 + List<ScheduleRealInfo> list = vehSchListMap.get(sch.getClZbh()),
  304 + rs = null;
  305 +
  306 + for(ScheduleRealInfo temp : list){
  307 + if(temp.getId() == sch.getId())
  308 + rs = new ArrayList<>();
  309 +
  310 + if(rs != null)
  311 + rs.add(temp);
  312 + }
  313 + return rs == null?new ArrayList<ScheduleRealInfo>():rs;
216 314 }
217 315  
218 316 public static void calcArrDateQd(List<ScheduleRealInfo> list){
... ... @@ -256,4 +354,16 @@ public class ScheduleBuffer {
256 354 public static ScheduleRealInfo findOne(Long id){
257 355 return pkSchedulMap.get(id);
258 356 }
  357 +
  358 + public static List<ScheduleRealInfo> findByLineAndUpDown(Integer lineCode, Integer upDown){
  359 + List<ScheduleRealInfo> list = schedulListMap.get(String.valueOf(lineCode))
  360 + ,subList = new ArrayList<>();
  361 + //按走向过滤
  362 + for(ScheduleRealInfo sch : list){
  363 + if(Integer.parseInt(sch.getXlDir()) == upDown){
  364 + subList.add(sch);
  365 + }
  366 + }
  367 + return subList;
  368 + }
259 369 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ChildTaskPlanServiceImpl.java
... ... @@ -12,6 +12,7 @@ import com.bsth.vehicle.common.CommonMapped;
12 12 @Service
13 13 public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Long> implements ChildTaskPlanService{
14 14  
  15 +
15 16 @Override
16 17 public Map<String, Object> save(ChildTaskPlan t) {
17 18 //保存起终点名称
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -19,6 +19,8 @@ import org.slf4j.LoggerFactory;
19 19 import org.springframework.beans.factory.annotation.Autowired;
20 20 import org.springframework.stereotype.Service;
21 21  
  22 +import com.alibaba.fastjson.JSONArray;
  23 +import com.alibaba.fastjson.JSONObject;
22 24 import com.bsth.common.ResponseCode;
23 25 import com.bsth.entity.Cars;
24 26 import com.bsth.entity.Line;
... ... @@ -121,6 +123,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
121 123 ScheduleRealInfo schedule = null;
122 124 for (String id : idList) {
123 125 schedule = ScheduleBuffer.pkSchedulMap.get(Long.parseLong(id));
  126 + /*if(schedule.getStatus() == -1){
  127 + map.put("status", ResponseCode.ERROR);
  128 + map.put("msg", value)
  129 + }*/
124 130 if (null != schedule) {
125 131 schedule.setStatus(-1);
126 132 schedule.addRemarks(remarks);
... ... @@ -264,7 +270,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
264 270 // 加入缓存
265 271 ScheduleBuffer.put(t);
266 272 //将该临加之后的班次作为更新返回页面
267   - List<ScheduleRealInfo> list = ScheduleBuffer.vehLinkedMap.get(t.getClZbh())
  273 + List<ScheduleRealInfo> list = ScheduleBuffer.findNextList(t)
268 274 ,rsList = null;
269 275  
270 276 for(ScheduleRealInfo sch : list){
... ... @@ -492,8 +498,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
492 498 rs.put("msg", "无实发时间,无法撤销!");
493 499 } else {
494 500 sch.setStatus(0);
495   - sch.setFcsjActual("");
496   - sch.setFcsjActualTime(0L);
  501 + sch.setFcsjActual(null);
  502 + sch.setFcsjActualTime(null);
497 503 rs.put("status", ResponseCode.SUCCESS);
498 504 rs.put("t", sch);
499 505  
... ... @@ -564,10 +570,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
564 570 String fcsj = map.get("fcsj");
565 571 //实际发车时间
566 572 String fcsjActual = map.get("fcsjActual");
567   - //驾驶员
568   - String[] jsy = map.get("jsy").split("/");
569   - //售票员
570   - String[] spy = map.get("spy").split("/");
  573 +
571 574 //实际终点时间
572 575 String zdsjActual = map.get("zdsjActual");
573 576 //备注
... ... @@ -575,27 +578,47 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
575 578  
576 579 ScheduleRealInfo sch = ScheduleBuffer.findOne(id);
577 580 if(null != sch){
  581 + //驾驶员
  582 + if(StringUtils.isNotBlank(map.get("jsy"))){
  583 + String[] jsy = map.get("jsy").split("/");
  584 + sch.setjGh(jsy[0]);
  585 + sch.setjName(jsy[1]);
  586 + }
  587 +
  588 + //售票员
  589 + if(StringUtils.isNotBlank(map.get("spy"))){
  590 + String[] spy = map.get("spy").split("/");
  591 + sch.setsGh(spy[0]);
  592 + sch.setsName(spy[1]);
  593 + }
  594 +
578 595 sch.setBcType(bcType);
579 596 sch.setClZbh(clZbh);
580 597 sch.setFcsjAll(fcsj);
581   - if(null == fcsjActual){
  598 + if(StringUtils.isNotBlank(fcsjActual)){
  599 + //调整实发
  600 + sch.setFcsjActualAll(fcsjActual);
  601 + sch.setStatus(1);
  602 + }
  603 + else{
582 604 sch.setFcsjActual(null);
583 605 sch.setFcsjActualTime(null);
584 606 }
585   - else
586   - sch.setFcsjActualAll(fcsjActual);
587 607  
588   - if(null == zdsjActual){
  608 + if(StringUtils.isNotBlank(zdsjActual)){
  609 + //调整实达
  610 + sch.setZdsjActualAll(zdsjActual);
  611 + sch.setStatus(2);
  612 + //下一班次起点到达
  613 + ScheduleRealInfo next = ScheduleBuffer.getNext(sch);
  614 + next.setQdzArrDateSJ(zdsjActual);
  615 + rs.put("nextSch", next);
  616 + }
  617 + else{
589 618 sch.setZdsjActual(null);
590 619 sch.setZdsjActualTime(null);
591 620 }
592   - else
593   - sch.setZdsjActualAll(zdsjActual);
594 621  
595   - sch.setjGh(jsy[0]);
596   - sch.setjName(jsy[1]);
597   - sch.setsGh(spy[0]);
598   - sch.setsName(spy[1]);
599 622 sch.setRemarks(remarks);
600 623 }
601 624  
... ... @@ -609,4 +632,32 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
609 632 }
610 633 return rs;
611 634 }
  635 +
  636 + @Override
  637 + public Map<String, Object> outgoAdjustAll(String params) {
  638 + Map<String, Object> rs = new HashMap<>();
  639 + try{
  640 + JSONArray jsonArray = JSONArray.parseArray(params);
  641 +
  642 + ScheduleRealInfo schedule = null;
  643 + JSONObject jsonObj;
  644 + String dfsj;
  645 + for(int i = 0; i < jsonArray.size(); i ++){
  646 + jsonObj = jsonArray.getJSONObject(i);
  647 + dfsj = jsonObj.getString("t");
  648 + schedule = ScheduleBuffer.findOne(jsonObj.getLong("id"));
  649 + //设置待发时间
  650 + schedule.setDfsjAll(dfsj);
  651 + ScheduleBuffer.persistentList.add(schedule);
  652 + }
  653 +
  654 + rs.put("status", ResponseCode.SUCCESS);
  655 + //将更新的最后一个班次返回
  656 + rs.put("t", schedule);
  657 + }catch(Exception e){
  658 + logger.error("", e);
  659 + rs.put("status", ResponseCode.ERROR);
  660 + }
  661 + return rs;
  662 + }
612 663 }
... ...
src/main/java/com/bsth/util/FTPClientUtils.java
... ... @@ -11,6 +11,7 @@ import java.io.OutputStream;
11 11 import java.io.UnsupportedEncodingException;
12 12  
13 13 import org.apache.commons.net.ftp.FTPClient;
  14 +import org.apache.commons.net.ftp.FTPFile;
14 15 import org.apache.commons.net.ftp.FTPReply;
15 16 /**
16 17 * @Description: 向FTP服务器上传文件
... ... @@ -66,13 +67,16 @@ public class FTPClientUtils {
66 67  
67 68 ftp.changeWorkingDirectory(path);
68 69  
69   - ftp.storeFile(filename, input);
  70 + ftp.enterLocalPassiveMode();
  71 +
  72 + success = ftp.storeFile(new String(filename.getBytes("gbk"),"gbk"), input);
  73 + /*success = ftp.storeFile(filename, input); */
70 74  
71 75 input.close();
72 76  
73 77 ftp.logout();
74 78  
75   - success = true;
  79 + // success = true;
76 80  
77 81 } catch (IOException e) {
78 82  
... ... @@ -97,8 +101,25 @@ public class FTPClientUtils {
97 101 return success;
98 102 }
99 103  
100   - // 将本地文件上传到FTP服务器上
101   - public void testUpLoadFromDisk(File file,String name,String url, int port, String username, String password, String remotePath){
  104 + /**
  105 + * @Description : TOOD(将本地文件上传到FTP服务器上)
  106 + *
  107 + * @param file
  108 + *
  109 + * @param name
  110 + *
  111 + * @param url
  112 + *
  113 + * @param port
  114 + *
  115 + * @param username
  116 + *
  117 + * @param password
  118 + *
  119 + * @param remotePath
  120 + *
  121 + */
  122 + public void FTPUpLoadFromDisk(File file,String name,String url, int port, String username, String password, String remotePath){
102 123  
103 124 try {
104 125 FileInputStream in=new FileInputStream(file);
... ... @@ -137,16 +158,21 @@ public class FTPClientUtils {
137 158 }
138 159  
139 160 /**
140   - * <删除FTP上的文件>
141   - * <远程删除FTP服务器上的录音文件>
  161 + * @Description (删除FTP上的文件)
  162 + *
142 163 * @param url FTP服务器IP地址
  164 + *
143 165 * @param port FTP服务器端口
  166 + *
144 167 * @param username FTP服务器登录名
  168 + *
145 169 * @param password FTP服务器密码
  170 + *
146 171 * @param remotePath 远程文件路径
  172 + *
147 173 * @param fileName 待删除的文件名
148   - * @return
149   - * @see [类、类#方法、类#成员]
  174 + *
  175 + * @return boolean
150 176 */
151 177 public static boolean deleteFtpFile(String url, int port, String username, String password, String remotePath, String fileName){
152 178  
... ... @@ -170,8 +196,6 @@ public class FTPClientUtils {
170 196 // 登录
171 197 ftp.login(username, password);
172 198  
173   -
174   -
175 199 reply = ftp.getReplyCode();
176 200  
177 201 if (!FTPReply.isPositiveCompletion(reply)) {
... ... @@ -185,7 +209,9 @@ public class FTPClientUtils {
185 209  
186 210 ftp.changeWorkingDirectory(remotePath);
187 211  
188   - success = ftp.deleteFile(fileName);
  212 + /*success = ftp.deleteFile(fileName);*/
  213 +
  214 + success = ftp.deleteFile(new String(fileName.getBytes("gbk"),"gbk"));
189 215  
190 216 ftp.logout();
191 217  
... ... @@ -217,6 +243,8 @@ public class FTPClientUtils {
217 243 public static File GetFtpFile(String url, int port, String username, String password, String remotePath, String fileName){
218 244  
219 245 FTPClient ftp = new FTPClient();
  246 +
  247 + /*File destFile = new File(fileName); */
220 248  
221 249 File destFile = new File(fileName);
222 250  
... ... @@ -247,16 +275,42 @@ public class FTPClientUtils {
247 275 ftp.disconnect();
248 276  
249 277 }
250   -
  278 +
251 279 // 转移到FTP服务器目录
252   -
  280 +
253 281 ftp.changeWorkingDirectory(remotePath);
254 282  
255   - File srcFile = new File(fileName);
  283 + ftp.enterLocalPassiveMode();
  284 +
  285 + FTPFile[] fs = ftp.listFiles();
  286 +
  287 + System.out.println(fs.length);
  288 +
  289 + /* for (FTPFile ff : fs) {
  290 + //解决中文乱码问题,两次解码
  291 + byte[] bytes=ff.getName().getBytes("gbk");
  292 + String fn=new String(bytes,"gbk");
  293 + if (fn.equals(fileName)) {
  294 + //6.写操作,将其写入到本地文件中
  295 + File localFile = new File(ff.getName());
  296 +
  297 +
  298 + OutputStream is = new FileOutputStream(localFile);
  299 + ftp.retrieveFile(ff.getName(), is);
  300 + is.close();
  301 + }
  302 + } */
  303 +
  304 + /* File srcFile = new File(fileName); */
  305 +
  306 + /* File srcFile = new File(new String(fileName.getBytes("gbk"),"gbk"));*/
256 307  
257 308 int byteread = 0; // 读取的字节数
  309 +
  310 + /* in = ftp.retrieveFileStream(remotePath + fileName);*/
258 311  
259   - in = ftp.retrieveFileStream(fileName);
  312 + in = ftp.retrieveFileStream(new String(fileName.getBytes("gbk"),"gbk"));
  313 +
260 314  
261 315 out = new FileOutputStream(destFile);
262 316  
... ...
src/main/java/com/bsth/vehicle/directive/buffer/DirectiveBuffer.java
1 1 package com.bsth.vehicle.directive.buffer;
2 2  
  3 +import java.util.ArrayList;
3 4 import java.util.HashMap;
  5 +import java.util.Iterator;
4 6 import java.util.LinkedList;
  7 +import java.util.List;
5 8 import java.util.Map;
6 9  
7 10 import org.slf4j.Logger;
... ... @@ -19,6 +22,7 @@ import com.bsth.vehicle.directive.entity.Directive80;
19 22 import com.bsth.vehicle.directive.entity.DirectiveC0;
20 23 import com.bsth.vehicle.directive.entity.DirectiveC0.DirectiveC0Data;
21 24 import com.bsth.vehicle.directive.entity.LineChange;
  25 +import com.bsth.vehicle.directive.repository.Directive60Repository;
22 26 import com.bsth.vehicle.directive.repository.Directive80Repository;
23 27 import com.bsth.vehicle.directive.repository.LineChangeRepository;
24 28 import com.bsth.vehicle.directive.util.HttpUtils;
... ... @@ -61,6 +65,9 @@ public class DirectiveBuffer {
61 65 */
62 66 private static Map<Integer, Directive60> directiveMap;
63 67  
  68 + @Autowired
  69 + Directive60Repository d60Repository;
  70 +
64 71 /**
65 72 * 驾驶员上报数据
66 73 * {K: 线路编码}
... ... @@ -71,10 +78,7 @@ public class DirectiveBuffer {
71 78 RealControlSocketHandler socketHandler;
72 79  
73 80 static{
74   - transientList = new LinkedList<>();
75   - directiveMap = new HashMap<>();
76   - reportMultiMap = ArrayListMultimap.create();
77   - changeMap = new HashMap<>();
  81 + clear();
78 82 }
79 83  
80 84 public static void put(Directive60 directive){
... ... @@ -205,4 +209,34 @@ public class DirectiveBuffer {
205 209 c0.setData(data);
206 210 return c0;
207 211 }
  212 +
  213 + /**
  214 + *
  215 + * @Title: saveAll
  216 + * @Description: TODO(所有缓存里的指令全部入库)
  217 + */
  218 + public void saveAll(){
  219 + Iterator<Directive60> iterator = directiveMap.values().iterator();
  220 + List<Directive60> pList = new ArrayList<>();
  221 + Directive60 d60;
  222 + while(iterator.hasNext()){
  223 + d60 = iterator.next();
  224 + if(!d60.isPersistent())
  225 + pList.add(d60);
  226 + }
  227 + d60Repository.save(pList);
  228 + }
  229 +
  230 + /**
  231 + *
  232 + * @Title: clear
  233 + * @Description: TODO(清理缓存)
  234 + * @throws
  235 + */
  236 + public static void clear(){
  237 + transientList = new LinkedList<>();
  238 + directiveMap = new HashMap<>();
  239 + reportMultiMap = ArrayListMultimap.create();
  240 + changeMap = new HashMap<>();
  241 + }
208 242 }
... ...
src/main/java/com/bsth/vehicle/directive/entity/Directive60.java
... ... @@ -84,6 +84,9 @@ public class Directive60 {
84 84 @ManyToOne
85 85 private SysUser sender;
86 86  
  87 + @Transient
  88 + private boolean persistent;
  89 +
87 90 @Embeddable
88 91 public static class DirectiveData {
89 92 // 公司代码
... ... @@ -280,4 +283,12 @@ public class Directive60 {
280 283 public void setSender(SysUser sender) {
281 284 this.sender = sender;
282 285 }
  286 +
  287 + public boolean isPersistent() {
  288 + return persistent;
  289 + }
  290 +
  291 + public void setPersistent(boolean persistent) {
  292 + this.persistent = persistent;
  293 + }
283 294 }
... ...
src/main/java/com/bsth/vehicle/directive/thread/DirectivePersistenceThread.java
... ... @@ -38,6 +38,7 @@ public class DirectivePersistenceThread extends Thread{
38 38 if(null == directive)
39 39 break;
40 40  
  41 + directive.setPersistent(true);
41 42 directiveRepository.save(directive);
42 43 }
43 44 }
... ...
src/main/java/com/bsth/vehicle/directive/thread/FirstScheduleIssuedThread.java
1 1 package com.bsth.vehicle.directive.thread;
2 2  
3 3 import java.util.LinkedList;
  4 +import java.util.List;
4 5 import java.util.Set;
5 6  
6 7 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -27,7 +28,25 @@ public class FirstScheduleIssuedThread extends Thread{
27 28 @Override
28 29 public void run() {
29 30  
30   - Set<String> keys = ScheduleBuffer.vehLinkedMap.keySet();
  31 + Set<String> keys = ScheduleBuffer.vehSchListMap.keySet();
  32 + List<ScheduleRealInfo> list;
  33 +
  34 + Long t = System.currentTimeMillis();
  35 + ScheduleRealInfo sch;
  36 + for(String nbbm : keys){
  37 + list = ScheduleBuffer.vehSchListMap.get(nbbm);
  38 +
  39 + if(list.size() == 0)
  40 + continue;
  41 +
  42 + sch = list.get(0);
  43 +
  44 + if(sch.getStatus() == 0 && sch.getFcsjT() > t){
  45 + directiveService.send60Dispatch(sch, 0);
  46 + }
  47 + }
  48 +
  49 + /*Set<String> keys = ScheduleBuffer.vehLinkedMap.keySet();
31 50 LinkedList<ScheduleRealInfo> linkedList;
32 51 ScheduleRealInfo sch;
33 52 for(String nbbm : keys){
... ... @@ -39,6 +58,6 @@ public class FirstScheduleIssuedThread extends Thread{
39 58 if(!ScheduleBuffer.finishLinkedMap.containsKey(nbbm)
40 59 && sch.getFcsjActual() == null)
41 60 directiveService.send60Dispatch(sch, 0);
42   - }
  61 + }*/
43 62 }
44 63 }
... ...
src/main/java/com/bsth/vehicle/gpsdata/GpsArrivalStationThread.java
... ... @@ -9,7 +9,6 @@ import java.util.ArrayList;
9 9 import java.util.Calendar;
10 10 import java.util.Date;
11 11 import java.util.HashSet;
12   -import java.util.LinkedList;
13 12 import java.util.List;
14 13 import java.util.Set;
15 14  
... ... @@ -68,18 +67,18 @@ public class GpsArrivalStationThread extends Thread{
68 67 set.add(CommonMapped.vehicDeviceBiMap.get(arr.getDeviceId()));
69 68  
70 69 List<ArrivalInfo> rsList = null;
71   - LinkedList<ScheduleRealInfo> linked = null;
  70 + List<ScheduleRealInfo> subList = null;
72 71 ArrivalInfo[] status;
73 72 for(String nbbm : set){
74 73 rsList = GpsArrivalDataBuffer.pops(nbbm);
75   - //和该车辆未执行班次进行匹配
76   - linked = ScheduleBuffer.vehLinkedMap.get(nbbm);
  74 + //和该车辆班次进行匹配
  75 + subList = ScheduleBuffer.vehSchListMap.get(nbbm);
77 76  
78   - if(null == linked || linked.size() == 0)
  77 + if(null == subList || subList.size() == 0)
79 78 continue;
80 79  
81 80 try{
82   - for(ScheduleRealInfo schedule : linked){
  81 + for(ScheduleRealInfo schedule : subList){
83 82 //匹配结果
84 83 status = match(rsList, schedule);
85 84  
... ...
src/main/java/com/bsth/vehicle/gpsdata/GpsArrivalStationThread_old.java
... ... @@ -64,7 +64,7 @@ public class GpsArrivalStationThread_old extends Thread{
64 64 System.out.println("开始...");
65 65 List<ScheduleRealInfo> schList;
66 66 for(String key : keySet){
67   - schList = extractSched(ScheduleBuffer.vehLinkedMap.get(key));
  67 + schList = extractSched(ScheduleBuffer.vehSchListMap.get(key));
68 68 if(null != schList)
69 69 match(GpsArrivalDataBuffer.allMap.get(key), schList);
70 70 }
... ... @@ -221,8 +221,8 @@ public class GpsArrivalStationThread_old extends Thread{
221 221 try {
222 222 conn = DBUtils_MS.getConnection();
223 223 ps = conn.prepareStatement(sql);
224   - ps.setInt(1, /*weeks_year*/28);
225   - ps.setLong(2, /*GpsArrivalDataBuffer.markTime*/1467853749000L);
  224 + ps.setInt(1, weeks_year);
  225 + ps.setLong(2, GpsArrivalDataBuffer.markTime);
226 226  
227 227 Long t = System.currentTimeMillis();
228 228 rs = ps.executeQuery();
... ...
src/main/java/com/bsth/vehicle/gpsdata/buffer/GpsRealDataBuffer.java
... ... @@ -3,7 +3,6 @@ package com.bsth.vehicle.gpsdata.buffer;
3 3 import java.util.ArrayList;
4 4 import java.util.HashMap;
5 5 import java.util.Iterator;
6   -import java.util.LinkedList;
7 6 import java.util.List;
8 7 import java.util.Map;
9 8 import java.util.Set;
... ... @@ -136,15 +135,27 @@ public class GpsRealDataBuffer {
136 135  
137 136 //写入车辆自编号
138 137 String nbbm;
139   - LinkedList<ScheduleRealInfo> linkedList;
140   - int size;
  138 + ScheduleRealInfo current, next;
141 139 for(GpsRealData gpsData : list){
142 140 nbbm = CommonMapped.vehicDeviceBiMap.get(gpsData.getDeviceId());
143 141 if(null != nbbm){
144 142 gpsData.setNbbm(nbbm);
145 143 gpsData.setStationName(CommonMapped.stationCodeMap.get(gpsData.getStopNo()));
146 144  
147   - linkedList = ScheduleBuffer.vehLinkedMap.get(nbbm);
  145 + current = ScheduleBuffer.findCurrent(nbbm);
  146 + next = ScheduleBuffer.getNext(current);
  147 +
  148 + if(current != null)
  149 + gpsData.setCurrSchId(current.getId());
  150 + if(next != null)
  151 + gpsData.setNextSchId(next.getId());
  152 + //gpsData.setCurrSchId(ScheduleBuffer.findCurrent(nbbm));
  153 + /*subList = ScheduleBuffer.vehSchListMap.get(nbbm);
  154 + if(subList.size() == 0)
  155 + continue;*/
  156 +
  157 +
  158 + /*linkedList = ScheduleBuffer.vehLinkedMap.get(nbbm);
148 159 if(null != linkedList){
149 160 //为GPS点附加班次信息
150 161 size = linkedList.size();
... ... @@ -152,7 +163,7 @@ public class GpsRealDataBuffer {
152 163 gpsData.setCurrSchId(linkedList.peekFirst().getId());
153 164 if(size > 1)
154 165 gpsData.setNextSchId(linkedList.get(1).getId());
155   - }
  166 + }*/
156 167 resList.add(gpsData);
157 168 }
158 169 }
... ...
src/main/resources/application-dev.properties
... ... @@ -26,6 +26,6 @@ spring.datasource.validation-query=select 1
26 26 ##
27 27 #222.66.0.204:5555
28 28 ##\u5B9E\u65F6gps
29   -http.gps.real.url= http://192.168.168.192:8080/transport_server/rtgps/
  29 +http.gps.real.url= http://192.168.168.171:8080/transport_server/rtgps/
30 30 ##\u6D88\u606F\u4E0B\u53D1
31   -http.send.directive = http://192.168.168.192:8080/transport_server/message/
  31 +http.send.directive = http://192.168.168.171:8080/transport_server/message/
... ...
src/main/resources/application.properties
1 1 spring.profiles: dev,prod
2   -spring.profiles.active: prod
  2 +spring.profiles.active: dev
3 3  
4 4 spring.view.suffix=.html
5 5 server.session-timeout=-1
... ...
src/main/resources/fatso/start.js
... ... @@ -37,8 +37,9 @@ fs.mkdir(dest, function(e){
37 37 var cProcess;
38 38  
39 39 ep.tail('mvn-clean',function(){
  40 + ep.emit('copy-project');
40 41 //清理target
41   - logInfo('mvn clean...');
  42 + /*logInfo('mvn clean...');
42 43 cProcess = child_process.exec("mvn clean",{cwd: workspace + '\\' + pName},function(error){
43 44 if(error)
44 45 logError(error);
... ... @@ -46,7 +47,7 @@ ep.tail(&#39;mvn-clean&#39;,function(){
46 47 logSuccess('mvn clean success');
47 48  
48 49 ep.emit('copy-project');
49   - });
  50 + });*/
50 51 output(cProcess);
51 52 });
52 53  
... ...
src/main/resources/ftp.properties
... ... @@ -2,7 +2,7 @@ ftp.url=222.66.0.205
2 2 ftp.port=21
3 3 ftp.username=transport
4 4 ftp.password=transport123
5   -ftp.path= down/
  5 +ftp.path=down/
6 6  
7 7 #ftp.url=192.168.168.101
8 8 #ftp.port=21
... ...
src/main/resources/ms-jdbc.properties
1 1 ms.mysql.driver= com.mysql.jdbc.Driver
2   -ms.mysql.url= jdbc:mysql://192.168.168.192:3306/ms?useUnicode=true&characterEncoding=utf-8
  2 +ms.mysql.url= jdbc:mysql://192.168.168.171:3306/ms?useUnicode=true&characterEncoding=utf-8
3 3 ms.mysql.username= root
4 4 ms.mysql.password= root2jsp
5 5 \ No newline at end of file
... ...
src/main/resources/static/pages/base/line/js/line-add-form.js
... ... @@ -49,6 +49,8 @@ $(function(){
49 49 // 填充公司下拉框选择值
50 50 $get('/business/all', {upCode_eq: '77'}, function(array){
51 51  
  52 + console.log(array);
  53 +
52 54 // 公司下拉options属性值
53 55 var options = '<option value="">-- 请选择公司 --</option>';
54 56  
... ...
src/main/resources/static/pages/base/line/js/line-edit-form.js
... ... @@ -12,7 +12,7 @@
12 12 // 初始化公司下拉框
13 13 selectTemp(function(){
14 14  
15   - // 根据ID查询详细信息
  15 + /** 根据ID查询详细信息 */
16 16 $get('/line/' + lineId ,null, function(result){
17 17  
18 18 // 如果不为空
... ... @@ -24,7 +24,7 @@
24 24 // 设置日期
25 25 result.openDate = moment(result.openDate).format(fs);
26 26  
27   - // 填充修改线路表单元素值
  27 + /** 填充修改线路表单元素值 @param:<result:数据结果集;line_edit_form:表单元素> */
28 28 putFormData(result, '#line_edit_form');
29 29  
30 30 // 设置公司值
... ... @@ -60,7 +60,7 @@
60 60 // 输入线路名称,自动生成英文名称和线路简称
61 61 $('#nameInput').on('keyup', setPinYin);
62 62  
63   - // 根据线路名称值设置英文名称值和线路简称
  63 + /** 根据线路名称值设置英文名称值和线路简称 */
64 64 function setPinYin(){
65 65  
66 66 // 获取线路名称值
... ... @@ -74,7 +74,7 @@
74 74 }
75 75  
76 76  
77   - // 公司下拉框
  77 + /** 公司下拉框 @param:<callback:回调函数> */
78 78 function selectTemp(callback) {
79 79  
80 80 // 填充公司下拉框选择值
... ... @@ -453,7 +453,7 @@
453 453 }
454 454 });
455 455  
456   - // 联系电话(手机/电话皆可)验证
  456 + /** 联系电话(手机/电话皆可)验证 */
457 457 $.validator.addMethod("isPhone", function(value,element) {
458 458  
459 459 // 长度
... ...
src/main/resources/static/pages/base/line/js/line-list-table.js
1 1 /**
2 2 *
3   - * @JSName : list.js(线路信息list.html页面js)
  3 + * @JSName : line-list-table.js(线路信息list.html页面js)
4 4 *
5 5 * @Author : bsth@lq
6 6 *
... ... @@ -27,14 +27,16 @@
27 27  
28 28 });
29 29  
30   - // 填充公司下拉框options,并添加公司下拉框值改变事件setbrancheCompanySelectOptions
  30 + // 填充公司下拉框options
31 31 $('#companySelect').html(options)
  32 +
  33 + /** 闵行没下属公司,这里暂时注释公司值改变事件 */
32 34 //$('#companySelect').html(options).on('change', setbrancheCompanySelectOptions);
33 35  
34 36 });
35 37  
36   - /** 填充分公司下拉框 */
37   - setbrancheCompanySelectOptions();
  38 + /** 填充分公司下拉框。--- 闵行没下属公司,这里暂时注释*/
  39 + /* setbrancheCompanySelectOptions();*/
38 40  
39 41 /** 填充分公司下拉框选择值 */
40 42 function setbrancheCompanySelectOptions(){
... ... @@ -53,7 +55,7 @@
53 55  
54 56 } else {
55 57  
56   - // 查询出所属公司下的分公司名称和相应分公司代码
  58 + /** 查询出所属公司下的分公司名称和相应分公司代码 @param:<upCode_eq:公司代码> */
57 59 $get('/business/all', {upCode_eq: businessCode}, function(array){
58 60  
59 61 // 遍历array
... ... @@ -75,7 +77,7 @@
75 77 // 选择框
76 78 var icheckOptions = {checkboxClass: 'icheckbox_flat-blue',increaseArea: '20%'};
77 79  
78   - // 表格数据分页加载
  80 + /** 表格数据分页加载 @param:<null:搜索参数;true:是否重新分页> */
79 81 loadTableDate(null,true);
80 82  
81 83 /** 重置按钮事件 */
... ... @@ -84,7 +86,7 @@
84 86 // 清空搜索框值
85 87 $('tr.filter input,select').val('').change();
86 88  
87   - // 重新加载表格数据
  89 + /** 表格数据分页加载 @param:<null:搜索参数;true:是否重新分页> */
88 90 loadTableDate(null,true);
89 91 });
90 92  
... ... @@ -120,8 +122,10 @@
120 122 }
121 123 }
122 124 });
  125 +
123 126 page = 0;
124 127  
  128 + /** 表格数据分页加载 @param:<params:搜索参数;true:是否重新分页> */
125 129 loadTableDate(params,true);
126 130 });
127 131  
... ... @@ -149,8 +153,6 @@
149 153 // 异步请求获取表格数据
150 154 $.get('/line',params,function(result){
151 155  
152   - console.log(result);
153   -
154 156 // 添加序号
155 157 result.content.page = page;
156 158  
... ... @@ -244,7 +246,7 @@
244 246 });
245 247 }
246 248  
247   - // 生成行单
  249 + /** 生成行单,这里暂时只做了单选生成。 */
248 250 $('#datatable_ajax_tools #createUsingSingle').on('click', function() {
249 251  
250 252 // 获取选中行
... ... @@ -275,11 +277,13 @@
275 277  
276 278 lineName = arrChk.val();
277 279  
  280 + // 请求参数
278 281 var params = {lineId:id};
279 282  
280 283 // 弹出正在加载层
281 284 var index = layer.load(0);
282 285  
  286 + /** 生成线路行单 @pararm:<params:请求参数> */
283 287 $post('/stationroute/usingSingle',params,function(data) {
284 288  
285 289 // 关闭弹出框
... ...
src/main/resources/static/pages/base/line/list.html
... ... @@ -53,6 +53,7 @@
53 53 <th width="7%">线路编码</th>
54 54 <th width="8%">线路名称</th>
55 55 <th width="7%">所属公司</th>
  56 + <!-- 闵行没有下属公司,这里暂时注释掉 -->
56 57 <!-- <th width="8%">所属分公司</th> -->
57 58 <th width="6%">线路性质</th>
58 59 <th width="6%">线路等级</th>
... ... @@ -72,12 +73,15 @@
72 73 <input type="text" class="form-control form-filter input-sm" name="name_like">
73 74 </td>
74 75 <td>
  76 + <!-- 公司这里没使用字典表,暂时查的公司表 -->
75 77 <select name="company_eq" class="form-control" id="companySelect"></select>
76 78 </td>
  79 + <!-- 闵行没有下属公司,这里暂时注释掉 -->
77 80 <!-- <td>
78 81 <select name="brancheCompany_eq" class="form-control" id="brancheCompanySelect"></select>
79 82 </td> -->
80 83 <td>
  84 + <!-- 这里没使用字典表,暂时写在页面上 -->
81 85 <select name="nature_like" class="form-control" id="natureSelect">
82 86 <option value="">请选择...</option>
83 87 <option value="lj">路救</option>
... ... @@ -93,6 +97,7 @@
93 97 </select>
94 98 </td>
95 99 <td>
  100 + <!-- 这里没使用字典表,暂时写在页面上 -->
96 101 <select name="level_eq" class="form-control" id="levelSelect">
97 102 <option value="">请选择...</option>
98 103 <option value="1">一级线路</option>
... ... @@ -104,6 +109,7 @@
104 109 <input type="text" class="form-control form-filter input-sm" name="shanghaiLinecode_eq">
105 110 </td>
106 111 <td>
  112 + <!-- 这里没使用字典表,暂时写在页面上 -->
107 113 <select class="form-control form-filter " name="destroy_eq">
108 114 <option value="">请选择...</option>
109 115 <option value="0">运营</option>
... ... @@ -225,7 +231,6 @@
225 231 闵行公司
226 232 {{/if}}
227 233 </td>
228   -
229 234 <td>
230 235 {{if obj.nature == 'lj'}}
231 236 路救
... ...
src/main/resources/static/pages/base/stationroute/editsection.html
... ... @@ -399,9 +399,7 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
399 399  
400 400 console.log(params);
401 401  
402   - return;
403   -
404   - ajaxd.sectionUpdata(params,function(resuntDate) {
  402 + ajaxd.sectionUpdate(params,function(resuntDate) {
405 403  
406 404 if(resuntDate.status=='SUCCESS') {
407 405  
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-function.js
... ... @@ -431,6 +431,9 @@ var PublicFunctions = function () {
431 431  
432 432 var Line = LineObj.getLineObj();
433 433  
  434 + // 刷行左边树
  435 + PublicFunctions.resjtreeDate(Line.id,stationRouteDirections);
  436 +
434 437 /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:上行路段数据 */
435 438 GetAjaxData.getSectionRouteInfo(Line.id,stationRouteDirections,function(data) {
436 439  
... ...
src/main/resources/static/pages/base/stationroute/list.html
... ... @@ -85,7 +85,7 @@
85 85 </div>
86 86 <!-- 树 -->
87 87 <div class="portlet-body">
88   - <div id="station_Up_tree" style="height: 550px;overflow-y: auto;"></div>
  88 + <div id="station_Up_tree" style="height: auto;max-height: 500px;overflow-y: auto;"></div>
89 89 </div>
90 90 </div>
91 91  
... ... @@ -167,7 +167,7 @@
167 167 </div>
168 168 <!-- 树 -->
169 169 <div class="portlet-body">
170   - <div id="station_Down_tree" style="height: 550px;overflow-y: auto;"></div>
  170 + <div id="station_Down_tree" style="height: auto;max-height: 500px;overflow-y: auto;"></div>
171 171 </div>
172 172 </div>
173 173  
... ...
src/main/resources/static/pages/control/line/child_pages/child_task.html
... ... @@ -189,7 +189,7 @@ $(function(){
189 189  
190 190 //显示班次详细
191 191 $.each(this.cells, function(i,cell){
192   - $('#mainDetailPabel input[data-cell='+i+']').val($(cell).text());
  192 + $('#mainDetailPabel input[data-cell='+i+']').val($.trim($(cell).text()));
193 193 });
194 194 if(!changeHandlerPanel(this))
195 195 return;
... ... @@ -284,7 +284,7 @@ $(function(){
284 284 var cont = $('.custom-table-panel');
285 285 cont.animate({
286 286 scrollTop: $tr.offset().top - cont.offset().top + $tr.scrollTop() - 36 * 4
287   - }, 500);
  287 + }, 500);
288 288  
289 289 }, 100);
290 290 });
... ... @@ -381,6 +381,18 @@ $(function(){
381 381 $(this).show();
382 382 $('input.no', schAddPanel).val($(tr.cells[0]).text());
383 383 $('select[name=xlDir]', schAddPanel).trigger('change');
  384 + //当前表格第一条数据 data-type="empty"
  385 + var $tr = $('.mainTable tr[data-id]', '#childTaskDiv').eq(0);
  386 + if($tr.length > 0){
  387 + var sch = _data.getSchedulById($tr.data('id'));
  388 + console.log(sch);
  389 + //默认车辆
  390 + $('select[name=clZbh]', schAddPanel).val(sch.clZbh).trigger('change');
  391 + //默认驾驶员
  392 + $('select[name=jGh]', schAddPanel).val(sch.jGh + '/' + sch.jName).trigger('change');
  393 + //默认售票员
  394 + $('select[name=sGh]', schAddPanel).val(sch.sGh + '/' + sch.sName).trigger('change');
  395 + }
384 396 });
385 397 //切换上下行
386 398 $(schAddPanel).on('change', 'select[name=xlDir]', function(){
... ... @@ -433,9 +445,12 @@ $(function(){
433 445 //拆分驾驶员工号和姓名
434 446 param.jName = param.jGh.split('/')[1];
435 447 param.jGh = param.jGh.split('/')[0];
436   - //拆分售票员工号和姓名
437   - param.sName = param.sGh.split('/')[1];
438   - param.sGh = param.sGh.split('/')[0];
  448 +
  449 + if(param.sGh != null){
  450 + //拆分售票员工号和姓名
  451 + param.sName = param.sGh.split('/')[1];
  452 + param.sGh = param.sGh.split('/')[0];
  453 + }
439 454 //附加起终点名称
440 455 var route = stationRoute[param.xlDir];
441 456 param.qdzName = searchStationName(route, param.qdzCode);
... ... @@ -445,10 +460,14 @@ $(function(){
445 460 $post('/realSchedule', param, function(rs){
446 461 var sch = rs.t;
447 462 //前端缓存更新
448   - scheduleLineMap[param.xlBm][param.lpName].push(sch);
  463 + //scheduleLineMap[param.xlBm][param.lpName].push(sch);
  464 + /* var ups = rs.ups;
  465 + for(var i in ups){
  466 + _data.updateSchedule(ups[i]);
  467 + } */
449 468 //刷新表格
450   - _alone.addScheduleToTable(sch);
451   - _alone.refreshScheduleArray(rs.ups);
  469 + //_alone.updateTableBySch(sch);
  470 + _alone.update2Table(sch.xlBm, sch);
452 471  
453 472 //关闭弹出层
454 473 layer.closeAll();
... ...
src/main/resources/static/pages/control/line/child_pages/outgo_adjust_all.html 0 → 100644
  1 +<!-- 待发调整 -->
  2 +<div id="outgoAdjustAllPanel">
  3 + <form action="#" class="form-horizontal form-custom">
  4 + <div class="form-body">
  5 + <div class="form-custom-row">
  6 + <div class="item" style="margin-top: 0">
  7 + <div class="input-icon right">
  8 + <span class="item-label" style="width: 40px;">线路: </span>
  9 + <select name="line" class="form-control lineSelect">
  10 + </select>
  11 + </div>
  12 + </div>
  13 + &nbsp;&nbsp;
  14 + <div class="item" style="margin-top: 0">
  15 + <span class="item-label" style="width: 40px;">车辆: </span>
  16 + <select name="nbbm" class="form-control vehicSelect">
  17 + </select>
  18 + </div>
  19 + </div>
  20 +
  21 + <div class="form-custom-row">
  22 + <div class="item" style="min-width: calc(100% - 10px);">
  23 + <div class="custom-table-panel" style="display: inline-block;height: 420px;">
  24 + <div style="height: 36px; position: relative;">
  25 + <div class="custom-table-header">
  26 + <table class="table table-bordered table-advance sch-table">
  27 + <thead>
  28 + <tr>
  29 + <th width="12%">车辆</th>
  30 + <th width="7%">路牌</th>
  31 + <th width="10%">驾驶员</th>
  32 + <th width="18%">起点</th>
  33 + <th width="18%">终点</th>
  34 + <th width="13%">计发</th>
  35 + <th width="22%">待发</th>
  36 + </tr>
  37 + </thead>
  38 + </table>
  39 + </div>
  40 + </div>
  41 +
  42 + <div class="custom-table-body" >
  43 + <table class="table table-bordered table-hover table-advance sch-table" >
  44 + <tbody></tbody>
  45 + </table>
  46 + </div>
  47 + </div>
  48 + </div>
  49 + </div>
  50 +
  51 + <hr>
  52 + <div class="form-custom-footer" style="margin-top: 15px;">
  53 + <button type="button" class="btn blue-madison confirm">
  54 + <i class="fa fa-check"></i> &nbsp;&nbsp;确&nbsp;&nbsp;定
  55 + </button>
  56 + <button type="button" class="btn layui-layer-close">取消</button>
  57 + </div>
  58 + <br>
  59 + </div>
  60 + </form>
  61 +
  62 +<script id="outgo_adjust_all_item_temp" type="text/html">
  63 +{{each list as item i}}
  64 +<tr data-id={{item.id}}>
  65 + <td width="12%">
  66 + {{item.clZbh}}
  67 + {{if item.bcType == "out"}}
  68 + <span class="out-badge short"></span>
  69 + {{else if item.bcType == "in"}}
  70 + <span class="in-badge short"></span>
  71 + {{/if}}
  72 + </td>
  73 + <td width="7%">{{item.lpName}}</td>
  74 + <td width="10%">{{item.jName}}</td>
  75 + <td width="18%" title="{{item.qdzName}}">{{item.qdzName}}</td>
  76 + <td width="18%" title="{{item.zdzName}}">{{item.zdzName}}</td>
  77 + <td width="13%">{{item.fcsj}}</td>
  78 + <td width="22%"><input value="{{item.dfsj}}" data-old="{{item.dfsj}}" type="time" class="form-control df-input" style="width: 100%;"></td>
  79 +</tr>
  80 +{{/each}}
  81 +
  82 +{{if list.length == 0 }}
  83 +<tr>
  84 + <td style="font-size: 12px;text-align: center;" colspan=7>该车辆今日无班次信息</td>
  85 +</tr>
  86 +{{/if}}
  87 +</script>
  88 +
  89 +<script id="outgo_adjust_change_text_temp" type="text/html">
  90 +<h5>B-89524(闵行11路)</h5>
  91 +<hr>
  92 +<div class="change-confirm-text">
  93 +{{each list as item i}}
  94 +<div>
  95 + <span>{{item.old}}</span><i class="fa fa-long-arrow-right"></i><span>{{item.t}}</span>
  96 +</div>
  97 +{{/each}}
  98 +</div>
  99 +</script>
  100 +
  101 +<script type="text/javascript">
  102 +!function(){
  103 + //滚动时固定表头
  104 + $('.custom-table-panel').on('scroll', function(){
  105 + var top = $(this).scrollTop()
  106 + ,$header = $(this).find('.custom-table-header');
  107 + $header.css('top', top);
  108 + });
  109 +
  110 + var _data, _alone, lineCodeMaps;
  111 +
  112 + var lineSelect = $('#outgoAdjustAllPanel .lineSelect');
  113 + var vehicSelect = $('#outgoAdjustAllPanel .vehicSelect');
  114 +
  115 + var initStatus, schedul;
  116 + $('#outgoAdjustAllPanel').on('init', function(e, ops){
  117 + initStatus = true;
  118 + _data = ops._data;
  119 + _alone = ops._alone;
  120 + schedul = ops.selected;
  121 +
  122 + //线路下拉框
  123 + var data = [];
  124 + lineCodeMaps = _data.getLineIds();
  125 + for(var line in lineCodeMaps){
  126 + data.push({id: line, text: lineCodeMaps[line]});
  127 + }
  128 +
  129 + initPinYinSelect2(lineSelect, data, function(){
  130 + //默认选中线路
  131 + lineSelect.val(schedul.xlBm).trigger("change");
  132 +
  133 +
  134 + }).on('change', lineSelectChange);
  135 +
  136 +
  137 + //线路切换事件
  138 + function lineSelectChange(){
  139 + var lineCode = $(this).val();
  140 +
  141 + var index = layer.msg('加载中', {icon: 16});
  142 + //查询线路配车
  143 + $get('/cci/all', {'xl.lineCode_eq': lineCode}, function(rs){
  144 + var data = [];
  145 + $.each(rs, function(){
  146 + data.push({id: this.cl.carCode, text: this.cl.carCode})
  147 + });
  148 + vehicSelect.html('').select2({data: data});
  149 +
  150 + layer.close(index);
  151 +
  152 + //初始选中车辆
  153 + if(initStatus)
  154 + vehicSelect.val(schedul.clZbh);
  155 + //触发change
  156 + vehicSelect.trigger("change")
  157 + });
  158 + }
  159 +
  160 + //车辆切换事件
  161 + vehicSelect.on('change', function(){
  162 + //根据车辆获取班次信息
  163 + var schArray = _data.getSchedulByVeh($(this).val());
  164 +
  165 + var htmlStr = template('outgo_adjust_all_item_temp', {list: schArray});
  166 +
  167 + var table = '#outgoAdjustAllPanel .sch-table ';
  168 + $('tbody', table).html(htmlStr);
  169 +
  170 + //初始选中班次
  171 + if(initStatus){
  172 + var $tr = $('tr[data-id='+schedul.id+']', table);
  173 + $tr.addClass('anim-delay animated flash');
  174 + //滚动条
  175 + var cont = $('#outgoAdjustAllPanel .custom-table-panel');
  176 + cont.animate({
  177 + scrollTop: $tr.offset().top - cont.offset().top + $tr.scrollTop() - 36 * 4
  178 + }, 500);
  179 +
  180 + initStatus = false;
  181 + }
  182 + });
  183 +
  184 + //确定
  185 + $('.confirm', '#outgoAdjustAllPanel').on('click', function(){
  186 + var es = $('#outgoAdjustAllPanel .df-input'),old, t;
  187 + var changes = [];
  188 + for(var i = 0, e;e = es[i++];){
  189 + t = $(e).val(), old = $(e).data('old');
  190 + if(t == ''){
  191 + layer.alert('待发时间不能为空!', {icon: 2, title: '提交失败'});
  192 + $(e).addClass('custom-val-error');
  193 + return false;
  194 + }
  195 + $(e).removeClass('custom-val-error');
  196 +
  197 + if(old != t)
  198 + changes.push({old: old, t: t, id: $(e).parents('tr').data('id')});
  199 + }
  200 +
  201 + var text = template('outgo_adjust_change_text_temp', {list: changes});
  202 + layer.confirm(text, {
  203 + btn: ['确认调整','取消'],title:'待发调整确认'
  204 + }, function(){
  205 + $.ajax({
  206 + url: '/realSchedule/outgoAdjustAll',
  207 + type: 'post',
  208 + data: {params: JSON.stringify(changes)},
  209 + success:function(rs){
  210 + if(rs.status == 'SUCCESS' && rs.t){
  211 + layer.closeAll();
  212 + layer.msg('调整成功!', {icon: 1});
  213 + //刷新表格
  214 + _alone.update2Table(rs.t.xlBm);
  215 + }
  216 + },
  217 + error: errorHandle
  218 + });
  219 + });
  220 + });
  221 + });
  222 +
  223 +
  224 + function errorHandle(){
  225 + layer.alert('服务器出现异常!', {icon: 2, title: '操作失败'});
  226 + }
  227 +}();
  228 +</script>
  229 +</div>
0 230 \ No newline at end of file
... ...
src/main/resources/static/pages/control/line/css/lineControl.css
... ... @@ -2009,7 +2009,8 @@ span.log-item-handle a {
2009 2009 .log-item.fache {
2010 2010 }
2011 2011  
2012   -.in-badge, .out-badge {
  2012 +.in-badge, .out-badge,
  2013 +span.blue-badge {
2013 2014 font-size: 13px;
2014 2015 margin-left: 2px;
2015 2016 padding: 2px 4px;
... ... @@ -2017,6 +2018,16 @@ span.log-item-handle a {
2017 2018 display: inline-block;
2018 2019 }
2019 2020  
  2021 +span.blue-badge{
  2022 + background: #7cccaa;
  2023 + color: white;
  2024 +}
  2025 +
  2026 +tr._active .blue-badge{
  2027 + background: #ffffff;
  2028 + color: #3c973c;
  2029 +}
  2030 +
2020 2031 .out-badge{
2021 2032 background: #59d8e3;
2022 2033 color: white;
... ... @@ -2032,16 +2043,24 @@ span.log-item-handle a {
2032 2043 }
2033 2044  
2034 2045 .out-badge:BEFORE{
2035   - content: '出场'
  2046 + content: '出场';
  2047 +}
  2048 +
  2049 +.out-badge.short:BEFORE{
  2050 + content: '出';
  2051 +}
  2052 +
  2053 +.in-badge.short:BEFORE{
  2054 + content: '进';
2036 2055 }
2037 2056  
2038 2057 @media ( max-width : 1780px) {
2039 2058 .in-badge:BEFORE{
2040   - content: '进'
  2059 + content: '进';
2041 2060 }
2042 2061  
2043 2062 .out-badge:BEFORE{
2044   - content: '出'
  2063 + content: '出';
2045 2064 }
2046 2065 }
2047 2066  
... ... @@ -2117,37 +2136,51 @@ span.log-item-handle a {
2117 2136 color: white;
2118 2137 }
2119 2138  
2120   -.tab_line .panel-wrap ._panel ._body .pb-table tr._tr_active.active-line-no a{
2121   - color: #afafaf;
  2139 +.tab_line .panel-wrap ._panel ._body .pb-table tr._tr_active.active-line-no a,
  2140 +.pb-table tr.selected.dir_0 a,
  2141 +.pb-table tr.selected.dir_1 a{
  2142 + color: #afafaf !important;
2122 2143 }
2123 2144  
2124 2145 .tab_line .pb-table tr._tr_active.active-line-no a.remarks-popover{
2125 2146 color: #bebebe;
2126 2147 }
2127 2148  
2128   -.tab_line .pb-table tr._tr_active.active-line-no td.tl-qrlb{
  2149 +.tab_line .pb-table tr._tr_active.active-line-no td.tl-qrlb,
  2150 +.pb-table tr.selected.dir_0 td.tl-qrlb,
  2151 +.pb-table tr.selected.dir_1 td.tl-qrlb{
2129 2152 background: none;
2130 2153 color: #ff796a;
2131 2154 }
2132   -.tab_line .pb-table tr._tr_active.active-line-no td.tl-zzzx{
  2155 +.tab_line .pb-table tr._tr_active.active-line-no td.tl-zzzx,
  2156 +.pb-table tr.selected.dir_0 td.tl-zzzx,
  2157 +.pb-table tr.selected.dir_1 td.tl-zzzx{
2133 2158 background: none;
2134 2159 color: #5ae35a;
2135 2160 }
2136   -.tab_line .pb-table tr._tr_active.active-line-no td.tl-yzx{
  2161 +.tab_line .pb-table tr._tr_active.active-line-no td.tl-yzx,
  2162 +.pb-table tr.selected.dir_0 td.tl-yzx,
  2163 +.pb-table tr.selected.dir_1 td.tl-yzx{
2137 2164 background: none;
2138 2165 color: #80c8fa;
2139 2166 }
2140   -.tab_line .pb-table tr._tr_active.active-line-no td.tl-xxfc{
  2167 +.tab_line .pb-table tr._tr_active.active-line-no td.tl-xxfc,
  2168 +.pb-table tr.selected.dir_0 td.tl-xxfc,
  2169 +.pb-table tr.selected.dir_1 td.tl-xxfc{
2141 2170 background: none;
2142 2171 color: #a16dff;
2143 2172 }
2144 2173  
2145   -.tab_line .pb-table tr._tr_active.active-line-no td.tl-xxsd{
  2174 +.tab_line .pb-table tr._tr_active.active-line-no td.tl-xxsd,
  2175 +.pb-table tr.selected.dir_0 td.tl-xxsd,
  2176 +.pb-table tr.selected.dir_1 td.tl-xxsd{
2146 2177 background: none;
2147 2178 color: #ffb193;
2148 2179 }
2149 2180  
2150   -.tab_line .pb-table tr._tr_active.active-line-no td.tl-xxrd{
  2181 +.tab_line .pb-table tr._tr_active.active-line-no td.tl-xxrd,
  2182 +.pb-table tr.selected.dir_0 td.tl-xxrd,
  2183 +.pb-table tr.selected.dir_1 td.tl-xxrd{
2151 2184 background: none;
2152 2185 color: #5cb0e9;
2153 2186 }
... ... @@ -2187,4 +2220,66 @@ tr._tr_active.active-line-no .out-badge{
2187 2220 color: black;
2188 2221 }
2189 2222  
  2223 +.pb-table tr .anim-delay{
  2224 + animation-delay:.5s;
  2225 + -webkit-animation-delay:.5s;
  2226 +}
  2227 +
  2228 +.sch-table tr td:nth-of-type(1),
  2229 +.sch-table tr td:nth-of-type(2),
  2230 +.sch-table tr td:nth-of-type(3),
  2231 +.sch-table tr td:nth-of-type(4),
  2232 +.sch-table tr td:nth-of-type(5){
  2233 + color: #646363;
  2234 +}
  2235 +
  2236 +.sch-table tr td:nth-of-type(6),
  2237 +.sch-table tr td:nth-of-type(7){
  2238 + color: black;
  2239 +}
  2240 +
  2241 +
  2242 +.sch-table tr th:nth-of-type(1),
  2243 +.sch-table tr th:nth-of-type(2),
  2244 +.sch-table tr th:nth-of-type(3),
  2245 +.sch-table tr th:nth-of-type(4),
  2246 +.sch-table tr th:nth-of-type(5){
  2247 + color: #646363;
  2248 +}
  2249 +
  2250 +.sch-table tr th:nth-of-type(6),
  2251 +.sch-table tr th:nth-of-type(7){
  2252 + color: black;
  2253 +}
  2254 +
  2255 +.sch-table input{
  2256 + color: black;
  2257 +}
  2258 +
  2259 +.sch-table td{
  2260 + text-overflow: ellipsis;
  2261 + overflow: hidden;
  2262 + white-space: nowrap;
  2263 + vertical-align: middle !important;
  2264 +}
  2265 +
  2266 +.change-confirm-text span{
  2267 + margin: 3px 8px 0 3px;
  2268 + font-family: arial;
  2269 +}
  2270 +
  2271 +.change-confirm-text div span:nth-of-type(1){
  2272 + color: gray;
  2273 +}
  2274 +
  2275 +.change-confirm-text i{
  2276 + color: #46c146;
  2277 +}
  2278 +
  2279 +.pb-table tr.selected.dir_0{
  2280 + background-color: #5d5da9 !important;
  2281 +}
2190 2282  
  2283 +.pb-table tr.selected.dir_1{
  2284 + background-color: #dc5a5a !important;
  2285 +}
2191 2286 \ No newline at end of file
... ...
src/main/resources/static/pages/control/line/index.html
... ... @@ -90,13 +90,28 @@
90 90 </div>
91 91 <div id="tooltipShade" class="animated fadeIn"></div>
92 92  
  93 +<div id="menuWrap"></div>
93 94 <!-- 线路调度右键菜单 -->
94   -<menu class="menu" id="rightMenu">
95   - <li class="menu-item" >
  95 +<menu class="menu" id="rightMenu" style="display: none;">
  96 + <li class="menu-item submenu">
96 97 <button type="button" class="menu-btn" data-method="outgoAdjust">
97 98 <span class="menu-text">待发调整</span>
98 99 </button>
  100 + <menu class="menu">
  101 + <li class="menu-item">
  102 + <button type="button" class="menu-btn" data-method="outgoAdjust">
  103 + <span class="menu-text">基于班次</span>
  104 + </button>
  105 + </li>
  106 + <li class="menu-item">
  107 + <button type="button" class="menu-btn" data-method="outgoAdjustAll">
  108 + <span class="menu-text">基于车辆</span>
  109 + </button>
  110 + </li>
  111 + </menu>
99 112 </li>
  113 +
  114 +
100 115 <li class="menu-separator"></li>
101 116 <li class="menu-item" >
102 117 <button type="button" class="menu-btn" data-method="planDestroy">
... ... @@ -164,7 +179,7 @@
164 179 </li>
165 180 </menu>
166 181 <!-- 主页右键菜单 -->
167   -<menu class="menu" id="homeMenu">
  182 +<menu class="menu" id="homeMenu" style="display: none;">
168 183 <li class="menu-item disabled" id="menu-linename">
169 184 <button type="button" class="menu-btn">
170 185 <span class="menu-text">--- W2B-102 ---</span>
... ...
src/main/resources/static/pages/control/line/js/alone.js
... ... @@ -73,26 +73,64 @@ var _alone = (function(){
73 73 var table = $('tr[data-id='+array[0].id+']').parents('table')[0];
74 74 calculateLineNo(table);
75 75 },
76   - //添加一个班次到表格
77   - addScheduleToTable: function(schedule){
78   - _data.pushSchedule(schedule);
79   -
80   - var upDown = schedule.xlDir==0?'up':'down';
81   - var tab = $('#tab_line_' + schedule.xlBm);
82   - //重新渲染表格
83   - var table = tab.find('.pb-table[data-type='+upDown+']');
84   - //获取班次信息
85   - var schArray = _data.findSchByLine(schedule.xlBm, schedule.xlDir);
86   - calculateLineNo(
87   - table.find('tbody').html(template('alone_plan_table_temp', {list: schArray}))[0]
88   - );
89   -
90   - //定位到新添加的班次
91   - var currTr = table.find('tr[data-id='+schedule.id+']')
92   - ,top = parseInt(currTr.find('td[name=lineNo]').text()) * 37;
  76 + //将班次所在的表格做全量更新
  77 + updateTableBySch: function(schedule){
  78 + //将该线路走向班次 全部从服务器同步一次
  79 + var xlDir = schedule.xlDir, xlBm = schedule.xlBm;
  80 + $.get('/realSchedule/findByLineAndUpDown', {line: xlBm, upDown: xlDir}
  81 + ,function(list){
  82 + $.each(list, function(){
  83 + _data.pushSchedule(this);
  84 + });
  85 +
  86 + var upDown = xlDir==0?'up':'down';
  87 + var tab = $('#tab_line_' + xlBm);
  88 + //重新渲染表格
  89 + var table = tab.find('.pb-table[data-type='+upDown+']');
  90 + var schArray = _data.findSchByLine(xlBm, xlDir);
  91 + calculateLineNo(
  92 + table.find('tbody').html(template('alone_plan_table_temp', {list: schArray}))[0]
  93 + );
  94 +
  95 + var half = tab.find('._body').height() / 2;
  96 +
  97 + //定位到新添加的班次
  98 + var currTr = table.find('tr[data-id='+schedule.id+']')
  99 + ,top = parseInt(currTr.find('td[name=lineNo]').text()) * 37 - half;
  100 +
  101 + top = top>0?top:0;
  102 + currTr.addClass('anim-delay animated flash');
  103 + currTr.parents('._body').slimScroll({ scrollTo: top + 'px' });
  104 + });
  105 + },
  106 + update2Table: function(xlBm, schedule){
  107 + //上行
  108 + $.get('/realSchedule/lineCode/' + xlBm, function(array){
  109 + //加入_data缓存
  110 + $.each(array, function(){
  111 + _data.pushSchedule(this);
  112 + });
  113 +
  114 + var rs = splitDir(array)
  115 + ,tab = $('#tab_line_' + xlBm)
  116 + ,half = tab.find('._body').height() / 2;
  117 + //填充表格数据
  118 + calculateLineNo(
  119 + //上行
  120 + tab.find('table[data-type=up] tbody').html(template('alone_plan_table_temp', {list: rs.up}))[0]
  121 + );
  122 + calculateLineNo(
  123 + //下行
  124 + tab.find('table[data-type=down] tbody').html(template('alone_plan_table_temp', {list: rs.down}))[0]
  125 + );
  126 + //定位到指定的班次
  127 + var currTr = tab.find('tr[data-id='+schedule.id+']')
  128 + ,top = parseInt(currTr.find('td[name=lineNo]').text()) * 37 - half;
93 129  
94   - currTr.addClass('animated flash');
95   - currTr.parents('._body').slimScroll({ scrollTo: top + 'px' });
  130 + top = top>0?top:0;
  131 + currTr.addClass('anim-delay animated flash');
  132 + currTr.parents('._body').slimScroll({ scrollTo: top + 'px' });
  133 + });
96 134 },
97 135 //重新计算行号
98 136 calculateLineNo: calculateLineNo
... ...
src/main/resources/static/pages/control/line/js/data.js
... ... @@ -13,8 +13,7 @@ var _data = (function(){
13 13  
14 14 var dateStr = moment().format('YYYY-MM-DD');
15 15 //实际排班
16   - var schedules = {}
17   - ,scheduleList = [];
  16 + var schedules = {};
18 17  
19 18 //站点路由缓存
20 19 var stationRoute = {};
... ... @@ -24,38 +23,69 @@ var _data = (function(){
24 23 //线路标准信息
25 24 var lineInformations = {};
26 25 //车辆和班次数组映射
27   - var clSchMap = {};
  26 + //var clSchMap = {};
28 27  
29 28 //车辆自编号和设备号对照
30 29 var carDeviceIdMapp = {};
31 30  
  31 + var fcsjSort = function(a, b){
  32 + return a.fcsjT - b.fcsjT;
  33 + }
  34 +
32 35 var dataObject = {
33 36 /*//班次发车
34 37 setFcsj: function(schId, fcsj, fcsjT){
35 38 schedules[schId].fcsjActual = fcsj;
36 39 schedules[schId].fcsjActualTime = fcsjT;
37 40 },*/
  41 + //根据线路编码获取上行和下行班次
  42 + /*findByLineAll: function(xlbm){
  43 + var array = [],sch;
  44 + for(var id in schedules){
  45 + sch = schedules[id];
  46 + if(sch.xlBm == xlbm)
  47 + array.push(e);
  48 + }
  49 + //排序
  50 + array.sort(function(a, b){
  51 + return a.fcsjT - b.fcsjT;
  52 + });
  53 +
  54 + return array;
  55 + },*/
38 56 //根据线路和上下行获取计划排班
39 57 findSchByLine: function(xlbm, upDown){
40 58 var array = [];
41   - $.each(scheduleList, function(){
42   - if(this.xlBm == xlbm
43   - && this.xlDir == upDown)
44   - array.push(this);
45   - });
  59 + var sch;
  60 + for(var id in schedules){
  61 + sch = schedules[id];
  62 + if(sch.xlBm == xlbm
  63 + && sch.xlDir == upDown){
  64 + array.push(sch);
  65 + }
  66 + }
  67 + //排序
  68 + array.sort(fcsjSort);
46 69  
47 70 return array;
48 71 },
49 72 //根据车辆获取班次数组
50 73 findByCl: function(nbbm){
51   - return clSchMap[nbbm];
  74 + var array = [];
  75 + for(var id in schedules){
  76 + sch = schedules[id];
  77 + if(sch.clZbh == nbbm)
  78 + array.push(sch);
  79 + }
  80 +
  81 + //排序
  82 + array.sort(fcsjSort);
  83 + return array;
52 84 },
53 85 //添加一个班次
54 86 pushSchedule: function(sch){
55 87 //附加信息
56 88 attachInfo(sch);
57   - //加入缓存
58   - scheduleList.push(sch);
59 89 schedules[sch.id] = sch;
60 90 lineLpMap[sch.xlBm][sch.lpName].push(sch);
61 91 },
... ... @@ -124,15 +154,14 @@ var _data = (function(){
124 154 attachInfo(this);
125 155 //缓存排班计划
126 156 schedules[this.id] = this;
127   - scheduleList.push(this);
128 157 //构造 线路 ——> 路牌 ——> 班次 3层映射
129 158 if(!lineLpMap[lineCode][this.lpName])
130 159 lineLpMap[lineCode][this.lpName] = [];
131 160 lineLpMap[lineCode][this.lpName].push(this);
132 161 //车辆 ——> 班次数组
133   - if(!clSchMap[this.clZbh])
  162 + /*if(!clSchMap[this.clZbh])
134 163 clSchMap[this.clZbh] = [];
135   - clSchMap[this.clZbh].push(this);
  164 + clSchMap[this.clZbh].push(this);*/
136 165 });
137 166  
138 167 //按发车时间排序
... ... @@ -150,10 +179,15 @@ var _data = (function(){
150 179 //根据车辆内部编码获取排班数组
151 180 getSchedulByVeh: function(nbbm){
152 181 var array = [];
153   - $.each(scheduleList, function(){
154   - if(this.clZbh == nbbm)
155   - array.push(this);
156   - });
  182 + var sch;
  183 + for(var id in schedules){
  184 + sch = schedules[id];
  185 + if(sch.clZbh == nbbm)
  186 + array.push(sch);
  187 + }
  188 +
  189 + //排序
  190 + array.sort(fcsjSort);
157 191 return array;
158 192 },
159 193 //根据设备号获取GPS
... ...
src/main/resources/static/pages/control/line/js/main.js
... ... @@ -83,6 +83,7 @@
83 83 setTimeout(function(){
84 84 //去掉loading
85 85 $('.load-anim').fadeOut();
  86 + $('menu.menu').show();
86 87 }, 500);
87 88 }, 400);
88 89  
... ...
src/main/resources/static/pages/control/line/js/rightMenu.js
... ... @@ -31,7 +31,7 @@ var _menu = (function() {
31 31  
32 32 // 表格右键呼出菜单
33 33 var ac = 'active-menu'
34   - ,items = '.pb-table.data tr td[name!=lineNo]';
  34 + ,items = '.pb-table.data tr td[name!=lineNo][data-name!=lpName]';
35 35 $('.portlet-fullscreen').on('contextmenu', items,
36 36 function(e) {
37 37 e.preventDefault();
... ... @@ -83,6 +83,20 @@ var _menu = (function() {
83 83  
84 84 });
85 85  
  86 + //点击路牌
  87 + var lps = '.pb-table.data tr td[data-name=lpName]';
  88 + $('.portlet-fullscreen').on('click', lps, function(e){
  89 + var lp = $(this).text();
  90 + layer.msg('高亮路牌:' + lp + '',{offset: 'ct', shift : 5});
  91 + var lineCode = $(this).parents('.tab-pane').data('id');
  92 + var schArray = _data.getLineLpMap()[lineCode][lp];
  93 +
  94 + resetAllState();
  95 + $.each(schArray, function(){
  96 + $('.pb-table tr[data-id='+this.id+']').addClass('selected dir_' + this.xlDir);
  97 + });
  98 + });
  99 +
86 100 function selectOneRow(firstCell){
87 101 return $(firstCell).addClass('selected').parent().addClass('_tr_active active-line-no');
88 102 }
... ... @@ -97,11 +111,11 @@ var _menu = (function() {
97 111 tips: [2, '#709d94'],shift:5, time: 5000
98 112 });
99 113 });
100   -
  114 +/*
101 115 $('.portlet-fullscreen').on('dbclick', 'table.pb-table .sfsj-item', function(){
102 116 alert(11);
103 117 });
104   -
  118 +*/
105 119 //选中关联班次
106 120 function selCognateSch($ctr){
107 121 //选中关联班次
... ... @@ -110,6 +124,7 @@ var _menu = (function() {
110 124 ,sch = _data.getSchedulById(schId);
111 125  
112 126 var scroll = false;
  127 + console.log(_data.findByCl(clnbbm));
113 128 $.each(_data.findByCl(clnbbm), function(){
114 129 if(scroll){
115 130 var nextTr = $('tr[data-id='+this.id+']');
... ... @@ -122,8 +137,11 @@ var _menu = (function() {
122 137 }
123 138 scroll = false;
124 139 nextTr.addClass('next-sch');
  140 +
  141 + $('.pb-table tr[data-id='+this.id+']').addClass('selected');
  142 + return false;
125 143 }
126   - $('.pb-table tr[data-id='+this.id+']').addClass('selected');
  144 + //$('.pb-table tr[data-id='+this.id+']').addClass('selected');
127 145 if(this.id == schId)
128 146 scroll = true;
129 147 });
... ... @@ -134,6 +152,8 @@ var _menu = (function() {
134 152 $('.pb-table tr td.' + ac).removeClass(ac);
135 153 $('.pb-table tr.selected').removeClass('selected');
136 154 $('.pb-table tr.next-sch').removeClass('next-sch');
  155 + $('.pb-table tr.dir_0').removeClass('dir_0');
  156 + $('.pb-table tr.dir_1').removeClass('dir_1');
137 157 if(layerTip){
138 158 layer.close(layerTip);
139 159 layerTip = null;
... ... @@ -142,6 +162,8 @@ var _menu = (function() {
142 162 function resetAllState(){
143 163 $('.pb-table tr td.' + ac).removeClass(ac);
144 164 $('.pb-table tr.selected').removeClass('selected');
  165 + $('.pb-table tr.dir_0').removeClass('dir_0');
  166 + $('.pb-table tr.dir_1').removeClass('dir_1');
145 167 $('.pb-table tr._tr_active').removeClass('_tr_active active-line-no');
146 168 $('.pb-table tr.next-sch').removeClass('next-sch');
147 169 $('.pb-table.data tr td.selected[name=lineNo]').removeClass('selected');
... ... @@ -223,7 +245,18 @@ var _menu = (function() {
223 245 },
224 246 //计划烂班
225 247 planDestroy: function(schedul){
226   - var data = {item: schedul, array : _data.getSchedulByVeh(schedul.clZbh)}
  248 + /*if(schedul.status == -1){
  249 + layer.alert('不能重复烂班!', {icon: 2, title: '提示', shift: 5});
  250 + return;
  251 + }*/
  252 + var array = [];
  253 + //获取未烂班的班次
  254 + $.each(_data.getSchedulByVeh(schedul.clZbh),function(){
  255 + if(this.status != -1)
  256 + array.push(this);
  257 + });
  258 +
  259 + var data = {item: schedul, array : array}
227 260 var index = layer.open({
228 261 type: 1,
229 262 area: ['370px', '645px'],
... ... @@ -507,10 +540,33 @@ var _menu = (function() {
507 540 layer.close(index);
508 541 if(rs.t)
509 542 _alone.refreshSchedule(rs.t);
  543 +
  544 + if(rs.nextSch)
  545 + _alone.refreshSchedule(rs.nextSch);
510 546 });
511 547 });
512 548 }
513 549 });
  550 + },
  551 + //基于车辆的待发调整
  552 + outgoAdjustAll: function(schedul){
  553 + $.get('/pages/control/line/child_pages/outgo_adjust_all.html', function(content){
  554 + layer.open({
  555 + type: 1,
  556 + area: '830px',
  557 + maxmin: true,
  558 + content: content,
  559 + shift: 5,
  560 + title: '待发调整(车辆)',
  561 + success: function(){
  562 + $('#outgoAdjustAllPanel').trigger('init', {
  563 + selected: schedul,
  564 + _data: _data,
  565 + _alone: _alone
  566 + });
  567 + }
  568 + });
  569 + });
514 570 }
515 571 }
516 572  
... ...
src/main/resources/static/pages/control/line/temps/alone_tp.html
... ... @@ -293,7 +293,7 @@
293 293 {{each array as obj i}}
294 294 <label>
295 295 <div class="checker">
296   - <span><input type="checkbox" value={{obj.id}} name="ids[]" class="icheck" {{if obj.dfsj==item.dfsj}}checked{{/if}}></span></div> {{obj.dfsj}}
  296 + <span><input type="checkbox" value={{obj.id}} name="ids[]" class="icheck" {{if obj.id==item.id}}checked{{/if}}></span></div> {{obj.dfsj}}
297 297 </label>
298 298 {{/each}}
299 299 </div>
... ... @@ -486,7 +486,7 @@
486 486 <div class="form-custom-row">
487 487 <div class="item full" >
488 488 <p style="margin: 10px 0;">调整说明: <span class="font-red">(不超过20个字符)</span></p>
489   - <textarea class="form-control" name="remarks" rows="4" placeholder="说明,必填"></textarea>
  489 + <textarea class="form-control" name="remarks" rows="4" placeholder="调整说明"></textarea>
490 490 </div>
491 491 </div>
492 492 <hr>
... ...
src/main/resources/static/pages/control/line/temps/child_task_case_tp.html
... ... @@ -3,7 +3,7 @@
3 3 <script id="child_task_main_table_temp" type="text/html">
4 4 {{each list as item i}}
5 5 {{if item == null}}
6   - <tr class="empty">
  6 + <tr class="empty" data-type="empty">
7 7 <td width="5%" >{{i + 1}}</td>
8 8 <td width="9%" ></td>
9 9 <td width="9%" ></td>
... ... @@ -17,7 +17,10 @@
17 17 {{else}}
18 18 <tr data-id="{{item.id}}" >
19 19 <td width="5%" >{{i + 1}}</td>
20   - <td width="9%" >{{item.fcsj}}</td>
  20 + <td width="9%" >
  21 + {{if item.fcsjActual != null}}{{item.fcsjActual}}<span class="blue-badge">实</span>{{else}}{{item.dfsj}}
  22 + {{/if}}
  23 + </td>
21 24 <td width="9%" >{{item.zdsj}}</td>
22 25 <td width="14%" >{{item.qdzName}}</td>
23 26 <td width="14%" >{{item.zdzName}}</td>
... ...