Commit af02e4e152a90c9278c0f5204f07184c27a4ae50

Authored by 潘钊
2 parents 299f3ea7 5acbb9c8

Merge branch 'minhang' of http://222.66.0.204:8090/panzhaov5/bsth_control into minhang

# Conflicts:
#	src/main/java/com/bsth/data/gpsdata/analyse/GeoCacheData.java
#	src/main/java/com/bsth/data/gpsdata/analyse/components/GpsArrival.java
#	src/main/java/com/bsth/data/gpsdata/recovery/GpsDataRecovery.java
Showing 37 changed files with 2909 additions and 1114 deletions

Too many changes to show.

To preserve performance only 37 of 48 files are displayed.

src/main/java/com/bsth/controller/BusIntervalController.java
... ... @@ -22,6 +22,11 @@ public class BusIntervalController {
22 22 public List<Map<String,Object>> getDir(@RequestParam Map<String, Object> map){
23 23 return busIntervalService.getDir(map);
24 24 }
  25 +
  26 + @RequestMapping(value = "/getLp", method = RequestMethod.GET)
  27 + public List<Map<String,Object>> getLp(@RequestParam Map<String, Object> map){
  28 + return busIntervalService.getLp(map);
  29 + }
25 30  
26 31 @RequestMapping(value = "/interval", method = RequestMethod.GET)
27 32 public List<Map<String,Object>> interval(@RequestParam Map<String, Object> map){
... ...
src/main/java/com/bsth/controller/oil/YlbController.java
... ... @@ -3,7 +3,9 @@ package com.bsth.controller.oil;
3 3 import java.text.ParseException;
4 4 import java.text.SimpleDateFormat;
5 5 import java.util.ArrayList;
  6 +import java.util.Calendar;
6 7 import java.util.Date;
  8 +import java.util.GregorianCalendar;
7 9 import java.util.HashMap;
8 10 import java.util.Iterator;
9 11 import java.util.List;
... ... @@ -107,8 +109,16 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
107 109 try {
108 110 String rq=map.get("rq").toString();
109 111 if(!(rq=="")){
  112 +
110 113 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
111   - map.put("rq_eq", sdf.parse(rq));
  114 + Calendar calendar = new GregorianCalendar();
  115 + calendar.setTime(sdf.parse(rq));
  116 + calendar.add(calendar.DATE,1);
  117 + Date date=calendar.getTime();
  118 + map.put("rq_ge", rq);
  119 + map.put("rq_le", sdf.format(date));
  120 + System.out.println(rq);
  121 + System.out.println(sdf.format(date));
112 122 }
113 123 } catch (ParseException e) {
114 124 // TODO Auto-generated catch block
... ...
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
... ... @@ -292,8 +292,9 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
292 292 }
293 293  
294 294 @RequestMapping(value = "/queryUserInfo")
295   - public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line, @RequestParam String date) {
296   - return scheduleRealInfoService.queryUserInfo(line, date);
  295 + public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line,
  296 + @RequestParam String date,@RequestParam String state) {
  297 + return scheduleRealInfoService.queryUserInfo(line, date,state);
297 298 }
298 299  
299 300 @RequestMapping(value = "/exportWaybill")
... ...
src/main/java/com/bsth/controller/report/ReportController.java
... ... @@ -50,23 +50,28 @@ public class ReportController {
50 50 }
51 51  
52 52 @RequestMapping(value = "/tbodyTime1", method = RequestMethod.GET)
53   - public Map<String, Object> tbodyTime1(@RequestParam String line,@RequestParam String date) {
54   - return service.tbodyTime1(line, date);
  53 + public Map<String, Object> tbodyTime1(@RequestParam String line,@RequestParam String ttinfo) {
  54 + return service.tbodyTime1(line, ttinfo);
55 55 }
56 56  
57 57 @RequestMapping(value = "/tbodyTime2", method = RequestMethod.GET)
58   - public Map<String, Object> tbodyTime2(@RequestParam String line,@RequestParam String date) {
59   - return service.tbodyTime2(line, date);
  58 + public Map<String, Object> tbodyTime2(@RequestParam String line,@RequestParam String ttinfo) {
  59 + return service.tbodyTime2(line, ttinfo);
60 60 }
61 61  
62 62 @RequestMapping(value = "/tbodyTime3", method = RequestMethod.GET)
63   - public List<Map<String, Object>> tbodyTime3(@RequestParam String line,@RequestParam String date) {
64   - return service.tbodyTime3(line, date);
  63 + public List<Map<String, Object>> tbodyTime3(@RequestParam String line,@RequestParam String ttinfo) {
  64 + return service.tbodyTime3(line, ttinfo);
65 65 }
66 66  
67 67 @RequestMapping(value = "/tbodyTime5", method = RequestMethod.GET)
68   - public List<Map<String, Object>> tbodyTime5(@RequestParam String line,@RequestParam String date) {
69   - return service.tbodyTime5(line, date);
  68 + public List<Map<String, Object>> tbodyTime5(@RequestParam String line,@RequestParam String ttinfo) {
  69 + return service.tbodyTime5(line, ttinfo);
  70 + }
  71 +
  72 + @RequestMapping(value="/getTtinfo", method = RequestMethod.GET)
  73 + public List<Map<String,Object>> getTtinfo(@RequestParam Map<String, Object> map){
  74 + return service.getTtinfo(map);
70 75 }
71 76  
72 77 }
... ...
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
... ... @@ -285,4 +285,4 @@ public class GpsRealData implements CommandLineRunner{
285 285 return;
286 286 }*/
287 287 }
288   -}
  288 +}
289 289 \ No newline at end of file
... ...
src/main/java/com/bsth/data/gpsdata/analyse/CircleQueue.java
1   -package com.bsth.data.gpsdata.analyse;
2   -
3   -import java.util.Arrays;
4   -
5   -/**
6   - * 循环队列
7   - * Created by panzhao on 2016/12/23.
8   - */
9   -public class CircleQueue<T> {
10   -
11   - /**
12   - * (循环队列)数组的容量
13   - */
14   - public int capacity;
15   -
16   - /**
17   - * 数组:保存循环队列的元素
18   - */
19   - public Object[] elementData;
20   -
21   - /**
22   - * 队头(先进先出)
23   - */
24   - public int head = 0;
25   -
26   - /**
27   - * 队尾
28   - */
29   - public int tail = 0;
30   -
31   - /**
32   - * 以指定长度的数组来创建循环队列
33   - *
34   - * @param initSize
35   - */
36   - public CircleQueue(final int initSize) {
37   - capacity = initSize;
38   - elementData = new Object[capacity];
39   - }
40   -
41   - /**
42   - * 获取循环队列的大小(包含元素的个数)
43   - */
44   - public int size() {
45   - if (isEmpty()) {
46   - return 0;
47   - } else if (isFull()) {
48   - return capacity;
49   - } else {
50   - return tail + 1;
51   - }
52   - }
53   -
54   - /**
55   - * 插入队尾一个元素
56   - */
57   - public void add(final T element) {
58   - if (isEmpty()) {
59   - elementData[0] = element;
60   - } else if (isFull()) {
61   - elementData[head] = element;
62   - head++;
63   - tail++;
64   - head = head == capacity ? 0 : head;
65   - tail = tail == capacity ? 0 : tail;
66   - } else {
67   - elementData[tail + 1] = element;
68   - tail++;
69   - }
70   - }
71   -
72   - public boolean isEmpty() {
73   - return tail == head && tail == 0 && elementData[tail] == null;
74   - }
75   -
76   - public boolean isFull() {
77   - return head != 0 && head - tail == 1 || head == 0 && tail == capacity - 1;
78   - }
79   -
80   - public void clear() {
81   - Arrays.fill(elementData, null);
82   - head = 0;
83   - tail = 0;
84   - }
85   -
86   - /**
87   - * @return 取 循环队列里的值(先进的index=0)
88   - */
89   - public Object[] getQueue() {
90   - final Object[] elementDataSort = new Object[capacity];
91   - final Object[] elementDataCopy = elementData.clone();
92   - if (isEmpty()) {
93   - } else if (isFull()) {
94   - int indexMax = capacity;
95   - int indexSort = 0;
96   - for (int i = head; i < indexMax;) {
97   - elementDataSort[indexSort] = elementDataCopy[i];
98   - indexSort++;
99   - i++;
100   - if (i == capacity) {
101   - i = 0;
102   - indexMax = head;
103   - }
104   - }
105   - } else {
106   - for (int i = 0; i < tail; i++) {
107   - elementDataSort[i] = elementDataCopy[i];
108   - }
109   - }
110   - return elementDataSort;
111   - }
112   -
113   - public T getTail(){
114   - return elementData[tail] == null?null:(T)elementData[tail];
115   - }
  1 +package com.bsth.data.gpsdata.analyse;
  2 +
  3 +import java.util.Arrays;
  4 +
  5 +/**
  6 + * 循环队列
  7 + * Created by panzhao on 2016/12/23.
  8 + */
  9 +public class CircleQueue<T> {
  10 +
  11 + /**
  12 + * (循环队列)数组的容量
  13 + */
  14 + public int capacity;
  15 +
  16 + /**
  17 + * 数组:保存循环队列的元素
  18 + */
  19 + public Object[] elementData;
  20 +
  21 + /**
  22 + * 队头(先进先出)
  23 + */
  24 + public int head = 0;
  25 +
  26 + /**
  27 + * 队尾
  28 + */
  29 + public int tail = 0;
  30 +
  31 + /**
  32 + * 以指定长度的数组来创建循环队列
  33 + *
  34 + * @param initSize
  35 + */
  36 + public CircleQueue(final int initSize) {
  37 + capacity = initSize;
  38 + elementData = new Object[capacity];
  39 + }
  40 +
  41 + /**
  42 + * 获取循环队列的大小(包含元素的个数)
  43 + */
  44 + public int size() {
  45 + if (isEmpty()) {
  46 + return 0;
  47 + } else if (isFull()) {
  48 + return capacity;
  49 + } else {
  50 + return tail + 1;
  51 + }
  52 + }
  53 +
  54 + /**
  55 + * 插入队尾一个元素
  56 + */
  57 + public void add(final T element) {
  58 + if (isEmpty()) {
  59 + elementData[0] = element;
  60 + } else if (isFull()) {
  61 + elementData[head] = element;
  62 + head++;
  63 + tail++;
  64 + head = head == capacity ? 0 : head;
  65 + tail = tail == capacity ? 0 : tail;
  66 + } else {
  67 + elementData[tail + 1] = element;
  68 + tail++;
  69 + }
  70 + }
  71 +
  72 + public boolean isEmpty() {
  73 + return tail == head && tail == 0 && elementData[tail] == null;
  74 + }
  75 +
  76 + public boolean isFull() {
  77 + return head != 0 && head - tail == 1 || head == 0 && tail == capacity - 1;
  78 + }
  79 +
  80 + public void clear() {
  81 + Arrays.fill(elementData, null);
  82 + head = 0;
  83 + tail = 0;
  84 + }
  85 +
  86 + /**
  87 + * @return 取 循环队列里的值(先进的index=0)
  88 + */
  89 + public Object[] getQueue() {
  90 + final Object[] elementDataSort = new Object[capacity];
  91 + final Object[] elementDataCopy = elementData.clone();
  92 + if (isEmpty()) {
  93 + } else if (isFull()) {
  94 + int indexMax = capacity;
  95 + int indexSort = 0;
  96 + for (int i = head; i < indexMax;) {
  97 + elementDataSort[indexSort] = elementDataCopy[i];
  98 + indexSort++;
  99 + i++;
  100 + if (i == capacity) {
  101 + i = 0;
  102 + indexMax = head;
  103 + }
  104 + }
  105 + } else {
  106 + for (int i = 0; i < tail; i++) {
  107 + elementDataSort[i] = elementDataCopy[i];
  108 + }
  109 + }
  110 + return elementDataSort;
  111 + }
  112 +
  113 + public T getTail(){
  114 + return elementData[tail] == null?null:(T)elementData[tail];
  115 + }
116 116 }
117 117 \ No newline at end of file
... ...
src/main/java/com/bsth/data/gpsdata/analyse/GeoCacheData.java
... ... @@ -50,7 +50,7 @@ public class GeoCacheData {
50 50 CircleQueue<GpsEntity> queue = gpsCacheMap.get(gps.getNbbm());
51 51 if (queue == null) {
52 52 //第一个点从站内开始
53   - if(!gps.isInstation())
  53 + if (!gps.isInstation())
54 54 return;
55 55  
56 56 queue = new CircleQueue<>(CACHE_SIZE);
... ... @@ -59,10 +59,10 @@ public class GeoCacheData {
59 59 queue.add(gps);
60 60 }
61 61  
62   - public static void clear(String nbbm){
  62 + public static void clear(String nbbm) {
63 63 try {
64 64 CircleQueue<GpsEntity> queue = gpsCacheMap.get(nbbm);
65   - if(queue != null)
  65 + if (queue != null)
66 66 queue.clear();
67 67 } catch (Exception e) {
68 68 logger.error("", e);
... ... @@ -84,7 +84,7 @@ public class GeoCacheData {
84 84 return null;
85 85 }
86 86  
87   - public static Polygon getTccPolygon(String code){
  87 + public static Polygon getTccPolygon(String code) {
88 88 return tccMap.get(code);
89 89 }
90 90  
... ... @@ -143,11 +143,11 @@ public class GeoCacheData {
143 143 tccTempMap.put(tMap.get("PARK_CODE").toString()
144 144 , polygon);
145 145 } catch (Exception e) {
146   - logger.error("停车场:" + tMap.get("PARK_CODE") , e);
  146 + logger.error("停车场:" + tMap.get("PARK_CODE"), e);
147 147 }
148 148 }
149 149  
150   - if(tccTempMap.size() > 0)
  150 + if (tccTempMap.size() > 0)
151 151 tccMap = tccTempMap;
152 152 }
153 153  
... ... @@ -176,5 +176,4 @@ public class GeoCacheData {
176 176 }
177 177 return cds;
178 178 }
179   -
180 179 }
181 180 \ No newline at end of file
... ...
src/main/java/com/bsth/data/gpsdata/analyse/GpsAnalyse.java
1   -package com.bsth.data.gpsdata.analyse;
2   -
3   -import com.bsth.data.gpsdata.GpsEntity;
4   -import com.bsth.data.gpsdata.analyse.components.GpsArrival;
5   -import org.slf4j.Logger;
6   -import org.slf4j.LoggerFactory;
7   -
8   -import java.util.concurrent.ExecutorService;
9   -import java.util.concurrent.Executors;
10   -
11   -/**
12   - * 分析gps状态信息
13   - * Created by panzhao on 2016/12/23.
14   - */
15   -public class GpsAnalyse {
16   -
17   - static Logger logger = LoggerFactory.getLogger(GpsAnalyse.class);
18   -
19   - //线程池
20   - static ExecutorService threadPool = Executors.newFixedThreadPool(50);
21   -
22   - public static void start(GpsEntity gps) {
23   - threadPool.execute(new ArrivalMatchThread(gps));
24   - }
25   -
26   - public static class ArrivalMatchThread implements Runnable {
27   -
28   - private GpsEntity gps;
29   -
30   - public ArrivalMatchThread(GpsEntity gps) {
31   - this.gps = gps;
32   - }
33   -
34   - @Override
35   - public void run() {
36   - GpsArrival.arrival(gps);
37   - }
38   - }
  1 +package com.bsth.data.gpsdata.analyse;
  2 +
  3 +import com.bsth.data.gpsdata.GpsEntity;
  4 +import com.bsth.data.gpsdata.analyse.components.GpsArrival;
  5 +import org.slf4j.Logger;
  6 +import org.slf4j.LoggerFactory;
  7 +
  8 +import java.util.concurrent.ExecutorService;
  9 +import java.util.concurrent.Executors;
  10 +
  11 +/**
  12 + * 分析gps状态信息
  13 + * Created by panzhao on 2016/12/23.
  14 + */
  15 +public class GpsAnalyse {
  16 +
  17 + static Logger logger = LoggerFactory.getLogger(GpsAnalyse.class);
  18 +
  19 + //线程池
  20 + static ExecutorService threadPool = Executors.newFixedThreadPool(50);
  21 +
  22 + public static void start(GpsEntity gps) {
  23 + threadPool.execute(new ArrivalMatchThread(gps));
  24 + }
  25 +
  26 + public static class ArrivalMatchThread implements Runnable {
  27 +
  28 + private GpsEntity gps;
  29 +
  30 + public ArrivalMatchThread(GpsEntity gps) {
  31 + this.gps = gps;
  32 + }
  33 +
  34 + @Override
  35 + public void run() {
  36 + GpsArrival.arrival(gps);
  37 + }
  38 + }
39 39 }
40 40 \ No newline at end of file
... ...
src/main/java/com/bsth/data/gpsdata/analyse/StationRoute.java
1   -package com.bsth.data.gpsdata.analyse;
2   -
3   -import com.vividsolutions.jts.geom.Point;
4   -import com.vividsolutions.jts.geom.Polygon;
5   -
6   -/**
7   - * Created by panzhao on 2016/12/23.
8   - */
9   -public class StationRoute {
10   -
11   - /**
12   - * 线路编码
13   - */
14   - private String lineCode;
15   -
16   - /**
17   - * 上下行
18   - */
19   - private int directions;
20   -
21   - /**
22   - * 站点编码
23   - */
24   - private String code;
25   -
26   - /**
27   - * 路由顺序
28   - */
29   - private int routeSort;
30   -
31   - /**
32   - * 站点位置
33   - */
34   - private Point point;
35   -
36   - /**
37   - * 圆形半径
38   - */
39   - private Float radius;
40   -
41   - /**
42   - * 多边形电子围栏
43   - */
44   - private Polygon polygon;
45   -
46   - /**
47   - * 站点标记
48   - */
49   - private String mark;
50   -
51   - /**
52   - * 下一站
53   - */
54   - private StationRoute next;
55   -
56   - /**
57   - * 上一站
58   - */
59   - private StationRoute prve;
60   -
61   - public String getCode() {
62   - return code;
63   - }
64   -
65   - public void setCode(String code) {
66   - this.code = code;
67   - }
68   -
69   - public int getRouteSort() {
70   - return routeSort;
71   - }
72   -
73   - public void setRouteSort(int routeSort) {
74   - this.routeSort = routeSort;
75   - }
76   -
77   - public Point getPoint() {
78   - return point;
79   - }
80   -
81   - public void setPoint(Point point) {
82   - this.point = point;
83   - }
84   -
85   - public Float getRadius() {
86   - return radius;
87   - }
88   -
89   - public void setRadius(Float radius) {
90   - this.radius = radius;
91   - }
92   -
93   - public Polygon getPolygon() {
94   - return polygon;
95   - }
96   -
97   - public void setPolygon(Polygon polygon) {
98   - this.polygon = polygon;
99   - }
100   -
101   - public String getLineCode() {
102   - return lineCode;
103   - }
104   -
105   - public void setLineCode(String lineCode) {
106   - this.lineCode = lineCode;
107   - }
108   -
109   - public int getDirections() {
110   - return directions;
111   - }
112   -
113   - public void setDirections(int directions) {
114   - this.directions = directions;
115   - }
116   -
117   - public StationRoute getNext() {
118   - return next;
119   - }
120   -
121   - public void setNext(StationRoute next) {
122   - this.next = next;
123   - }
124   -
125   - public StationRoute getPrve() {
126   - return prve;
127   - }
128   -
129   - public void setPrve(StationRoute prve) {
130   - this.prve = prve;
131   - }
132   -
133   - public String getMark() {
134   - return mark;
135   - }
136   -
137   - public void setMark(String mark) {
138   - this.mark = mark;
139   - }
140   -}
141   -
  1 +package com.bsth.data.gpsdata.analyse;
  2 +
  3 +import com.vividsolutions.jts.geom.Point;
  4 +import com.vividsolutions.jts.geom.Polygon;
  5 +
  6 +/**
  7 + * Created by panzhao on 2016/12/23.
  8 + */
  9 +public class StationRoute {
  10 +
  11 + /**
  12 + * 线路编码
  13 + */
  14 + private String lineCode;
  15 +
  16 + /**
  17 + * 上下行
  18 + */
  19 + private int directions;
  20 +
  21 + /**
  22 + * 站点编码
  23 + */
  24 + private String code;
  25 +
  26 + /**
  27 + * 路由顺序
  28 + */
  29 + private int routeSort;
  30 +
  31 + /**
  32 + * 站点位置
  33 + */
  34 + private Point point;
  35 +
  36 + /**
  37 + * 圆形半径
  38 + */
  39 + private Float radius;
  40 +
  41 + /**
  42 + * 多边形电子围栏
  43 + */
  44 + private Polygon polygon;
  45 +
  46 + /**
  47 + * 站点标记
  48 + */
  49 + private String mark;
  50 +
  51 + /**
  52 + * 下一站
  53 + */
  54 + private StationRoute next;
  55 +
  56 + /**
  57 + * 上一站
  58 + */
  59 + private StationRoute prve;
  60 +
  61 + public String getCode() {
  62 + return code;
  63 + }
  64 +
  65 + public void setCode(String code) {
  66 + this.code = code;
  67 + }
  68 +
  69 + public int getRouteSort() {
  70 + return routeSort;
  71 + }
  72 +
  73 + public void setRouteSort(int routeSort) {
  74 + this.routeSort = routeSort;
  75 + }
  76 +
  77 + public Point getPoint() {
  78 + return point;
  79 + }
  80 +
  81 + public void setPoint(Point point) {
  82 + this.point = point;
  83 + }
  84 +
  85 + public Float getRadius() {
  86 + return radius;
  87 + }
  88 +
  89 + public void setRadius(Float radius) {
  90 + this.radius = radius;
  91 + }
  92 +
  93 + public Polygon getPolygon() {
  94 + return polygon;
  95 + }
  96 +
  97 + public void setPolygon(Polygon polygon) {
  98 + this.polygon = polygon;
  99 + }
  100 +
  101 + public String getLineCode() {
  102 + return lineCode;
  103 + }
  104 +
  105 + public void setLineCode(String lineCode) {
  106 + this.lineCode = lineCode;
  107 + }
  108 +
  109 + public int getDirections() {
  110 + return directions;
  111 + }
  112 +
  113 + public void setDirections(int directions) {
  114 + this.directions = directions;
  115 + }
  116 +
  117 + public StationRoute getNext() {
  118 + return next;
  119 + }
  120 +
  121 + public void setNext(StationRoute next) {
  122 + this.next = next;
  123 + }
  124 +
  125 + public StationRoute getPrve() {
  126 + return prve;
  127 + }
  128 +
  129 + public void setPrve(StationRoute prve) {
  130 + this.prve = prve;
  131 + }
  132 +
  133 + public String getMark() {
  134 + return mark;
  135 + }
  136 +
  137 + public void setMark(String mark) {
  138 + this.mark = mark;
  139 + }
  140 +}
  141 +
... ...
src/main/java/com/bsth/data/gpsdata/analyse/StationRouteComp.java
1   -package com.bsth.data.gpsdata.analyse;
2   -
3   -import java.util.Comparator;
4   -
5   -/**
6   - * Created by panzhao on 2016/12/24.
7   - */
8   -public class StationRouteComp implements Comparator<StationRoute>{
9   - @Override
10   - public int compare(StationRoute s1, StationRoute s2) {
11   - return s1.getRouteSort() - s2.getRouteSort();
12   - }
13   -}
  1 +package com.bsth.data.gpsdata.analyse;
  2 +
  3 +import java.util.Comparator;
  4 +
  5 +/**
  6 + * Created by panzhao on 2016/12/24.
  7 + */
  8 +public class StationRouteComp implements Comparator<StationRoute>{
  9 + @Override
  10 + public int compare(StationRoute s1, StationRoute s2) {
  11 + return s1.getRouteSort() - s2.getRouteSort();
  12 + }
  13 +}
... ...
src/main/java/com/bsth/data/gpsdata/analyse/components/GpsStateCorrective.java
1   -package com.bsth.data.gpsdata.analyse.components;
2   -
3   -import com.bsth.data.gpsdata.GpsEntity;
4   -import com.bsth.data.schedule.DayOfSchedule;
5   -import com.bsth.entity.realcontrol.ScheduleRealInfo;
6   -import com.vividsolutions.jts.geom.GeometryFactory;
7   -import org.joda.time.format.DateTimeFormat;
8   -import org.joda.time.format.DateTimeFormatter;
9   -import org.slf4j.Logger;
10   -import org.slf4j.LoggerFactory;
11   -import org.springframework.beans.BeansException;
12   -import org.springframework.context.ApplicationContext;
13   -import org.springframework.context.ApplicationContextAware;
14   -import org.springframework.stereotype.Component;
15   -
16   -/**
17   - * GPS状态纠正
18   - * Created by panzhao on 2016/12/23.
19   - */
20   -@Component
21   -public class GpsStateCorrective implements ApplicationContextAware {
22   -
23   - static Logger logger = LoggerFactory.getLogger(GpsStateCorrective.class);
24   -
25   - static DayOfSchedule dayOfSchedule;
26   -
27   - private static GeometryFactory geometryFactory = new GeometryFactory();
28   -
29   - public static void correct(GpsEntity gps, ScheduleRealInfo sch){
30   -/* int upDown = Integer.parseInt(sch.getXlDir());
31   - gps.setUpDown(upDown);
32   - List<StationRoute> srs = GeoCacheData.getStationRoute(sch.getXlBm(), upDown);
33   -
34   - Point point = geometryFactory.createPoint(new Coordinate(gps.getLat(), gps.getLon()));
35   -
36   - //之前的点位
37   - CircleQueue<GpsEntity> queue = GeoCacheData.getGps(gps.getNbbm());
38   - GpsEntity prev = null;
39   - if(queue != null)
40   - prev = queue.getTail();
41   -
42   - //线路上,站点间
43   - StationRoute station = GeoUtils.pointInStation(point, srs);
44   - //在站内
45   - if(station != null){
46   - gps.setStopNo(station.getCode());
47   - gps.setInstation(true);
48   - gps.setStation(station);
49   -
50   - if(prev != null && prev.getUpDown() == upDown){
51   - StationRoute prevStation = GeoCacheData.getStation(prev.getLineId(), upDown, prev.getStopNo());
52   -
53   - //倒着开??
54   - if(prevStation.getRouteSort() > station.getRouteSort()){
55   - reversalHandle(gps, prev, sch);
56   - }
57   - }
58   - }
59   - else{
60   - if(prev != null)
61   - gps.setStopNo(prev.getStopNo());
62   - }
63   -
64   - //是否在停车场内
65   - Map<String, Polygon> carparkMap = GeoCacheData.tccMap;
66   - Set<String> codes = carparkMap.keySet();
67   - Polygon p;
68   - for(String code : codes){
69   - p = carparkMap.get(code);
70   - //场内
71   - if(p.contains(point)){
72   - gps.setCarparkNo(code);
73   - if(sch.getBcType().equals("out")){
74   - gps.setInstation(true);
75   - gps.setStopNo(code);
76   - }
77   - }
78   - }*/
79   - }
80   -
81   - private static DateTimeFormatter fmt = DateTimeFormat.forPattern("HH:mm");
82   -
83   - private static void reversalHandle(GpsEntity gps, GpsEntity prev, ScheduleRealInfo sch){
84   - /*if(sch.getBcType().equals("out") && gps.getTimestamp() < sch.getZdsjT())
85   - return;
86   -
87   - //先假设没到终点,直接开始了下一个班次
88   - ScheduleRealInfo next = dayOfSchedule.next(sch);
89   - String log = "倒着开??? nbbm: " + gps.getNbbm() + " 当前:" + gps.getStopNo() + " 上一站:" + prev.getStopNo() + " 当前班次:" + sch.getDfsj();
90   - if(next != null){
91   - dayOfSchedule.addExecPlan(next);
92   -
93   - log += (" 下一个班次:" + next.getDfsj());
94   - }
95   -
96   - log += (" GPS时间:" + fmt.print(gps.getTimestamp()));
97   -
98   - logger.info(log);*/
99   - }
100   -
101   - @Override
102   - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
103   - dayOfSchedule = applicationContext.getBean(DayOfSchedule.class);
104   - }
105   -}
  1 +package com.bsth.data.gpsdata.analyse.components;
  2 +
  3 +import com.bsth.data.gpsdata.GpsEntity;
  4 +import com.bsth.data.schedule.DayOfSchedule;
  5 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  6 +import com.vividsolutions.jts.geom.GeometryFactory;
  7 +import org.joda.time.format.DateTimeFormat;
  8 +import org.joda.time.format.DateTimeFormatter;
  9 +import org.slf4j.Logger;
  10 +import org.slf4j.LoggerFactory;
  11 +import org.springframework.beans.BeansException;
  12 +import org.springframework.context.ApplicationContext;
  13 +import org.springframework.context.ApplicationContextAware;
  14 +import org.springframework.stereotype.Component;
  15 +
  16 +/**
  17 + * GPS状态纠正
  18 + * Created by panzhao on 2016/12/23.
  19 + */
  20 +@Component
  21 +public class GpsStateCorrective implements ApplicationContextAware {
  22 +
  23 + static Logger logger = LoggerFactory.getLogger(GpsStateCorrective.class);
  24 +
  25 + static DayOfSchedule dayOfSchedule;
  26 +
  27 + private static GeometryFactory geometryFactory = new GeometryFactory();
  28 +
  29 + public static void correct(GpsEntity gps, ScheduleRealInfo sch){
  30 +/* int upDown = Integer.parseInt(sch.getXlDir());
  31 + gps.setUpDown(upDown);
  32 + List<StationRoute> srs = GeoCacheData.getStationRoute(sch.getXlBm(), upDown);
  33 +
  34 + Point point = geometryFactory.createPoint(new Coordinate(gps.getLat(), gps.getLon()));
  35 +
  36 + //之前的点位
  37 + CircleQueue<GpsEntity> queue = GeoCacheData.getGps(gps.getNbbm());
  38 + GpsEntity prev = null;
  39 + if(queue != null)
  40 + prev = queue.getTail();
  41 +
  42 + //线路上,站点间
  43 + StationRoute station = GeoUtils.pointInStation(point, srs);
  44 + //在站内
  45 + if(station != null){
  46 + gps.setStopNo(station.getCode());
  47 + gps.setInstation(true);
  48 + gps.setStation(station);
  49 +
  50 + if(prev != null && prev.getUpDown() == upDown){
  51 + StationRoute prevStation = GeoCacheData.getStation(prev.getLineId(), upDown, prev.getStopNo());
  52 +
  53 + //倒着开??
  54 + if(prevStation.getRouteSort() > station.getRouteSort()){
  55 + reversalHandle(gps, prev, sch);
  56 + }
  57 + }
  58 + }
  59 + else{
  60 + if(prev != null)
  61 + gps.setStopNo(prev.getStopNo());
  62 + }
  63 +
  64 + //是否在停车场内
  65 + Map<String, Polygon> carparkMap = GeoCacheData.tccMap;
  66 + Set<String> codes = carparkMap.keySet();
  67 + Polygon p;
  68 + for(String code : codes){
  69 + p = carparkMap.get(code);
  70 + //场内
  71 + if(p.contains(point)){
  72 + gps.setCarparkNo(code);
  73 + if(sch.getBcType().equals("out")){
  74 + gps.setInstation(true);
  75 + gps.setStopNo(code);
  76 + }
  77 + }
  78 + }*/
  79 + }
  80 +
  81 + private static DateTimeFormatter fmt = DateTimeFormat.forPattern("HH:mm");
  82 +
  83 + private static void reversalHandle(GpsEntity gps, GpsEntity prev, ScheduleRealInfo sch){
  84 + /*if(sch.getBcType().equals("out") && gps.getTimestamp() < sch.getZdsjT())
  85 + return;
  86 +
  87 + //先假设没到终点,直接开始了下一个班次
  88 + ScheduleRealInfo next = dayOfSchedule.next(sch);
  89 + String log = "倒着开??? nbbm: " + gps.getNbbm() + " 当前:" + gps.getStopNo() + " 上一站:" + prev.getStopNo() + " 当前班次:" + sch.getDfsj();
  90 + if(next != null){
  91 + dayOfSchedule.addExecPlan(next);
  92 +
  93 + log += (" 下一个班次:" + next.getDfsj());
  94 + }
  95 +
  96 + log += (" GPS时间:" + fmt.print(gps.getTimestamp()));
  97 +
  98 + logger.info(log);*/
  99 + }
  100 +
  101 + @Override
  102 + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
  103 + dayOfSchedule = applicationContext.getBean(DayOfSchedule.class);
  104 + }
  105 +}
... ...
src/main/java/com/bsth/data/gpsdata/analyse/util/GeoUtils.java
1   -package com.bsth.data.gpsdata.analyse.util;
2   -
3   -import com.bsth.data.gpsdata.GpsEntity;
4   -import com.bsth.data.gpsdata.analyse.GeoCacheData;
5   -import com.bsth.data.gpsdata.analyse.StationRoute;
6   -import com.vividsolutions.jts.geom.Coordinate;
7   -import com.vividsolutions.jts.geom.GeometryFactory;
8   -import com.vividsolutions.jts.geom.Point;
9   -import com.vividsolutions.jts.geom.Polygon;
10   -
11   -import java.util.List;
12   -import java.util.Map;
13   -import java.util.Set;
14   -
15   -/**
16   - * Created by panzhao on 2016/12/23.
17   - */
18   -public class GeoUtils {
19   -
20   - private final static double EARTHRADIUS = 6378137;
21   -
22   - private static GeometryFactory geometryFactory = new GeometryFactory();
23   - /**
24   - * gps是否在路由上的某个站内
25   - *
26   - * @param gps
27   - * @param srs
28   - * @return
29   - */
30   - public static StationRoute gpsInStation(GpsEntity gps, List<StationRoute> srs) {
31   - Point point = geometryFactory.createPoint(new Coordinate(gps.getLat(), gps.getLon()));
32   - double min = -1, distance, distance2;
33   - StationRoute stationRoute = null;
34   -
35   - for (StationRoute sr : srs) {
36   - if (sr.getPolygon() == null) {
37   - //圆形
38   - distance = getDistance(sr.getPoint(), point);//sr.getPoint().distance(point);
39   -
40   - if (distance > sr.getRadius())
41   - continue;
42   -
43   - if (min > distance || min == -1) {
44   - min = distance;
45   - stationRoute = sr;
46   - }
47   - } else {
48   - //多边形
49   - if (sr.getPolygon().contains(point)) {
50   - stationRoute = sr;
51   - break;
52   - }
53   - }
54   - }
55   - return stationRoute;
56   - }
57   -
58   - public static double getDistance(Point p1, Point p2) {
59   - double lng1 = getLoop(p1.getY(), -180, 180), lat1 = getRange(
60   - p1.getX(), -74, 74);
61   - double lng2 = getLoop(p2.getY(), -180, 180), lat2 = getRange(
62   - p2.getX(), -74, 74);
63   -
64   - double x1, x2, y1, y2;
65   - x1 = degreeToRad(lng1);
66   - y1 = degreeToRad(lat1);
67   - x2 = degreeToRad(lng2);
68   - y2 = degreeToRad(lat2);
69   - return EARTHRADIUS
70   - * Math.acos((Math.sin(y1) * Math.sin(y2) + Math.cos(y1)
71   - * Math.cos(y2) * Math.cos(x2 - x1)));
72   - }
73   -
74   - private static double getLoop(double v, double a, double b) {
75   - while (v > b) {
76   - v -= b - a;
77   - }
78   - while (v < a) {
79   - v += b - a;
80   - }
81   - return v;
82   - }
83   -
84   - private static double getRange(double v, double a, double b) {
85   - v = Math.min(Math.max(v, a), b);
86   - return v;
87   - }
88   -
89   - private static double degreeToRad(double degree) {
90   - return Math.PI * degree / 180;
91   - }
92   -
93   -
94   - /**
95   - * gps 是否在某个停车场内
96   - * @param gps
97   - * @return
98   - */
99   - public static String gpsInCarpark(GpsEntity gps){
100   - Point point = geometryFactory.createPoint(new Coordinate(gps.getLat(), gps.getLon()));
101   -
102   - Map<String, Polygon> carparkMap = GeoCacheData.tccMap;
103   - Set<String> codes = carparkMap.keySet();
104   - Polygon polygon;
105   - for(String code : codes){
106   - polygon = carparkMap.get(code);
107   - if(point.within(polygon)){
108   - return code;
109   - }
110   - }
111   - return null;
112   - }
113   -
114   - /**
115   - * 是否是有效的连续点
116   - * @param prevGps
117   - * @param gps
118   - * @return
119   - */
120   - public static boolean overdue(GpsEntity prevGps, GpsEntity gps) {
121   - return gps.getTimestamp() - prevGps.getTimestamp() < 120000;
122   - }
123   -}
  1 +package com.bsth.data.gpsdata.analyse.util;
  2 +
  3 +import com.bsth.data.gpsdata.GpsEntity;
  4 +import com.bsth.data.gpsdata.analyse.GeoCacheData;
  5 +import com.bsth.data.gpsdata.analyse.StationRoute;
  6 +import com.vividsolutions.jts.geom.Coordinate;
  7 +import com.vividsolutions.jts.geom.GeometryFactory;
  8 +import com.vividsolutions.jts.geom.Point;
  9 +import com.vividsolutions.jts.geom.Polygon;
  10 +
  11 +import java.util.List;
  12 +import java.util.Map;
  13 +import java.util.Set;
  14 +
  15 +/**
  16 + * Created by panzhao on 2016/12/23.
  17 + */
  18 +public class GeoUtils {
  19 +
  20 + private final static double EARTHRADIUS = 6378137;
  21 +
  22 + private static GeometryFactory geometryFactory = new GeometryFactory();
  23 + /**
  24 + * gps是否在路由上的某个站内
  25 + *
  26 + * @param gps
  27 + * @param srs
  28 + * @return
  29 + */
  30 + public static StationRoute gpsInStation(GpsEntity gps, List<StationRoute> srs) {
  31 + Point point = geometryFactory.createPoint(new Coordinate(gps.getLat(), gps.getLon()));
  32 + double min = -1, distance, distance2;
  33 + StationRoute stationRoute = null;
  34 +
  35 + for (StationRoute sr : srs) {
  36 + if (sr.getPolygon() == null) {
  37 + //圆形
  38 + distance = getDistance(sr.getPoint(), point);//sr.getPoint().distance(point);
  39 +
  40 + if (distance > sr.getRadius())
  41 + continue;
  42 +
  43 + if (min > distance || min == -1) {
  44 + min = distance;
  45 + stationRoute = sr;
  46 + }
  47 + } else {
  48 + //多边形
  49 + if (sr.getPolygon().contains(point)) {
  50 + stationRoute = sr;
  51 + break;
  52 + }
  53 + }
  54 + }
  55 + return stationRoute;
  56 + }
  57 +
  58 + public static double getDistance(Point p1, Point p2) {
  59 + double lng1 = getLoop(p1.getY(), -180, 180), lat1 = getRange(
  60 + p1.getX(), -74, 74);
  61 + double lng2 = getLoop(p2.getY(), -180, 180), lat2 = getRange(
  62 + p2.getX(), -74, 74);
  63 +
  64 + double x1, x2, y1, y2;
  65 + x1 = degreeToRad(lng1);
  66 + y1 = degreeToRad(lat1);
  67 + x2 = degreeToRad(lng2);
  68 + y2 = degreeToRad(lat2);
  69 + return EARTHRADIUS
  70 + * Math.acos((Math.sin(y1) * Math.sin(y2) + Math.cos(y1)
  71 + * Math.cos(y2) * Math.cos(x2 - x1)));
  72 + }
  73 +
  74 + private static double getLoop(double v, double a, double b) {
  75 + while (v > b) {
  76 + v -= b - a;
  77 + }
  78 + while (v < a) {
  79 + v += b - a;
  80 + }
  81 + return v;
  82 + }
  83 +
  84 + private static double getRange(double v, double a, double b) {
  85 + v = Math.min(Math.max(v, a), b);
  86 + return v;
  87 + }
  88 +
  89 + private static double degreeToRad(double degree) {
  90 + return Math.PI * degree / 180;
  91 + }
  92 +
  93 +
  94 + /**
  95 + * gps 是否在某个停车场内
  96 + * @param gps
  97 + * @return
  98 + */
  99 + public static String gpsInCarpark(GpsEntity gps){
  100 + Point point = geometryFactory.createPoint(new Coordinate(gps.getLat(), gps.getLon()));
  101 +
  102 + Map<String, Polygon> carparkMap = GeoCacheData.tccMap;
  103 + Set<String> codes = carparkMap.keySet();
  104 + Polygon polygon;
  105 + for(String code : codes){
  106 + polygon = carparkMap.get(code);
  107 + if(point.within(polygon)){
  108 + return code;
  109 + }
  110 + }
  111 + return null;
  112 + }
  113 +
  114 + /**
  115 + * 是否是有效的连续点
  116 + * @param prevGps
  117 + * @param gps
  118 + * @return
  119 + */
  120 + public static boolean overdue(GpsEntity prevGps, GpsEntity gps) {
  121 + return gps.getTimestamp() - prevGps.getTimestamp() < 120000;
  122 + }
  123 +}
... ...
src/main/java/com/bsth/data/gpsdata/recovery/GpsDataRecovery.java
... ... @@ -145,4 +145,4 @@ public class GpsDataRecovery {
145 145 return (int) (g1.getTimestamp() - g2.getTimestamp());
146 146 }
147 147 }
148 148 -}
  149 +}
149 150 \ No newline at end of file
... ...
src/main/java/com/bsth/entity/realcontrol/ScheduleType.java
1   -package com.bsth.entity.realcontrol;
2   -
3   -/**
4   - * 班次类型
5   - * Created by panzhao on 2016/12/23.
6   - */
7   -public enum ScheduleType {
8   -
9   - normal, //正常班次
10   - out, //出场
11   - in, //进场
12   - region, //区间
13   - venting,//直放
14   - major //放站
15   -}
  1 +package com.bsth.entity.realcontrol;
  2 +
  3 +/**
  4 + * 班次类型
  5 + * Created by panzhao on 2016/12/23.
  6 + */
  7 +public enum ScheduleType {
  8 +
  9 + normal, //正常班次
  10 + out, //出场
  11 + in, //进场
  12 + region, //区间
  13 + venting,//直放
  14 + major //放站
  15 +}
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -24,6 +24,9 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
24 24 @Query(value="select min(s.id), s.jGh,s.clZbh,s.lpName,s.jName from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.jGh,s.clZbh,s.lpName ,s.jName order by (lpName+1)")
25 25 List<ScheduleRealInfo> queryUserInfo2(String line,String date);
26 26  
  27 + @Query(value="select min(s.id), s.jGh,s.clZbh,s.lpName,s.jName from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.jGh,s.clZbh,s.lpName ,s.jName order by (lpName+1)")
  28 + List<ScheduleRealInfo> queryUserInfo3(String line,String date);
  29 +
27 30 @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 order by bcs")
28 31 List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName);
29 32  
... ...
src/main/java/com/bsth/service/BusIntervalService.java
... ... @@ -8,6 +8,8 @@ public interface BusIntervalService {
8 8  
9 9 List<Map<String, Object>> getDir(Map<String, Object> map);
10 10  
  11 + List<Map<String, Object>> getLp(Map<String, Object> map);
  12 +
11 13 List<Map<String, Object>> interval(Map<String, Object> map);
12 14  
13 15 Map<String, Object> timeAndSpeed(Map<String, Object> map);
... ...
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
1 1 package com.bsth.service.impl;
2 2  
  3 +import java.math.BigDecimal;
  4 +import java.math.RoundingMode;
3 5 import java.sql.ResultSet;
4 6 import java.sql.SQLException;
5 7 import java.text.DecimalFormat;
... ... @@ -11,12 +13,14 @@ import java.util.Date;
11 13 import java.util.HashMap;
12 14 import java.util.List;
13 15 import java.util.Map;
  16 +import java.util.Set;
14 17  
15 18 import org.springframework.beans.factory.annotation.Autowired;
16 19 import org.springframework.jdbc.core.JdbcTemplate;
17 20 import org.springframework.jdbc.core.RowMapper;
18 21 import org.springframework.stereotype.Service;
19 22  
  23 +import com.bsth.entity.realcontrol.ChildTaskPlan;
20 24 import com.bsth.entity.realcontrol.ScheduleRealInfo;
21 25 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
22 26 import com.bsth.service.BusIntervalService;
... ... @@ -36,9 +40,9 @@ public class BusIntervalServiceImpl implements BusIntervalService {
36 40 private JdbcTemplate jdbcTemplate;
37 41  
38 42 private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
39   - private DecimalFormat df = new DecimalFormat("##0.00");
  43 + private DecimalFormat df = new DecimalFormat("0.##");
40 44  
41   - public List<ScheduleRealInfo> getSchedule(String company, String subCompany, String line, String startDate, String endDate, String model, String times){
  45 + public List<ScheduleRealInfo> getSchedule(String company, String subCompany, String line, String startDate, String endDate, String model, String times, boolean normal){
42 46 List<Long> ttList = new ArrayList<Long>();
43 47 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
44 48 List<ScheduleRealInfo> resList = new ArrayList<ScheduleRealInfo>();
... ... @@ -56,14 +60,18 @@ public class BusIntervalServiceImpl implements BusIntervalService {
56 60 if(company.length() != 0){
57 61 sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'";
58 62 }
59   - sql += " and bc_type = 'normal'";
  63 + if(normal){
  64 + sql += " and bc_type != 'in' and bc_type != 'out'";
  65 + }
60 66  
61   - list =jdbcTemplate.query(sql,
  67 + list = jdbcTemplate.query(sql,
62 68 new RowMapper<ScheduleRealInfo>(){
63 69 @Override
64 70 public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
65 71 ScheduleRealInfo schedule = new ScheduleRealInfo();
66 72 schedule.setScheduleDateStr(rs.getString("schedule_date_Str"));
  73 + schedule.setRealExecDate(rs.getString("real_exec_date"));
  74 + schedule.setXlBm(rs.getString("xl_bm"));
67 75 schedule.setXlName(rs.getString("xl_name"));
68 76 schedule.setLpName(rs.getString("lp_name"));
69 77 schedule.setBcType(rs.getString("bc_type"));
... ... @@ -75,6 +83,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
75 83 schedule.setFcsjActual(rs.getString("fcsj_actual"));
76 84 schedule.setZdsj(rs.getString("zdsj"));
77 85 schedule.setZdsjActual(rs.getString("zdsj_actual"));
  86 + schedule.setQdzCode(rs.getString("qdz_code"));
78 87 schedule.setQdzName(rs.getString("qdz_name"));
79 88 schedule.setZdzName(rs.getString("zdz_name"));
80 89 schedule.setXlDir(rs.getString("xl_dir"));
... ... @@ -88,15 +97,57 @@ public class BusIntervalServiceImpl implements BusIntervalService {
88 97 schedule.setjGh(rs.getString("j_gh"));
89 98 schedule.setjName(rs.getString("j_name"));
90 99 schedule.setSpId(rs.getLong("sp_id"));
  100 + schedule.setSflj(rs.getBoolean("sflj"));
  101 +
  102 + String[] split1 = schedule.getFcsj().split(":");
  103 + String[] split3 = schedule.getZdsj().split(":");
  104 + long fcsj = Long.valueOf(split1[0]) * 60 + Long.valueOf(split1[1]);
  105 + long zdsj = Long.valueOf(split3[0]) * 60 + Long.valueOf(split3[1]);
  106 + if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate())){
  107 + fcsj += 1440l;
  108 + zdsj += 1440l;
  109 + }
  110 + if(zdsj < fcsj)
  111 + zdsj += 1440l;
  112 + if(schedule.getDfsj() != null){
  113 + String[] split0 = schedule.getDfsj().split(":");
  114 + long dfsj = Long.valueOf(split0[0]) * 60 + Long.valueOf(split0[1]);
  115 + if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate()))
  116 + dfsj += 1440l;
  117 + schedule.setDfsj(dfsj/60 + ":" + dfsj%60);
  118 + schedule.setDfsjT(dfsj);
  119 + }
  120 + if(schedule.getFcsjActual() != null){
  121 + String[] split2 = schedule.getFcsjActual().split(":");
  122 + long fcsjA = Long.valueOf(split2[0]) * 60 + Long.valueOf(split2[1]);
  123 + if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate()))
  124 + fcsjA += 1440l;
  125 + schedule.setFcsjActual(fcsjA/60 + ":" + fcsjA%60);
  126 + schedule.setFcsjActualTime(fcsjA);
  127 + }
  128 + if(schedule.getZdsjActual() != null){
  129 + String[] split4 = schedule.getZdsjActual().split(":");
  130 + long zdsjA = Long.valueOf(split4[0]) * 60 + Long.valueOf(split4[1]);
  131 + if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate()))
  132 + zdsjA += 1440l;
  133 + if(schedule.getFcsjActualTime() != null && zdsjA < schedule.getFcsjActualTime())
  134 + zdsjA += 1440l;
  135 + schedule.setZdsjActual(zdsjA/60 + ":" + zdsjA%60);
  136 + schedule.setZdsjActualTime(zdsjA);
  137 + }
  138 + schedule.setFcsj(fcsj/60 + ":" + fcsj%60);
  139 + schedule.setZdsj(zdsj/60 + ":" + zdsj%60);
  140 + schedule.setFcsjT(fcsj);
  141 + schedule.setZdsjT(zdsj);
91 142 return schedule;
92 143 }
93 144 });
94 145  
95 146 if(model.length() != 0){
96   -// sql = "select * from bsth_c_s_ttinfo_detail where ttinfo = '"+model+"' and bc_type = 'normal'";
97   - sql = "select id from bsth_c_s_sp_info where tt_info = '" + model + "' and bc_type = 'normal'";
  147 +// sql = "select * from bsth_c_s_ttinfo_detail where ttinfo = '"+model+"' and bc_type != 'in' and bc_type != 'out'";
  148 + sql = "select id from bsth_c_s_sp_info where tt_info = '" + model + "' and bc_type != 'in' and bc_type != 'out'";
98 149  
99   - ttList =jdbcTemplate.query(sql,
  150 + ttList = jdbcTemplate.query(sql,
100 151 new RowMapper<Long>(){
101 152 @Override
102 153 public Long mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -143,7 +194,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
143 194 }
144 195 }
145 196 }
146   -
  197 +
147 198 list = new ArrayList<ScheduleRealInfo>();
148 199 List<Long> keyList = new ArrayList<Long>();
149 200 Map<Long, List<ScheduleRealInfo>> keyMap = new HashMap<Long, List<ScheduleRealInfo>>();
... ... @@ -161,7 +212,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
161 212 list.add(schedule);
162 213 }
163 214 }
164   -
  215 +
165 216 return list;
166 217 }
167 218  
... ... @@ -176,7 +227,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
176 227  
177 228 String sql = "select start_station_name, end_station_name from bsth_c_line where line_code = '"+line+"'";
178 229  
179   - list =jdbcTemplate.query(sql,
  230 + list = jdbcTemplate.query(sql,
180 231 new RowMapper<Map<String, Object>>(){
181 232 @Override
182 233 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -205,8 +256,45 @@ public class BusIntervalServiceImpl implements BusIntervalService {
205 256 }
206 257  
207 258 @Override
  259 + public List<Map<String, Object>> getLp(Map<String, Object> map){
  260 + List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
  261 +
  262 + String line = map.get("line").toString();
  263 + String ttId = map.get("ttId").toString();
  264 +
  265 + try {
  266 + String sql = "select td.lp, lp.lp_name from bsth_c_s_ttinfo_detail td" +
  267 + " left join bsth_c_s_gbi lp on td.lp = lp.id" +
  268 + " left join bsth_c_line cl on cl.id = td.xl where 1=1";
  269 + if(line.length() != 0)
  270 + sql += " and cl.line_code = '"+line+"'";
  271 + if(ttId.length() != 0)
  272 + sql += " and td.ttinfo = '"+ttId+"'";
  273 + sql += " group by td.lp";
  274 +
  275 + list = jdbcTemplate.query(sql,
  276 + new RowMapper<Map<String, Object>>(){
  277 + @Override
  278 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  279 + Map<String, Object> map = new HashMap<String, Object>();
  280 + map.put("id", rs.getString("lp"));
  281 + map.put("name", rs.getString("lp_name"));
  282 + return map;
  283 + }
  284 +
  285 + });
  286 + } catch (Exception e) {
  287 + // TODO: handle exception
  288 + e.printStackTrace();
  289 + }
  290 +
  291 + return list;
  292 + }
  293 +
  294 + @Override
208 295 public List<Map<String, Object>> interval(Map<String, Object> map) {
209 296 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  297 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
210 298 Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>();
211 299  
212 300 String company = map.get("company").toString();
... ... @@ -215,7 +303,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
215 303 String startDate = map.get("startDate").toString();
216 304 String endDate = map.get("endDate").toString();
217 305 String model = map.get("model").toString();
218   - String times = map.get("times").toString();
  306 + String statu = map.get("statu").toString();
  307 +// String times = map.get("times").toString();
219 308 String type = map.get("type").toString();
220 309  
221 310 if(startDate.length() == 0){
... ... @@ -224,273 +313,737 @@ public class BusIntervalServiceImpl implements BusIntervalService {
224 313 if(endDate.length() == 0){
225 314 endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
226 315 }
227   - if(times.length() == 0){
228   - times = "06:00-07:00";
  316 + if(statu.equals("0")){
  317 + line = "";
229 318 }
  319 +// if(times.length() == 0){
  320 +// times = "06:00-07:00";
  321 +// }
230 322  
231   - List<ScheduleRealInfo> list = this.getSchedule(company, subCompany, line, startDate, endDate, model, times);
  323 + List<ScheduleRealInfo> list = this.getSchedule(company, subCompany, line, startDate, endDate, model, "", true);
232 324  
233 325 String[] date1 = startDate.split("-");
234 326 String[] date2 = endDate.split("-");
235 327 startDate = date1[0] + "年" + date1[1] + "月" + date1[2] + "日";
236 328 endDate = date2[0] + "年" + date2[1] + "月" + date2[2] + "日";
  329 + String Date = "";
  330 + if(startDate.equals(endDate))
  331 + Date = startDate;
  332 + else
  333 + Date = startDate + "--" + endDate;
237 334  
238   - String[] split = times.split("-");
239   - int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]);
240   - int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]);
  335 +// String[] split = times.split("-");
  336 +// int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]);
  337 +// int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]);
241 338  
242   - //分组统计班次间隔
243 339 for(ScheduleRealInfo schedule : list){
244   - long fcsj = schedule.getFcsjT();
245   - if(endTime != 0?(fcsj >= startTime && fcsj <= endTime):(fcsj >= startTime)){
246   - String key = schedule.getXlName() + "/" + schedule.getQdzName();
247   - if(!keyMap.containsKey(key))
248   - keyMap.put(key, new ArrayList<ScheduleRealInfo>());
249   - keyMap.get(key).add(schedule);
250   - }
  340 + String key = schedule.getXlBm() + "/" + schedule.getXlName() + "/" + schedule.getQdzName();
  341 + if(!keyMap.containsKey(key))
  342 + keyMap.put(key, new ArrayList<ScheduleRealInfo>());
  343 + keyMap.get(key).add(schedule);
251 344 }
  345 +
  346 + List<String> keyList = new ArrayList<String>();
  347 + Map<String, List<Long>> temp0 = new HashMap<String, List<Long>>();
  348 + Map<String, List<Long>> temp1 = new HashMap<String, List<Long>>();
  349 + String companyName = "", subCompanyName = "";
252 350 for(String key : keyMap.keySet()){
253   - long jhInterval = 0;
254   - long sjInterval = 0;
255   - int jhNum = 0;
256   - int sjNum = 0;
257   - String companyName = "", subCompanyName = "";
258   - Map<String, Object> tempMap = new HashMap<String, Object>();
259   - Map<String, List<ScheduleRealInfo>> temp = new HashMap<String, List<ScheduleRealInfo>>();
  351 + if(keyMap.get(key).size() < 2)
  352 + continue;
  353 + Map<String, List<ScheduleRealInfo>> keyMap2 = new HashMap<String, List<ScheduleRealInfo>>();
260 354 for(ScheduleRealInfo schedule : keyMap.get(key)){
  355 + if(companyName.length() == 0 && schedule.getGsName() != null)
  356 + companyName = schedule.getGsName();
  357 + if(subCompanyName.length() == 0 && schedule.getFgsName() != null)
  358 + subCompanyName = schedule.getFgsName();
261 359 String date = schedule.getScheduleDateStr();
262   - if(!temp.containsKey(date))
263   - temp.put(date, new ArrayList<ScheduleRealInfo>());
264   - temp.get(date).add(schedule);
  360 + if(!keyMap2.containsKey(date))
  361 + keyMap2.put(date, new ArrayList<ScheduleRealInfo>());
  362 + keyMap2.get(date).add(schedule);
265 363 }
266   - for(String date : temp.keySet()){
267   - List<ScheduleRealInfo> tempList = temp.get(date);
268   - for(int i = 1; i < tempList.size(); i++){
269   - jhNum++;
270   - ScheduleRealInfo schedule1 = tempList.get(i - 1);
271   - ScheduleRealInfo schedule2 = tempList.get(i);
272   -
273   - if(schedule1.getGsName() != null && companyName.length() == 0)
274   - companyName = schedule1.getGsName();
275   - if(schedule1.getFgsName() != null && subCompanyName.length() == 0)
276   - subCompanyName = schedule1.getFgsName();
277   -
278   - jhInterval += schedule2.getFcsjT();
279   - jhInterval -= schedule1.getFcsjT();
280   - if(schedule1.getFcsjActual()!=null && schedule2.getFcsjActual()!=null){
281   - sjNum++;
282   - sjInterval += schedule2.getFcsjActualTime();
283   - sjInterval -= schedule1.getFcsjActualTime();
  364 + Map<Long, List<Long>> timeMap0 = new HashMap<Long, List<Long>>();
  365 + Map<Long, List<Long>> timeMap1 = new HashMap<Long, List<Long>>();
  366 + List<Long> timeList = new ArrayList<Long>();
  367 + for(String date : keyMap2.keySet()){
  368 + if(keyMap2.get(date).size() < 2)
  369 + continue;
  370 + List<Long> fcsjs = new ArrayList<Long>();
  371 + List<Long> fcsjAs = new ArrayList<Long>();
  372 + for(ScheduleRealInfo schedule : keyMap2.get(date)){
  373 + if(schedule.getFcsjT() != null && !schedule.isSflj())
  374 + fcsjs.add(schedule.getFcsjT());
  375 + if(schedule.getFcsjActualTime() != null && schedule.getStatus() != -1)
  376 + fcsjAs.add(schedule.getFcsjActualTime());
  377 + }
  378 + Collections.sort(fcsjs);
  379 + Collections.sort(fcsjAs);
  380 +
  381 + if(statu.equals("1")){
  382 + for(int i = 1; i < fcsjs.size(); i++){
  383 + long fcsj1 = fcsjs.get(i - 1);
  384 + long fcsj2 = fcsjs.get(i);
  385 + Long time = fcsj1/60;
  386 + if(!timeMap0.containsKey(time) && !timeMap1.containsKey(time)){
  387 + timeMap0.put(time, new ArrayList<Long>());
  388 + timeMap1.put(time, new ArrayList<Long>());
  389 + timeList.add(time);
  390 + }
  391 + timeMap0.get(time).add(fcsj2 - fcsj1);
  392 + }
  393 + for(int i = 1; i < fcsjAs.size(); i++){
  394 + long fcsj1 = fcsjAs.get(i - 1);
  395 + long fcsj2 = fcsjAs.get(i);
  396 + Long time = fcsj1/60;
  397 + if(timeMap1.containsKey(time)){
  398 + timeMap1.get(time).add(fcsj2 - fcsj1);
  399 + }
  400 + }
  401 + }else if(statu.equals("0")){
  402 + for(int i = 1; i < fcsjs.size(); i++){
  403 + long fcsj1 = fcsjs.get(i - 1);
  404 + long fcsj2 = fcsjs.get(i);
  405 + if(!temp0.containsKey(key) && !temp1.containsKey(key)){
  406 + temp0.put(key, new ArrayList<Long>());
  407 + temp1.put(key, new ArrayList<Long>());
  408 + if(!keyList.contains(key))
  409 + keyList.add(key);
  410 + }
  411 + temp0.get(key).add(fcsj2 - fcsj1);
  412 + }
  413 + for(int i = 1; i < fcsjAs.size(); i++){
  414 + long fcsj1 = fcsjAs.get(i - 1);
  415 + long fcsj2 = fcsjAs.get(i);
  416 + temp1.get(key).add(fcsj2 - fcsj1);
284 417 }
285 418 }
286 419 }
287   - if(startDate.equals(endDate))
288   - tempMap.put("date", startDate);
289   - else
290   - tempMap.put("date", startDate + "--" + endDate);
291   - String[] keys = key.split("/");
292   - tempMap.put("line", keys[0]);
293   - tempMap.put("qdz", keys[1]);
294   - tempMap.put("times", times);
295   - tempMap.put("company", companyName);
296   - tempMap.put("subCompany", subCompanyName);
297   - if(jhNum != 0)
298   - tempMap.put("jhInterval", jhInterval/jhNum);
299   - else
300   - tempMap.put("jhInterval", "/");
301   - if(sjNum != 0){
302   - tempMap.put("sjInterval", sjInterval/sjNum);
303   - tempMap.put("deviation", sjInterval/sjNum - jhInterval/jhNum);
304   - }
305   - else{
306   - tempMap.put("sjInterval", "/");
307   - tempMap.put("deviation", "/");
  420 +
  421 + if(statu.equals("1")){
  422 + for(Long time : timeList){
  423 + Map<String, Object> tempMap = new HashMap<String, Object>();
  424 + List<Long> fcsjs = timeMap0.get(time);
  425 + List<Long> fcsjAs = timeMap1.get(time);
  426 + Collections.sort(fcsjs);
  427 + Collections.sort(fcsjAs);
  428 + String[] split = key.split("/");
  429 + tempMap.put("date", Date);
  430 + tempMap.put("line", split[1]);
  431 + tempMap.put("qdz", split[2]);
  432 + tempMap.put("company", companyName);
  433 + tempMap.put("subCompany", subCompanyName);
  434 + long jhInterval = 0l;
  435 + long sjInterval = 0l;
  436 + for(Long i : fcsjs)
  437 + jhInterval += i;
  438 + for(Long i : fcsjAs)
  439 + sjInterval += i;
  440 + tempMap.put("jhInterval", fcsjs.size()>0?df.format((double)jhInterval/fcsjs.size()):"/");
  441 + tempMap.put("sjInterval", fcsjAs.size()>0?df.format((double)sjInterval/fcsjAs.size()):"/");
  442 + tempMap.put("MaxInterval", fcsjAs.size()>0?fcsjAs.get(fcsjAs.size() - 1):"/");
  443 + tempMap.put("MinInterval", fcsjAs.size()>0?fcsjAs.get(0):"/");
  444 + tempMap.put("times", (time>9?time:"0"+time) + ":00-" + (time+1>9?(time+1):"0"+(time+1)) + ":00");
  445 + if(tempMap.get("jhInterval").toString().equals("/")
  446 + ||tempMap.get("sjInterval").toString().equals("/")){
  447 + tempMap.put("deviation", "/");
  448 + } else {
  449 + tempMap.put("deviation", df.format(Double.valueOf(tempMap.get("sjInterval").toString())
  450 + - Double.valueOf(tempMap.get("jhInterval").toString())));
  451 + }
  452 + tempList.add(tempMap);
  453 + }
308 454 }
309   - if(tempMap.get("jhInterval") != null && !tempMap.get("jhInterval").toString().equals("0") && !tempMap.get("jhInterval").toString().equals("/"))
310   - resList.add(tempMap);
311 455 }
312 456  
313   - //排序
314   - Map<String, List<Map<String, Object>>> temp = new HashMap<String, List<Map<String, Object>>>();
315   - List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
316   - for(Map<String, Object> m : resList){
317   - String key = m.get("line").toString();
318   - if(!temp.containsKey(key))
319   - temp.put(key, new ArrayList<Map<String, Object>>());
320   - temp.get(key).add(m);
321   - }
322   - for(String key : temp.keySet()){
323   - for(Map<String, Object> m : temp.get(key)){
324   - tempList.add(m);
  457 + if(statu.equals("1")){
  458 + List<Long> sortList = new ArrayList<Long>();
  459 + Map<Long, List<Map<String, Object>>> sortMap = new HashMap<Long, List<Map<String, Object>>>();
  460 + for(Map<String, Object> m : tempList){
  461 + Long sort = Long.valueOf(m.get("times").toString().substring(0, 2));
  462 + if(!sortMap.containsKey(sort)){
  463 + sortMap.put(sort, new ArrayList<Map<String, Object>>());
  464 + sortList.add(sort);
  465 + }
  466 + sortMap.get(sort).add(m);
  467 + }
  468 + Collections.sort(sortList);
  469 + for(Long sort : sortList){
  470 + for(Map<String, Object> m : sortMap.get(sort))
  471 + resList.add(m);
  472 + }
  473 + }else if(statu.equals("0")){
  474 + List<Long> longList = new ArrayList<Long>();
  475 + for(String key : keyList){
  476 + long xlBm = Long.valueOf(key.split("/")[0]);
  477 + if(!longList.contains(xlBm))
  478 + longList.add(xlBm);
  479 + Collections.sort(longList);
  480 + }
  481 + for(long xlBm : longList){
  482 + for(String key : keyList){
  483 + String[] split = key.split("/");
  484 + if((long)Long.valueOf(split[0]) == xlBm){
  485 + Map<String, Object> tempMap = new HashMap<String, Object>();
  486 + List<Long> fcsjs = temp0.get(key);
  487 + List<Long> fcsjAs = temp1.get(key);
  488 + Collections.sort(fcsjs);
  489 + Collections.sort(fcsjAs);
  490 + long fcsj = 0l;
  491 + long fcsjA = 0l;
  492 + for(long l : fcsjs)
  493 + fcsj += l;
  494 + for(long l : fcsjAs)
  495 + fcsjA += l;
  496 + tempMap.put("date", Date);
  497 + tempMap.put("line", split[1]);
  498 + tempMap.put("qdz", split[2]);
  499 + tempMap.put("company", companyName);
  500 + tempMap.put("subCompany", subCompanyName);
  501 + tempMap.put("jhInterval", fcsjs.size()>0?df.format((double)fcsj/fcsjs.size()):"/");
  502 + tempMap.put("sjInterval", fcsjAs.size()>0?df.format((double)fcsjA/fcsjAs.size()):"/");
  503 + tempMap.put("MaxInterval", fcsjAs.size()>0?fcsjAs.get(fcsjAs.size() - 1):"/");
  504 + tempMap.put("MinInterval", fcsjAs.size()>0?fcsjAs.get(0):"/");
  505 + if(tempMap.get("jhInterval").toString().equals("/")
  506 + ||tempMap.get("sjInterval").toString().equals("/")){
  507 + tempMap.put("deviation", "/");
  508 + } else {
  509 + tempMap.put("deviation", df.format(Double.valueOf(tempMap.get("sjInterval").toString())
  510 + - Double.valueOf(tempMap.get("jhInterval").toString())));
  511 + }
  512 + resList.add(tempMap);
  513 + }
  514 + }
325 515 }
326 516 }
327 517  
328   - return tempList;
  518 + return resList;
329 519 }
330 520  
331 521 @Override
332 522 public Map<String, Object> timeAndSpeed(Map<String, Object> map) {
  523 + List<Long> ttList = new ArrayList<Long>();
  524 + List<ChildTaskPlan> cList = new ArrayList<ChildTaskPlan>();
  525 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
333 526 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
334   - List<Map<String, Object>> dateList = new ArrayList<Map<String, Object>>();
  527 + List<Map<String, Object>> dataList = new ArrayList<Map<String, Object>>();
335 528 Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>();
  529 + Map<String, List<ChildTaskPlan>> cMap = new HashMap<String, List<ChildTaskPlan>>();
336 530 Map<String, Object> modelMap = new HashMap<String, Object>();
337   -
  531 +
338 532 String company = map.get("company").toString();
339 533 String subCompany = map.get("subCompany").toString();
  534 + String lp = map.get("lp").toString();
340 535 String line = map.get("line").toString();
  536 + String statu = map.get("statu").toString();
341 537 String startDate = map.get("startDate").toString();
342 538 String endDate = map.get("endDate").toString();
343 539 String model = map.get("model").toString();
344   - String times = map.get("times").toString();
345 540 String type = map.get("type").toString();
346   - String zdzName = map.get("upDown").toString();
347   -
  541 +
348 542 if(startDate.length() == 0){
349 543 startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
350 544 }
351 545 if(endDate.length() == 0){
352 546 endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
353 547 }
354   - if(times.length() == 0){
355   - times = "06:00-07:00";
  548 +
  549 + try {
  550 +
  551 + String sql = "select * from bsth_c_s_sp_info_real where DATE_FORMAT(schedule_date,'%Y-%m-%d') >= '"+startDate+"' and DATE_FORMAT(schedule_date,'%Y-%m-%d') <= '"+endDate+"'";
  552 + if(line.length() != 0 && statu.equals("1")){
  553 + sql += " and xl_bm = '"+line+"'";
  554 + }
  555 + if(lp.length() != 0 && statu.equals("1")){
  556 + sql += " and lp_name = '"+lp+"'";
  557 + }
  558 + if(company.length() != 0){
  559 + sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'";
  560 + }
  561 + sql += " and bc_type != 'in' and bc_type != 'out' order by fcsj";
  562 +
  563 + list = jdbcTemplate.query(sql,
  564 + new RowMapper<ScheduleRealInfo>(){
  565 + @Override
  566 + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
  567 + ScheduleRealInfo schedule = new ScheduleRealInfo();
  568 + schedule.setId(rs.getLong("id"));
  569 + schedule.setScheduleDateStr(rs.getString("schedule_date_Str"));
  570 + schedule.setRealExecDate(rs.getString("real_exec_date"));
  571 + schedule.setXlName(rs.getString("xl_name"));
  572 + schedule.setLpName(rs.getString("lp_name"));
  573 + schedule.setBcType(rs.getString("bc_type"));
  574 + schedule.setBcs(rs.getInt("bcs"));
  575 + schedule.setBcsj(rs.getInt("bcsj"));
  576 + schedule.setJhlc(rs.getDouble("jhlc"));
  577 + schedule.setDfsj(rs.getString("dfsj"));
  578 + schedule.setFcsj(rs.getString("fcsj"));
  579 + schedule.setFcsjActual(rs.getString("fcsj_actual"));
  580 + schedule.setZdsj(rs.getString("zdsj"));
  581 + schedule.setZdsjActual(rs.getString("zdsj_actual"));
  582 + schedule.setQdzName(rs.getString("qdz_name"));
  583 + schedule.setZdzName(rs.getString("zdz_name"));
  584 + schedule.setXlDir(rs.getString("xl_dir"));
  585 + schedule.setStatus(rs.getInt("status"));
  586 + schedule.setRemarks(rs.getString("remarks"));
  587 + schedule.setGsName(rs.getString("gs_name"));
  588 + schedule.setFgsName(rs.getString("fgs_name"));
  589 + schedule.setDfAuto(rs.getBoolean("df_auto"));
  590 + schedule.setOnline(rs.getBoolean("online"));
  591 + schedule.setClZbh(rs.getString("cl_zbh"));
  592 + schedule.setjGh(rs.getString("j_gh"));
  593 + schedule.setjName(rs.getString("j_name"));
  594 + schedule.setStatus(rs.getInt("status"));
  595 + schedule.setSpId(rs.getLong("sp_id"));
  596 + if(schedule.getDfsj() != null){
  597 + String[] split0 = schedule.getDfsj().split(":");
  598 + long dfsj = Long.valueOf(split0[0]) * 60 + Long.valueOf(split0[1]);
  599 + if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate()))
  600 + dfsj += 1440l;
  601 + schedule.setDfsj(dfsj/60 + ":" + dfsj%60);
  602 + schedule.setDfsjT(dfsj);
  603 + }
  604 + if(schedule.getFcsjActual() != null){
  605 + String[] split2 = schedule.getFcsjActual().split(":");
  606 + long fcsjA = Long.valueOf(split2[0]) * 60 + Long.valueOf(split2[1]);
  607 + if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate()))
  608 + fcsjA += 1440l;
  609 + schedule.setFcsjActual(fcsjA/60 + ":" + fcsjA%60);
  610 + schedule.setFcsjActualTime(fcsjA);
  611 + }
  612 + if(schedule.getZdsjActual() != null){
  613 + String[] split4 = schedule.getZdsjActual().split(":");
  614 + long zdsjA = Long.valueOf(split4[0]) * 60 + Long.valueOf(split4[1]);
  615 + if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate()))
  616 + zdsjA += 1440l;
  617 + schedule.setZdsjActual(zdsjA/60 + ":" + zdsjA%60);
  618 + schedule.setZdsjActualTime(zdsjA);
  619 + }
  620 + String[] split1 = schedule.getFcsj().split(":");
  621 + String[] split3 = schedule.getZdsj().split(":");
  622 + long fcsj = Long.valueOf(split1[0]) * 60 + Long.valueOf(split1[1]);
  623 + long zdsj = Long.valueOf(split3[0]) * 60 + Long.valueOf(split3[1]);
  624 +
  625 + if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate())){
  626 + fcsj += 1440l;
  627 + zdsj += 1440l;
  628 + }
  629 + schedule.setFcsj(fcsj/60 + ":" + fcsj%60);
  630 + schedule.setZdsj(zdsj/60 + ":" + zdsj%60);
  631 + schedule.setFcsjT(fcsj);
  632 + schedule.setZdsjT(zdsj);
  633 + return schedule;
  634 + }
  635 + });
  636 +
  637 + sql = "select * from bsth_c_s_child_task order by start_date";
  638 +
  639 + cList = jdbcTemplate.query(sql,
  640 + new RowMapper<ChildTaskPlan>(){
  641 + @Override
  642 + public ChildTaskPlan mapRow(ResultSet rs, int rowNum) throws SQLException {
  643 + ChildTaskPlan cTask = new ChildTaskPlan();
  644 + cTask.setDestroy(rs.getBoolean("destroy"));
  645 + cTask.setStartDate(rs.getString("start_date"));
  646 + cTask.setEndDate(rs.getString("end_date"));
  647 + cTask.setMileage(rs.getFloat("mileage"));
  648 + cTask.setMileageType(rs.getString("mileage_type"));
  649 + cTask.setRemarks(rs.getString("schedule"));
  650 + return cTask;
  651 + }
  652 + });
  653 +
  654 + if(model.length() != 0){
  655 + sql = "select id from bsth_c_s_sp_info where tt_info = '" + model + "' and bc_type != 'in' and bc_type != 'out'";
  656 +
  657 + ttList = jdbcTemplate.query(sql,
  658 + new RowMapper<Long>(){
  659 + @Override
  660 + public Long mapRow(ResultSet rs, int rowNum) throws SQLException {
  661 + return rs.getLong("id");
  662 + }
  663 + });
  664 + }
  665 +
  666 + } catch (Exception e) {
  667 + // TODO: handle exception
  668 + e.printStackTrace();
356 669 }
357   -
358   - List<ScheduleRealInfo> list = this.getSchedule(company, subCompany, line, startDate, endDate, model, times);
359 670  
  671 +
360 672 String[] date1 = startDate.split("-");
361 673 String[] date2 = endDate.split("-");
  674 + String date = "";
362 675 startDate = date1[0] + "年" + date1[1] + "月" + date1[2] + "日";
363 676 endDate = date2[0] + "年" + date2[1] + "月" + date2[2] + "日";
364   -
365   - String[] split = times.split("-");
366   - int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]);
367   - int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]);
  677 + if(startDate.equals(endDate)){
  678 + date = date1[0] + "年" + date1[1] + "月" + date1[2] + "日";
  679 + } else {
  680 + date = date1[0] + "年" + date1[1] + "月" + date1[2] + "日--" +
  681 + date2[0] + "年" + date2[1] + "月" + date2[2] + "日";
  682 + }
  683 +
  684 + for(ChildTaskPlan cTask : cList){
  685 + String key = cTask.getRemarks();
  686 + if(!cMap.containsKey(key))
  687 + cMap.put(key, new ArrayList<ChildTaskPlan>());
  688 + cMap.get(key).add(cTask);
  689 + }
368 690  
369 691 for(ScheduleRealInfo schedule : list){
370   - if(zdzName.length() != 0 && !zdzName.equals(schedule.getZdzName())){
371   - continue;
372   - }
373   - int fcsj = Integer.valueOf(schedule.getFcsjT() + "");
374   - if(!(endTime != 0?(fcsj >= startTime && fcsj < endTime):(fcsj >= startTime))){
375   - continue;
376   - }
377   - String key = schedule.getXlName() + "/" + schedule.getLpName() + "/" + schedule.getZdzName();
378   - if(!keyMap.containsKey(key)){
379   - keyMap.put(key, new ArrayList<ScheduleRealInfo>());
  692 + if(model.length() != 0){
  693 + for(Long tt : ttList)
  694 + if((long) tt == (long)schedule.getSpId()){
  695 + String key = schedule.getScheduleDateStr() + "/" + schedule.getXlName() + "/" + schedule.getLpName();
  696 + if(!keyMap.containsKey(key))
  697 + keyMap.put(key, new ArrayList<ScheduleRealInfo>());
  698 + keyMap.get(key).add(schedule);
  699 + }
  700 + }else{
  701 + String key = schedule.getScheduleDateStr() + "/" + schedule.getXlName() + "/" + schedule.getLpName();
  702 + if(!keyMap.containsKey(key))
  703 + keyMap.put(key, new ArrayList<ScheduleRealInfo>());
  704 + keyMap.get(key).add(schedule);
380 705 }
381   - keyMap.get(key).add(schedule);
382 706 }
383   -
384   - long yysjSum = 0;
385   - double yysdSum = 0;
386   - long yssjSum = 0;
387   - double yssdSum = 0;
  707 +
  708 + String companyName = "", subCompanyName = "";
388 709 for(String key : keyMap.keySet()){
389 710 Map<String, Object> tempMap = new HashMap<String, Object>();
390   - long yysj = 0;
391   - double yysd = 0;
392   - long yssj = 0;
393   - double yssd = 0;
394   - int yyNum = 0;
395   - int ysNum = 0;
396   - String companyName = "", subCompanyName = "";
397   - for(ScheduleRealInfo schedule : keyMap.get(key)){
398   - if(schedule.getGsName() != null && companyName.length() == 0)
  711 + Map<Long, ScheduleRealInfo> sortMap = new HashMap<Long, ScheduleRealInfo>();
  712 + List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
  713 + List<Long> keyList = new ArrayList<Long>();
  714 + List<ScheduleRealInfo> list2 = keyMap.get(key);
  715 + long jhyysj = 0, sjyysj = 0;
  716 + long jhyssj = 0, sjyssj = 0;
  717 + double jhlc = 0, sjlc = 0;
  718 + for(ScheduleRealInfo schedule : list2){
  719 + if(companyName.length() == 0 && schedule.getGsName() != null){
399 720 companyName = schedule.getGsName();
400   - if(schedule.getFgsName() != null && subCompanyName.length() == 0)
  721 + }
  722 + if(subCompanyName.length() == 0 && schedule.getFgsName() != null){
401 723 subCompanyName = schedule.getFgsName();
402   - if(!tempMap.containsKey("xlDir"))
403   - tempMap.put("xlDir", schedule.getXlDir());
404   - if(!tempMap.containsKey("qdz_zdz") && schedule.getXlDir().equals("0"))
405   - tempMap.put("qdz_zdz", schedule.getQdzName() + "--" + schedule.getZdzName());
406   - else if(!tempMap.containsKey("qdz_zdz"))
407   - tempMap.put("qdz_zdz", schedule.getZdzName() + "--" + schedule.getQdzName());
408   - if(schedule.getBcsj() != null && schedule.getJhlc() != null){
409   - int bcsj = schedule.getBcsj();
410   - double jhlc = schedule.getJhlc();
411   - yysd += jhlc/bcsj;
412   - yysj += bcsj;
413   - yyNum++;
414   - if(schedule.getFcsjActual() != null && schedule.getZdsjActual() != null){
415   - long time = schedule.getZdsjActualTime() - schedule.getFcsjActualTime();
416   - yssd += jhlc/time;
417   - yssj += time;
418   - ysNum++;
  724 + }
  725 + long fcsj = schedule.getFcsjT();
  726 + if(sortMap.containsKey(fcsj)){
  727 + if(sortMap.get(fcsj).getFcsjActual() != null)
  728 + continue;
  729 + } else {
  730 + keyList.add(fcsj);
  731 + }
  732 + sortMap.put(fcsj, schedule);
  733 + }
  734 + Collections.sort(keyList);
  735 +
  736 + for(int i = 1; i < keyList.size(); i++){
  737 + ScheduleRealInfo schedule1 = sortMap.get(keyList.get(i - 1));
  738 + ScheduleRealInfo schedule2 = sortMap.get(keyList.get(i));
  739 + jhyysj += schedule2.getFcsjT() - schedule1.getFcsjT();
  740 +
  741 + long zdsj2 = schedule2.getZdsjT();
  742 + long fcsj2 = schedule2.getFcsjT();
  743 + if(fcsj2 > zdsj2)
  744 + zdsj2 += 1440l;
  745 + jhyssj += zdsj2 - fcsj2;
  746 + jhlc += schedule2.getJhlc()==null?0:schedule2.getJhlc();
  747 + if(i == 1){
  748 + long zdsj1 = schedule1.getZdsjT();
  749 + long fcsj1 = schedule1.getFcsjT();
  750 + if(fcsj1 > zdsj1)
  751 + zdsj1 += 1440l;
  752 + jhyssj += zdsj1 - fcsj1;
  753 + jhlc += schedule1.getJhlc()==null?0:schedule1.getJhlc();
  754 + }
  755 + }
  756 +
  757 + for(int i = 0; i < keyList.size(); i++){
  758 + Map<String, Object> m = new HashMap<String, Object>();
  759 + ScheduleRealInfo schedule = sortMap.get(keyList.get(i));
  760 +
  761 + if(cMap.containsKey(schedule.getId())){
  762 + List<ChildTaskPlan> cTasks = cMap.get(schedule.getId());
  763 + for(ChildTaskPlan childTaskPlan : cTasks){
  764 + Map<String, Object> temp = new HashMap<String, Object>();
  765 + if(childTaskPlan.getMileageType().equals("empty") || childTaskPlan.isDestroy()){
  766 + temp.put("lc", null);
  767 + temp.put("fcsj", null);
  768 + temp.put("zdsj", null);
  769 + }else{
  770 + temp.put("lc", childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage());
  771 + if(childTaskPlan.getStartDate() != null && childTaskPlan.getEndDate() != null){
  772 + String[] split1 = childTaskPlan.getStartDate().split(":");
  773 + Long fcsj = Long.valueOf(split1[0])*60 + Long.valueOf(split1[1]);
  774 + temp.put("fcsj", fcsj);
  775 + String[] split2 = childTaskPlan.getEndDate().split(":");
  776 + Long zdsj = Long.valueOf(split2[0])*60 + Long.valueOf(split2[1]);
  777 + temp.put("zdsj", zdsj);
  778 + }else{
  779 + temp.put("zdsj", null);
  780 + temp.put("fcsj", null);
  781 + }
  782 + }
  783 + mapList.add(temp);
419 784 }
  785 + }else{
  786 + m.put("lc", schedule.getJhlc()==null?0:schedule.getJhlc());
  787 + if(schedule.getFcsjActual() != null && schedule.getZdsjActual() != null && schedule.getStatus() != -1){
  788 + String[] split1 = schedule.getFcsjActual().split(":");
  789 + Long fcsj = Long.valueOf(split1[0])*60 + Long.valueOf(split1[1]);
  790 + schedule.setFcsjActualTime(fcsj);
  791 + m.put("fcsj", fcsj);
  792 + String[] split2 = schedule.getZdsjActual().split(":");
  793 + Long zdsj = Long.valueOf(split2[0])*60 + Long.valueOf(split2[1]);
  794 + schedule.setZdsjActualTime(zdsj);
  795 + m.put("zdsj", zdsj);
  796 + }else{
  797 + m.put("zdsj", null);
  798 + m.put("fcsj", null);
  799 + }
  800 + mapList.add(m);
  801 + }
  802 + }
  803 + for(int i = 1; i < mapList.size(); i++){
  804 + Map<String, Object> m1 = mapList.get(i - 1);
  805 + Map<String, Object> m2 = mapList.get(i);
  806 + if(m1.get("fcsj") != null && m2.get("fcsj") != null){
  807 + sjyysj += Long.valueOf(m2.get("fcsj").toString()) - Long.valueOf(m1.get("fcsj").toString());
  808 + }
  809 + if(m2.get("fcsj") != null){
  810 + long zdsj = Long.valueOf(m2.get("zdsj").toString());
  811 + long fcsj = Long.valueOf(m2.get("fcsj").toString());
  812 + if(fcsj > zdsj)
  813 + zdsj += 1440l;
  814 + sjyssj += zdsj - fcsj;
  815 + sjlc += Double.valueOf(m2.get("lc").toString());
  816 + }
  817 + if(i == 1 && m1.get("fcsj") != null){
  818 + long zdsj = Long.valueOf(m1.get("zdsj").toString());
  819 + long fcsj = Long.valueOf(m1.get("fcsj").toString());
  820 + if(fcsj > zdsj)
  821 + zdsj += 1440l;
  822 + sjyssj += zdsj - fcsj;
  823 + sjlc += Double.valueOf(m1.get("lc").toString());
420 824 }
421 825 }
422   - if(startTime != endTime)
423   - tempMap.put("date", startDate + "--" + endDate);
424   - else
425   - tempMap.put("date", startDate);
426   - tempMap.put("times", times);
427   - String[] keys = key.split("/");
428   - tempMap.put("line", keys[0]);
429   - tempMap.put("lp", keys[1]);
430   - tempMap.put("zdz", keys[2]);
431 826 tempMap.put("company", companyName);
432 827 tempMap.put("subCompany", subCompanyName);
  828 + String[] split = key.split("/");
  829 + tempMap.put("date", split[0]);
  830 + tempMap.put("line", split[1]);
  831 + tempMap.put("lp", split[2]);
  832 + tempMap.put("jhlc", jhlc);
  833 + tempMap.put("sjlc", sjlc);
  834 +
  835 + if(jhyysj == 0){
  836 + tempMap.put("jhyysj", "0");
  837 + tempMap.put("jhyycs", "0");
  838 + } else {
  839 + tempMap.put("jhyysj", df.format((float)jhyysj / 60));
  840 + tempMap.put("jhyycs", df.format(jhlc == 0 ? 0 : jhlc / jhyysj * 60));
  841 + }
433 842  
434   - tempMap.put("yysj", (yysj/60) + "小时" + (yysj%60) + "分钟");
435   - yysjSum += yysj;
436   - if(yyNum != 0){
437   - tempMap.put("yysd", df.format((yysd/yyNum)*60) + "公里/小时");
438   - yysdSum += Double.valueOf(df.format((yysd/yyNum)*60));
  843 + if(jhyssj == 0){
  844 + tempMap.put("jhyssj", "0");
  845 + tempMap.put("jhyscs", "0");
439 846 } else {
440   - tempMap.put("yysd", "/");
  847 + tempMap.put("jhyssj", df.format((float)jhyssj / 60));
  848 + tempMap.put("jhyscs", df.format(jhlc == 0 ? 0 : jhlc / jhyssj * 60));
441 849 }
442 850  
443   - tempMap.put("yssj", (yssj/60) + "小时" + (yssj%60) + "分钟");
444   - yssjSum += yssj;
445   - if(ysNum != 0){
446   - tempMap.put("yssd", df.format((yssd/ysNum)*60) + "公里/小时");
447   - yssdSum += Double.valueOf(df.format((yssd/ysNum)*60));
  851 + if(sjyysj == 0){
  852 + tempMap.put("sjyysj", "0");
  853 + tempMap.put("sjyycs", "0");
448 854 } else {
449   - tempMap.put("yssd", "/");
  855 + tempMap.put("sjyysj", df.format((float)sjyysj / 60));
  856 + tempMap.put("sjyycs", df.format(sjlc == 0 ? 0 : sjlc / sjyysj * 60));
450 857 }
451 858  
452   - dateList.add(tempMap);
  859 + if(sjyssj == 0){
  860 + tempMap.put("sjyssj", "0");
  861 + tempMap.put("sjyscs", "0");
  862 + } else {
  863 + tempMap.put("sjyssj", df.format((float)sjyssj / 60));
  864 + tempMap.put("sjyscs", df.format(sjlc == 0 ? 0 : sjlc / sjyssj * 60));
  865 + }
  866 + resList.add(tempMap);
453 867 }
454   - int size = keyMap.keySet().size();
455   - size = size == 0 ? 1 : size;
456   - modelMap.put("yysj", (yysjSum/size)/60 + "小时" + (yysjSum/size)%60 + "分钟");
457   - modelMap.put("yysd", df.format(yysdSum/size) + "公里/小时");
458   - modelMap.put("yssj", (yssjSum/size)/60 + "小时" + (yssjSum/size)%60 + "分钟");
459   - modelMap.put("yssd", df.format(yssdSum/size) + "公里/小时");
460   -
461 868 Map<String, List<Map<String, Object>>> keyMap2 = new HashMap<String, List<Map<String, Object>>>();
462   - for(Map<String, Object> m : dateList){
463   - String key = m.get("line").toString();
  869 + for(Map<String, Object> m : resList){
  870 + String key = m.get("line").toString() + "/" + m.get("lp").toString();
464 871 if(!keyMap2.containsKey(key))
465 872 keyMap2.put(key, new ArrayList<Map<String, Object>>());
466 873 keyMap2.get(key).add(m);
467 874 }
468   - for(String key : keyMap2.keySet()){
469   - List<Integer> keyList = new ArrayList<Integer>();
470   - Map<Integer, List<Map<String, Object>>> temp = new HashMap<Integer, List<Map<String,Object>>>();
471   - for(Map<String, Object> m : keyMap2.get(key)){
472   - String lp = m.get("lp").toString();
473   - String str = "";
474   - for(int i = 0; i < lp.length(); i++){
475   - str += (int)lp.charAt(i);
  875 + Set<String> keySet = keyMap2.keySet();
  876 + List<String> list3 = new ArrayList<String>();
  877 + List<Map<String, Object>> list4 = new ArrayList<Map<String, Object>>();
  878 + list3.addAll(keySet);
  879 + Collections.sort(list3, new Comparator<String>() {
  880 +
  881 + public int compare(String o1, String o2) {
  882 +
  883 + Long a = 0l;
  884 + Long b = 0l;
  885 + String[] split1 = o1.split("/");
  886 + String[] split2 = o2.split("/");
  887 + char[] charArray1 = split1[1].toCharArray();
  888 + char[] charArray2 = split2[1].toCharArray();
  889 + for(int i = 0; i < charArray1.length; i++){
  890 + long temp = 1l;
  891 + for(int j = 0; j < i; j++)
  892 + temp *= 10;
  893 + a += (long)charArray1[charArray1.length - 1 - i] * temp;
476 894 }
477   - Integer num = Integer.valueOf(str)*10+Integer.valueOf(m.get("xlDir").toString());
478   - if(!temp.containsKey(num)){
479   - temp.put(num, new ArrayList<Map<String, Object>>());
480   - keyList.add(num);
  895 + for(int i = 0; i < charArray2.length; i++){
  896 + long temp = 1l;
  897 + for(int j = 0; j < i; j++)
  898 + temp *= 10;
  899 + b += (long)charArray2[charArray2.length - 1 - i] * temp;
481 900 }
482   - temp.get(num).add(m);
  901 +
  902 + return a.compareTo(b);
483 903 }
484   - Collections.sort(keyList);
485   - for(Integer lp : keyList){
486   - List<Map<String, Object>> tempList = temp.get(lp);
487   - for(Map<String, Object> m : tempList){
488   - resList.add(m);
  904 + });
  905 + Collections.sort(list3, new Comparator<String>() {
  906 +
  907 + public int compare(String o1, String o2) {
  908 +
  909 + Long a = 0l;
  910 + Long b = 0l;
  911 + String[] split1 = o1.split("/");
  912 + String[] split2 = o2.split("/");
  913 + char[] charArray1 = split1[0].toCharArray();
  914 + char[] charArray2 = split2[0].toCharArray();
  915 + for(int i = 0; i < charArray1.length; i++){
  916 + long temp = 1l;
  917 + for(int j = 0; j < i; j++)
  918 + temp *= 10;
  919 + a += (long)charArray1[charArray1.length - 1 - i] * temp;
  920 + }
  921 + for(int i = 0; i < charArray2.length; i++){
  922 + long temp = 1l;
  923 + for(int j = 0; j < i; j++)
  924 + temp *= 10;
  925 + b += (long)charArray2[charArray2.length - 1 - i] * temp;
  926 + }
  927 +
  928 + return a.compareTo(b);
  929 + }
  930 + });
  931 + for(String key : list3){
  932 + Map<String, Object> tempMap = new HashMap<String, Object>();
  933 + BigDecimal jhyysj = new BigDecimal(0), jhyssj = new BigDecimal(0);
  934 + BigDecimal jhyycs = new BigDecimal(0), jhyscs = new BigDecimal(0);
  935 + BigDecimal sjyysj = new BigDecimal(0), sjyssj = new BigDecimal(0);
  936 + BigDecimal sjyycs = new BigDecimal(0), sjyscs = new BigDecimal(0);
  937 + for(Map<String, Object> m : keyMap2.get(key)){
  938 + jhyysj = jhyysj.add(new BigDecimal(m.get("jhyysj").toString()));
  939 + jhyssj = jhyssj.add(new BigDecimal(m.get("jhyssj").toString()));
  940 + jhyycs = jhyycs.add(new BigDecimal(m.get("jhyycs").toString()));
  941 + jhyscs = jhyscs.add(new BigDecimal(m.get("jhyscs").toString()));
  942 + sjyysj = sjyysj.add(new BigDecimal(m.get("sjyysj").toString()));
  943 + sjyssj = sjyssj.add(new BigDecimal(m.get("sjyssj").toString()));
  944 + sjyycs = sjyycs.add(new BigDecimal(m.get("sjyycs").toString()));
  945 + sjyscs = sjyscs.add(new BigDecimal(m.get("sjyscs").toString()));
  946 + }
  947 + BigDecimal size = new BigDecimal(keyMap2.get(key).size());
  948 + tempMap.put("jhyysj", jhyysj.equals(0)?0:jhyysj.divide(size, 2, RoundingMode.HALF_UP));
  949 + tempMap.put("jhyssj", jhyssj.equals(0)?0:jhyssj.divide(size, 2, RoundingMode.HALF_UP));
  950 + tempMap.put("jhyycs", jhyycs.equals(0)?0:jhyycs.divide(size, 2, RoundingMode.HALF_UP));
  951 + tempMap.put("jhyscs", jhyscs.equals(0)?0:jhyscs.divide(size, 2, RoundingMode.HALF_UP));
  952 + tempMap.put("sjyysj", sjyysj.equals(0)?0:sjyysj.divide(size, 2, RoundingMode.HALF_UP));
  953 + tempMap.put("sjyssj", sjyssj.equals(0)?0:sjyssj.divide(size, 2, RoundingMode.HALF_UP));
  954 + tempMap.put("sjyycs", sjyycs.equals(0)?0:sjyycs.divide(size, 2, RoundingMode.HALF_UP));
  955 + tempMap.put("sjyscs", sjyscs.equals(0)?0:sjyscs.divide(size, 2, RoundingMode.HALF_UP));
  956 + String[] split = key.split("/");
  957 + tempMap.put("line", split[0]);
  958 + tempMap.put("lp", split[1]);
  959 + tempMap.put("company", companyName);
  960 + tempMap.put("subCompany", subCompanyName);
  961 + tempMap.put("date", date);
  962 + list4.add(tempMap);
  963 + }
  964 + modelMap.put("dataList", list4);
  965 +
  966 + if(statu.equals("0")){
  967 + Map<String, List<Map<String, Object>>> keyMap4 = new HashMap<String, List<Map<String, Object>>>();
  968 + List<Map<String, Object>> list5 = new ArrayList<Map<String, Object>>();
  969 + List<String> keyList = new ArrayList<String>();
  970 + for(Map<String, Object> m : list4){
  971 + String key = m.get("line").toString();
  972 + if(!keyMap4.containsKey(key)){
  973 + keyList.add(key);
  974 + keyMap4.put(key, new ArrayList<Map<String, Object>>());
489 975 }
  976 + keyMap4.get(key).add(m);
  977 + }
  978 + for(String key : keyList){
  979 + Map<String, Object> tempMap = new HashMap<String, Object>();
  980 + BigDecimal jhyysj = new BigDecimal(0), jhyssj = new BigDecimal(0);
  981 + BigDecimal jhyycs = new BigDecimal(0), jhyscs = new BigDecimal(0);
  982 + BigDecimal sjyysj = new BigDecimal(0), sjyssj = new BigDecimal(0);
  983 + BigDecimal sjyycs = new BigDecimal(0), sjyscs = new BigDecimal(0);
  984 + for(Map<String, Object> m : keyMap4.get(key)){
  985 + jhyysj = jhyysj.add(new BigDecimal(m.get("jhyysj").toString()));
  986 + jhyssj = jhyssj.add(new BigDecimal(m.get("jhyssj").toString()));
  987 + jhyycs = jhyycs.add(new BigDecimal(m.get("jhyycs").toString()));
  988 + jhyscs = jhyscs.add(new BigDecimal(m.get("jhyscs").toString()));
  989 + sjyysj = sjyysj.add(new BigDecimal(m.get("sjyysj").toString()));
  990 + sjyssj = sjyssj.add(new BigDecimal(m.get("sjyssj").toString()));
  991 + sjyycs = sjyycs.add(new BigDecimal(m.get("sjyycs").toString()));
  992 + sjyscs = sjyscs.add(new BigDecimal(m.get("sjyscs").toString()));
  993 + }
  994 + BigDecimal size = new BigDecimal(keyMap4.get(key).size());
  995 + tempMap.put("jhyysj", jhyysj.equals(0)?0:jhyysj.divide(size, 2, RoundingMode.HALF_UP));
  996 + tempMap.put("jhyssj", jhyssj.equals(0)?0:jhyssj.divide(size, 2, RoundingMode.HALF_UP));
  997 + tempMap.put("jhyycs", jhyycs.equals(0)?0:jhyycs.divide(size, 2, RoundingMode.HALF_UP));
  998 + tempMap.put("jhyscs", jhyscs.equals(0)?0:jhyscs.divide(size, 2, RoundingMode.HALF_UP));
  999 + tempMap.put("sjyysj", sjyysj.equals(0)?0:sjyysj.divide(size, 2, RoundingMode.HALF_UP));
  1000 + tempMap.put("sjyssj", sjyssj.equals(0)?0:sjyssj.divide(size, 2, RoundingMode.HALF_UP));
  1001 + tempMap.put("sjyycs", sjyycs.equals(0)?0:sjyycs.divide(size, 2, RoundingMode.HALF_UP));
  1002 + tempMap.put("sjyscs", sjyscs.equals(0)?0:sjyscs.divide(size, 2, RoundingMode.HALF_UP));
  1003 + tempMap.put("line", key);
  1004 + tempMap.put("lp", keyMap4.get(key).size());
  1005 + tempMap.put("company", companyName);
  1006 + tempMap.put("subCompany", subCompanyName);
  1007 + tempMap.put("date", date);
  1008 + tempMap.put("work", keyMap4.get(key));
  1009 + list5.add(tempMap);
  1010 + }
  1011 +
  1012 +
  1013 + modelMap.put("dataList", list5);
  1014 + }
  1015 + modelMap.put("statu", statu);
  1016 +
  1017 + dataList = (List<Map<String, Object>>)modelMap.get("dataList");
  1018 + if(dataList.size() != 0){
  1019 + BigDecimal jhyysj = new BigDecimal(0), jhyssj = new BigDecimal(0);
  1020 + BigDecimal jhyycs = new BigDecimal(0), jhyscs = new BigDecimal(0);
  1021 + BigDecimal sjyysj = new BigDecimal(0), sjyssj = new BigDecimal(0);
  1022 + BigDecimal sjyycs = new BigDecimal(0), sjyscs = new BigDecimal(0);
  1023 + for(Map<String, Object> m : dataList){
  1024 + jhyysj = jhyysj.add(new BigDecimal(m.get("jhyysj").toString()));
  1025 + jhyssj = jhyssj.add(new BigDecimal(m.get("jhyssj").toString()));
  1026 + jhyycs = jhyycs.add(new BigDecimal(m.get("jhyycs").toString()));
  1027 + jhyscs = jhyscs.add(new BigDecimal(m.get("jhyscs").toString()));
  1028 + sjyysj = sjyysj.add(new BigDecimal(m.get("sjyysj").toString()));
  1029 + sjyssj = sjyssj.add(new BigDecimal(m.get("sjyssj").toString()));
  1030 + sjyycs = sjyycs.add(new BigDecimal(m.get("sjyycs").toString()));
  1031 + sjyscs = sjyscs.add(new BigDecimal(m.get("sjyscs").toString()));
490 1032 }
  1033 + BigDecimal size = new BigDecimal(dataList.size());
  1034 + modelMap.put("jhyysj", jhyysj.equals(0)?0:jhyysj.divide(size, 2, RoundingMode.HALF_UP));
  1035 + modelMap.put("jhyssj", jhyssj.equals(0)?0:jhyssj.divide(size, 2, RoundingMode.HALF_UP));
  1036 + modelMap.put("jhyycs", jhyycs.equals(0)?0:jhyycs.divide(size, 2, RoundingMode.HALF_UP));
  1037 + modelMap.put("jhyscs", jhyscs.equals(0)?0:jhyscs.divide(size, 2, RoundingMode.HALF_UP));
  1038 + modelMap.put("sjyysj", sjyysj.equals(0)?0:sjyysj.divide(size, 2, RoundingMode.HALF_UP));
  1039 + modelMap.put("sjyssj", sjyssj.equals(0)?0:sjyssj.divide(size, 2, RoundingMode.HALF_UP));
  1040 + modelMap.put("sjyycs", sjyycs.equals(0)?0:sjyycs.divide(size, 2, RoundingMode.HALF_UP));
  1041 + modelMap.put("sjyscs", sjyscs.equals(0)?0:sjyscs.divide(size, 2, RoundingMode.HALF_UP));
  1042 + modelMap.put("company", companyName);
  1043 + modelMap.put("subCompany", subCompanyName);
  1044 + modelMap.put("dataList", dataList);
491 1045 }
492 1046  
493   - modelMap.put("dateList", resList);
494 1047 return modelMap;
495 1048 }
496 1049  
... ... @@ -523,7 +1076,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
523 1076 times = "06:00-07:00";
524 1077 }
525 1078  
526   - list = getSchedule(company, subCompany, line, startDate, endDate, model, times);
  1079 + list = getSchedule(company, subCompany, line, startDate, endDate, model, times, true);
527 1080  
528 1081 String[] date1 = startDate.split("-");
529 1082 String[] date2 = endDate.split("-");
... ... @@ -534,7 +1087,6 @@ public class BusIntervalServiceImpl implements BusIntervalService {
534 1087 int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]);
535 1088 int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]);
536 1089  
537   -
538 1090 for(ScheduleRealInfo schedule : list){
539 1091 if(qdzName.length() != 0 && !qdzName.equals(schedule.getQdzName())){
540 1092 continue;
... ... @@ -550,26 +1102,11 @@ public class BusIntervalServiceImpl implements BusIntervalService {
550 1102 }
551 1103 for(String key : keyMap.keySet()){
552 1104 Map<String, Object> tempMap = new HashMap<String, Object>();
553   - int jhbc = 0;
554   - int sjbc = 0;
555   - int kbc = 0;
556   - int mbc = 0;
557   - long jhdf = 0l;
558   - long sjdf = 0l;
559   - long wddf1 = 0l;
560   - long wddf2 = 0l;
561   - long jhfc = 0l;
562   - long sjfc = 0l;
563   - long wdfc1 = 0l;
564   - long wdfc2 = 0l;
565   - long jhys = 0l;
566   - long sjys = 0l;
567   - long yssjMax = 0l;
568   - long yssjMin = 0l;
569   - long jhtz = 0l;
570   - long sjtz = 0l;
571   - long tzsjMax = 0l;
572   - long tzsjMin = 0l;
  1105 + int jhbc = 0, sjbc = 0, kbc = 0, mbc = 0;
  1106 + long jhdf = 0l, sjdf = 0l, wddf1 = 0l, wddf2 = 0l;
  1107 + long jhfc = 0l, sjfc = 0l, wdfc1 = 0l, wdfc2 = 0l;
  1108 + long jhys = 0l, sjys = 0l, yssjMax = 0l, yssjMin = 0l;
  1109 + long jhtz = 0l, sjtz = 0l, tzsjMax = 0l, tzsjMin = 0l;
573 1110 String companyName = "", subCompanyName = "";
574 1111 for(ScheduleRealInfo schedule : keyMap.get(key)){
575 1112 if(schedule.getGsName() != null && companyName.length() == 0)
... ... @@ -776,7 +1313,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
776 1313  
777 1314 return resList;
778 1315 }
779   -
  1316 +
780 1317 @Override
781 1318 public List<Map<String, Object>> lbStatuAnaly(Map<String, Object> map) {
782 1319 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
... ... @@ -802,7 +1339,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
802 1339 times = "06:00-07:00";
803 1340 }
804 1341  
805   - list = getSchedule(company, subCompany, line, startDate, endDate, model, times);
  1342 + list = getSchedule(company, subCompany, line, startDate, endDate, model, times, true);
806 1343  
807 1344 String[] date1 = startDate.split("-");
808 1345 String[] date2 = endDate.split("-");
... ... @@ -974,9 +1511,9 @@ public class BusIntervalServiceImpl implements BusIntervalService {
974 1511 if(company.length() != 0){
975 1512 sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'";
976 1513 }
977   - sql += " and bc_type = 'normal'";
  1514 + sql += " and bc_type != 'in' and bc_type != 'out'";
978 1515  
979   - list =jdbcTemplate.query(sql,
  1516 + list = jdbcTemplate.query(sql,
980 1517 new RowMapper<ScheduleRealInfo>(){
981 1518 @Override
982 1519 public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
... ...
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
... ... @@ -131,6 +131,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
131 131 t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString());
132 132 t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
133 133 t.setSsgsdm(map.get("company")==null?"":map.get("company").toString());
  134 + t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString());
134 135 t.setRq(dBefore);
135 136 repository.save(t);
136 137 result = "success";
... ... @@ -216,6 +217,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
216 217 t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString());
217 218 t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
218 219 t.setSsgsdm(map.get("company")==null?"":map.get("company").toString());
  220 + t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString());
219 221 t.setRq(sdf.parse(rq));
220 222 repository.save(t);
221 223 newMap.put("status", ResponseCode.SUCCESS);
... ...
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
... ... @@ -59,7 +59,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
59 59 */
60 60 void adjustConductor(ScheduleRealInfo schedule, String conductor, String conductorName);
61 61  
62   - List<ScheduleRealInfo> queryUserInfo(String line,String date);
  62 + List<ScheduleRealInfo> queryUserInfo(String line,String date,String state);
63 63  
64 64 List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName,String date);
65 65  
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -459,8 +459,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
459 459 }
460 460  
461 461 @Override
462   - public List<ScheduleRealInfo> queryUserInfo(String line, String date) {
463   - return scheduleRealInfoRepository.queryUserInfo2(line, date);
  462 + public List<ScheduleRealInfo> queryUserInfo(String line, String date,String state) {
  463 + if(state.equals("2")){
  464 + return scheduleRealInfoRepository.queryUserInfo2(line, date);
  465 + }else{
  466 + return scheduleRealInfoRepository.queryUserInfo3(line, date);
  467 + }
  468 +
464 469 }
465 470 /**
466 471 *
... ... @@ -613,13 +618,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
613 618  
614 619 @Override
615 620 public List<Object[]> historyMessage(String line, String date, String code) {
616   -
617   - String sql="select t.car_code,d.sender,d.txt_content,d.timestamp from ("
618   - + " select equipment_code,car_code from bsth_c_cars where id in("
619   - + " select cl from bsth_c_s_ccinfo where xl in ( "
620   - + " select id from bsth_c_line where line_code=?1 ))) t"
621   - + " left join bsth_v_directive_60 d on t.equipment_code=d.device_id "
622   - + " where d.timestamp >=?2 and d.timestamp <=?3 and t.car_code like '%?4%'";
623 621 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
624 622 long d= 0;
625 623 long t=0;
... ... @@ -1186,7 +1184,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1186 1184 while(it.hasNext()){
1187 1185 ChildTaskPlan childTaskPlan = it.next();
1188 1186 if(childTaskPlan.getMileageType().equals("empty")){
1189   - ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  1187 + if(childTaskPlan.isDestroy()){
  1188 + remMileage += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  1189 + }else{
  1190 + ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  1191 + }
1190 1192 }else{
1191 1193 if(childTaskPlan.isDestroy()){
1192 1194 remMileage += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
... ... @@ -1244,11 +1246,33 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1244 1246 @Override
1245 1247 public List<ScheduleRealInfo> queryListWaybill(String jName, String clZbh,
1246 1248 String lpName,String date,String type) {
  1249 + List <ScheduleRealInfo> list=null;
1247 1250 if(type.equals("qp")){
1248   - return scheduleRealInfoRepository.queryListWaybill2(jName,clZbh,lpName,date);
  1251 + list= scheduleRealInfoRepository.queryListWaybill2(jName,clZbh,lpName,date);
1249 1252 }else{
1250   - return scheduleRealInfoRepository.queryListWaybill(jName,clZbh,lpName,date);
  1253 + list= scheduleRealInfoRepository.queryListWaybill(jName,clZbh,lpName,date);
1251 1254 }
  1255 + for (int i = 0; i < list.size(); i++) {
  1256 + ScheduleRealInfo s=list.get(i);
  1257 + String remarks="";
  1258 + if(s.getRemarks()!=null){
  1259 + remarks +=s.getRemarks();
  1260 + }
  1261 + Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
  1262 + if(!childTaskPlans.isEmpty()){
  1263 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1264 + while(it.hasNext()){
  1265 + ChildTaskPlan c = it.next();
  1266 + if(c.getRemarks()!=null && c.getRemarks().length()>0){
  1267 + remarks += c.getRemarks();
  1268 + }
  1269 +
  1270 + }
  1271 + }
  1272 + s.setRemarks(remarks);
  1273 + }
  1274 +
  1275 + return list;
1252 1276 }
1253 1277  
1254 1278 @Override
... ... @@ -1329,11 +1353,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1329 1353 }else{
1330 1354 ssgl_other += tempJhlc;
1331 1355 }
1332   -
1333   -
1334   - }else{
1335   - ssgl += tempJhlc;
1336   - ssgl_other += tempJhlc;
1337 1356 }
1338 1357 }else{
1339 1358 Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
... ... @@ -1574,6 +1593,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1574 1593 //根据线路代码获取公司
1575 1594 Line li = lineRepository.findByLineCode(scheduleRealInfo.getXlBm());
1576 1595 yesterdayDataList.get(i).put("company", li.getCompany());
  1596 + yesterdayDataList.get(i).put("bCompany", li.getBrancheCompany());
1577 1597 //计算总公里
1578 1598 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1579 1599 //如果没有子任务,里程就是已执行(Status=2);有子任务的,忽略主任务,子任务的烂班
... ...
src/main/java/com/bsth/service/report/ReportService.java
... ... @@ -19,11 +19,13 @@ public interface ReportService {
19 19  
20 20 List<Object[]> historyMessageCount(String line, String date, String code);
21 21  
22   - Map<String, Object> tbodyTime1(String line ,String date);
  22 + Map<String, Object> tbodyTime1(String line ,String ttinfo);
23 23  
24   - Map<String, Object> tbodyTime2(String line ,String date);
  24 + Map<String, Object> tbodyTime2(String line ,String ttinfo);
25 25  
26   - List<Map<String, Object>> tbodyTime3(String line ,String date);
27   - List<Map<String, Object>> tbodyTime5(String line ,String date);
  26 + List<Map<String, Object>> tbodyTime3(String line ,String ttinfo);
  27 + List<Map<String, Object>> tbodyTime5(String line ,String ttinfo);
  28 +
  29 + List<Map<String, Object>> getTtinfo(Map<String, Object> map);
28 30  
29 31 }
... ...
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -257,16 +257,18 @@ public class ReportServiceImpl implements ReportService{
257 257 return list;
258 258 }
259 259 @Override
260   - public Map<String, Object> tbodyTime1(String line, String date) {
  260 + public Map<String, Object> tbodyTime1(String line, String ttinfo) {
261 261 DecimalFormat df = new DecimalFormat("#0.00");
262 262 // TODO Auto-generated method stub
263 263 //查询配车
264   - String sqlPc=" SELECT cl_zbh FROM bsth_c_s_sp_info "
265   - +" where DATE_FORMAT(schedule_date,'%Y-%m-%d') ='"+date+"' "
266   - + " and xl_bm='"+line+"' and bc_type='normal' "
267   - + " group by cl_zbh ";
  264 + String sqlPc=" select count(*) from bsth_c_cars where id in("
  265 + + " select cl from bsth_c_s_ccinfo where xl in ( "
  266 + + " select id from bsth_c_line where line_code='"+line+"' )"
  267 + + " group by equipment_code ) ";
  268 +
268 269 Map<String, Object> map=new HashMap<String,Object>();
269   - List<Map<String, Object>> listPc= jdbcTemplate.query(sqlPc,
  270 +
  271 + /*List<Map<String, Object>> listPc= jdbcTemplate.query(sqlPc,
270 272 new RowMapper<Map<String, Object>>(){
271 273 @Override
272 274 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -274,13 +276,12 @@ public class ReportServiceImpl implements ReportService{
274 276 m.put("zbh", rs.getString("cl_zbh"));
275 277 return m;
276 278 }
277   - });
  279 + });*/
278 280 //配车
279   - int pcs=listPc.size();
280   -
281   -
282   - String sqlPlan="select jhlc, bc_type ,fcsj from bsth_c_s_sp_info "
283   - + "where DATE_FORMAT(schedule_date,'%Y-%m-%d') ='"+date+"' and xl_bm='"+line+"'";
  281 + int pcs=jdbcTemplate.queryForObject(sqlPc, Integer.class);
  282 +
  283 + String sqlPlan=" SELECT jhlc,bc_type,fcsj FROM bsth_c_s_ttinfo_detail "
  284 + +" where ttinfo ='"+ttinfo+"' ";
284 285  
285 286 //班次
286 287 int zgf_0 = 6*60+31,zgf_1 = 8*60+30,wgf_0 = 16*60+1,wgf_1 = 18*60;
... ... @@ -306,17 +307,10 @@ public class ReportServiceImpl implements ReportService{
306 307 String fcsjs[]=m.get("fcsj").toString().split(":");
307 308  
308 309 zlc +=jhlc;
309   - if(bcType.equals("normal")){
310   - qcBc ++;
311   - if((Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) > zgf_0
312   - && (Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) < zgf_1){
313   - zqcBc++;
314   - }else if((Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) > wgf_0
315   - && (Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) < wgf_1){
316   - wqcBc++;
317   - }
318   - yylc +=jhlc;
319   - }else if(bcType.equals("region")){
  310 + if(bcType.equals("in") || bcType.equals("out")){
  311 + kslc+=jhlc;
  312 + }
  313 + else if(bcType.equals("region")){
320 314 qjBc++;
321 315 if((Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) > zgf_0
322 316 && (Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) < zgf_1){
... ... @@ -328,7 +322,15 @@ public class ReportServiceImpl implements ReportService{
328 322  
329 323 yylc+=jhlc;
330 324 }else{
331   - kslc+=jhlc;
  325 + qcBc ++;
  326 + if((Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) > zgf_0
  327 + && (Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) < zgf_1){
  328 + zqcBc++;
  329 + }else if((Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) > wgf_0
  330 + && (Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) < wgf_1){
  331 + wqcBc++;
  332 + }
  333 + yylc +=jhlc;
332 334 }
333 335 }
334 336  
... ... @@ -346,30 +348,91 @@ public class ReportServiceImpl implements ReportService{
346 348 return map;
347 349 }
348 350 @Override
349   - public Map<String, Object> tbodyTime2(String line, String date) {
  351 + public Map<String, Object> tbodyTime2(String line, String ttinfo) {
350 352 DecimalFormat df = new DecimalFormat("#0.00");
351 353 // TODO Auto-generated method stub
352   - //查询配车
353   - String sqlPc=" SELECT sum(bcsj) as yysj ,sum(jhlc) as yygl FROM bsth_c_s_sp_info "
354   - +" where DATE_FORMAT(schedule_date,'%Y-%m-%d') ='"+date+"' "
355   - + " and xl_bm='"+line+"' and bc_type in ('normal' ,'region' )";
  354 + //最早营运时间 区分夜宵线
  355 + String sqlMinYysj="select start_opt from bsth_c_line_config where line = '"+BasicData.lineId2CodeMap.inverse().get(line) +"'";
  356 + String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  357 + String[] minSjs = minfcsj.split(":");
  358 + int minSj=Integer.parseInt(minSjs[0])*60+Integer.parseInt(minSjs[1]);
  359 + //查询时间里程
  360 + String sqlPc=" (SELECT jhlc,fcsj,bc_type,lp,2 as xh FROM bsth_c_s_ttinfo_detail "
  361 + + " where ttinfo ='"+ttinfo+"' and fcsj <='"+minfcsj+"' ) "
  362 + + " union "
  363 + + " (SELECT jhlc,fcsj,bc_type,lp,1 as xh FROM bsth_c_s_ttinfo_detail "
  364 + + " where ttinfo ='"+ttinfo+"' and fcsj > '"+minfcsj+"') order by lp,xh,fcsj";
  365 +
356 366 Map<String, Object> map=new HashMap<String,Object>();
357 367 List<Map<String, Object>> list= jdbcTemplate.query(sqlPc,
358 368 new RowMapper<Map<String, Object>>(){
359 369 @Override
360 370 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
361 371 Map<String, Object> m=new HashMap<String,Object>();
362   - m.put("yysj", rs.getInt("yysj"));
363   - m.put("yygl", rs.getString("yygl")==null?"0":rs.getString("yygl"));
  372 + m.put("fcsj", rs.getString("fcsj"));
  373 + m.put("yygl", rs.getString("jhlc")==null?"0":rs.getString("jhlc"));
  374 + m.put("bcType", rs.getString("bc_type"));
  375 + m.put("lp", rs.getString("lp"));
364 376 return m;
365 377 }
366 378 });
367 379 int yysj=0 ;
368 380 double yycs=0 ,yygl=0;
369   - if(list.size()>0){
370   - Map<String, Object> m=list.get(0);
371   - yysj=Integer.parseInt((m.get("yysj").toString()));
372   - yygl=Double.parseDouble(m.get("yygl").toString());
  381 + String lp ="0";
  382 + int sj=0;
  383 +
  384 + for(int i=0;i<list.size();i++){
  385 + Map<String, Object> m=list.get(i);
  386 + String time=m.get("fcsj").toString();
  387 + String[] times = time.split(":");
  388 + if(lp.equals(m.get("lp").toString())){
  389 + if(Integer.parseInt(times[0])*60+Integer.parseInt(times[1]) <=minSj){
  390 + if(m.get("bcType").equals("in") || m.get("bcType").equals("out")){
  391 + if(m.get("bcType").equals("in")){
  392 + if(sj!=0){
  393 + yysj +=(Integer.parseInt(times[0])+24)*60+Integer.parseInt(times[1])-sj;
  394 + }
  395 + sj=0;
  396 + }
  397 + }else{
  398 + yygl += Double.parseDouble(m.get("yygl").toString());
  399 +
  400 + if(sj==0){
  401 + sj=(Integer.parseInt(times[0])+24)*60+Integer.parseInt(times[1]);
  402 + }else{
  403 + yysj +=(Integer.parseInt(times[0])+24)*60+Integer.parseInt(times[1])-sj;
  404 + sj=(Integer.parseInt(times[0])+24)*60+Integer.parseInt(times[1]);
  405 + }
  406 + }
  407 + }else{
  408 + if(m.get("bcType").equals("in") || m.get("bcType").equals("out")){
  409 + if(m.get("bcType").equals("in")){
  410 + if(sj!=0){
  411 + yysj +=Integer.parseInt(times[0])*60+Integer.parseInt(times[1])-sj;
  412 + }
  413 + sj=0;
  414 + }
  415 + }else{
  416 + yygl += Double.parseDouble(m.get("yygl").toString());
  417 +
  418 + if(sj==0){
  419 + sj=Integer.parseInt(times[0])*60+Integer.parseInt(times[1]);
  420 + }else{
  421 + yysj +=Integer.parseInt(times[0])*60+Integer.parseInt(times[1])-sj;
  422 + sj=Integer.parseInt(times[0])*60+Integer.parseInt(times[1]);
  423 + }
  424 + }
  425 + }
  426 + }else{
  427 + if( !(m.get("bcType").equals("in") || m.get("bcType").equals("out"))){
  428 + yygl += Double.parseDouble(m.get("yygl").toString());
  429 + sj =Integer.parseInt(times[0])*60+Integer.parseInt(times[1]);
  430 + }else{
  431 + sj=0;
  432 + }
  433 + lp=m.get("lp").toString();
  434 +
  435 + }
373 436 }
374 437 if(yysj>0){
375 438 yycs =yygl/(yysj*1.0/60);
... ... @@ -767,4 +830,34 @@ public class ReportServiceImpl implements ReportService{
767 830 newList.add(newmap5);
768 831 return newList;
769 832 }
  833 + @Override
  834 + public List<Map<String, Object>> getTtinfo(Map<String, Object> map) {
  835 + // TODO Auto-generated method stub
  836 + List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
  837 + String line = map.get("line").toString();
  838 + try {
  839 + String sql = "select tt.id, tt.name from bsth_c_s_ttinfo tt "
  840 + + "left join bsth_c_line cl on cl.id = tt.xl "
  841 + + " where tt.is_cancel = 0 and tt.is_enable_dis_template = 1";
  842 + if(line.length() != 0){
  843 + sql += " and cl.line_code = '"+line+"'";
  844 + }
  845 + sql += " order by tt.create_date desc";
  846 +
  847 + list = jdbcTemplate.query(sql,
  848 + new RowMapper<Map<String, Object>>(){
  849 + @Override
  850 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  851 + Map<String, Object> map = new HashMap<String, Object>();
  852 + map.put("id", rs.getString("id"));
  853 + map.put("name", rs.getString("name"));
  854 + return map;
  855 + }
  856 + });
  857 + }catch (Exception e) {
  858 + // TODO Auto-generated catch block
  859 + e.printStackTrace();
  860 + }
  861 + return list;
  862 + }
770 863 }
... ...
src/main/resources/ms-jdbc.properties
... ... @@ -6,5 +6,4 @@
6 6 ms.mysql.driver= com.mysql.jdbc.Driver
7 7 ms.mysql.url= jdbc:mysql://192.168.168.171:3306/ms?useUnicode=true&characterEncoding=utf-8
8 8 ms.mysql.username= root
9   -ms.mysql.password= root2jsp
10   -
  9 +ms.mysql.password= root2jsp
11 10 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/statement/busInterval.html
... ... @@ -31,40 +31,47 @@
31 31 <form id="history" class="form-inline" action="">
32 32 <div style="display: inline-block; margin-left: 33px;" id="company1">
33 33 <span class="item-label" style="width: 80px;">公司: </span>
34   - <select class="form-control" name="company" id="company" style="width: 180px;"></select>
  34 + <select class="form-control" name="company" id="company" style="width: 140px;"></select>
35 35 </div>
36 36 <div style="display: inline-block; margin-left: 24px;" id="subCompany1">
37 37 <span class="item-label" style="width: 80px;">分公司: </span>
38   - <select class="form-control" name="subCompany" id="subCompany" style="width: 180px;"></select>
  38 + <select class="form-control" name="subCompany" id="subCompany" style="width: 140px;"></select>
39 39 </div>
40   - <div style="display: inline-block; margin-left: 24px;">
  40 + <div style="display: inline-block; margin-left: 10px;">
41 41 <span class="item-label" style="width: 80px;">线路: </span>
42   - <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  42 + <select class="form-control" name="statu" id="statu" style="width: 140px;">
  43 + <option value="0">多线</option>
  44 + <option value="1">单线</option>
  45 + </select>
  46 + </div>
  47 + <div style="display: inline-block; margin-left: 0px;" id="line1">
  48 + <span class="item-label" style="width: 80px;"> - </span>
  49 + <select class="form-control" name="line" id="line" style="width: 140px;"/>
43 50 </div>
44 51 <div style="display: inline-block; margin-left: 10px">
45 52 <span class="item-label" style="width: 80px;">时刻类型: </span>
46   - <select class="form-control" name="model" id="model" style="width: 180px;">
  53 + <select class="form-control" name="model" id="model" style="width: 165px;">
47 54 <option value="">请选择...</option>
48 55 </select>
49 56 </div>
50 57 <div style="margin-top: 10px"></div>
51 58 <div style="display: inline-block;margin-left: 5px;">
52 59 <span class="item-label" style="width: 80px;">开始时间: </span>
53   - <input class="form-control" type="text" id="startDate" style="width: 180px;"/>
  60 + <input class="form-control" type="text" id="startDate" style="width: 140px;"/>
54 61 </div>
55 62 <div style="display: inline-block;margin-left: 10px;">
56 63 <span class="item-label" style="width: 80px;">结束时间: </span>
57   - <input class="form-control" type="text" id="endDate" style="width: 180px;"/>
  64 + <input class="form-control" type="text" id="endDate" style="width: 140px;"/>
58 65 </div>
59   - <div style="display: inline-block;margin-left: 10px;">
60   - <span class="item-label" style="width: 80px;">时间段: </span>
61   - <input class="form-control" type="text" id="times1" style="width: 80px;"/>
62   - </div>
63   - <div style="display: inline-block;">
64   - <span class="item-label" style="width: 80px;"> - </span>
65   - <input class="form-control" type="text" id="times2" style="width: 80px;"/>
66   - </div>
67   - <div class="form-group" style="margin-left: 10px">
  66 +<!-- <div style="display: inline-block;margin-left: 10px;"> -->
  67 +<!-- <span class="item-label" style="width: 80px;">时间段: </span> -->
  68 +<!-- <input class="form-control" type="text" id="times1" style="width: 80px;"/> -->
  69 +<!-- </div> -->
  70 +<!-- <div style="display: inline-block;"> -->
  71 +<!-- <span class="item-label" style="width: 80px;"> - </span> -->
  72 +<!-- <input class="form-control" type="text" id="times2" style="width: 80px;"/> -->
  73 +<!-- </div> -->
  74 + <div class="form-group" style="margin-left: 14px">
68 75 <input class="btn btn-default" type="button" id="query" value="筛选"/>
69 76 <!-- <input class="btn btn-default" type="button" id="export" value="导出"/> -->
70 77 </div>
... ... @@ -74,17 +81,7 @@
74 81 <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
75 82 <table class="table table-bordered table-hover table-checkable" id="forms">
76 83 <thead>
77   - <tr class="hidden">
78   - <th>日期</th>
79   - <th>时段</th>
80   - <th>公司</th>
81   - <th>分公司</th>
82   - <th>线路</th>
83   - <th>起讫站</th>
84   - <th>计划车距(分钟)</th>
85   - <th>实际车距(分钟)</th>
86   - <th>误差值</th>
87   - </tr>
  84 +
88 85 </thead>
89 86 <tbody>
90 87  
... ... @@ -115,14 +112,14 @@
115 112 locale : 'zh-cn'
116 113 });
117 114  
118   - $("#times1").datetimepicker({
119   - format : 'HH:mm',
120   - locale : 'zh-cn'
121   - });
122   - $("#times2").datetimepicker({
123   - format : 'HH:mm',
124   - locale : 'zh-cn'
125   - });
  115 +// $("#times1").datetimepicker({
  116 +// format : 'HH:mm',
  117 +// locale : 'zh-cn'
  118 +// });
  119 +// $("#times2").datetimepicker({
  120 +// format : 'HH:mm',
  121 +// locale : 'zh-cn'
  122 +// });
126 123  
127 124 var d = new Date();
128 125 var year = d.getFullYear();
... ... @@ -135,8 +132,8 @@
135 132 $("#startDate").val(year + "-" + month + "-" + day);
136 133 $("#endDate").val(year + "-" + month + "-" + day);
137 134  
138   - $("#times1").val("06:00");
139   - $("#times2").val("07:00");
  135 +// $("#times1").val("06:00");
  136 +// $("#times2").val("07:00");
140 137  
141 138 var obj = [];
142 139 $.get('/user/companyData', function(result){
... ... @@ -170,14 +167,15 @@
170 167  
171 168 $.get('/basic/lineCode2Name',function(result){
172 169 var data=[];
173   - data.push({id:" ", text:"全部线路"});
  170 +// data.push({id:" ", text:"全部线路"});
174 171 for(var code in result){
175 172 data.push({id: code, text: result[code]});
176 173 }
177 174 console.log(data);
178 175 initPinYinSelect2('#line',data,'');
179 176  
180   - line = "";
  177 +// line = "";
  178 + line = data[0].id;
181 179 updateModel();
182 180 })
183 181  
... ... @@ -223,10 +221,11 @@
223 221 $("#query").on("click",jsDoQuery);
224 222  
225 223 var line = $("#line").val();
  224 + var statu = $("#statu").val();
226 225 var startDate = $("#startDate").val();
227 226 var endDate = $("#endDate").val();
228 227 var model = $("#model").val();
229   - var times = $("#times1").val() + "-" + $("#times2").val();
  228 +// var times = $("#times1").val() + "-" + $("#times2").val();
230 229 var company = $("#company").val();
231 230 var subCompany = $("#subCompany").val();
232 231 function jsDoQuery(pagination){
... ... @@ -235,23 +234,24 @@
235 234 startDate = $("#startDate").val();
236 235 endDate = $("#endDate").val();
237 236 model = $("#model").val();
238   - times = $("#times1").val() + "-" + $("#times2").val();
  237 +// times = $("#times1").val() + "-" + $("#times2").val();
239 238 company = $("#company").val();
240 239 subCompany = $("#subCompany").val();
241 240 params['line'] = line;
  241 + params['statu'] = statu;
242 242 params['startDate'] = startDate;
243 243 params['endDate'] = endDate;
244 244 params['model'] = model;
245   - params['times'] = times;
  245 +// params['times'] = times;
246 246 params['company'] = company;
247 247 params['subCompany'] = subCompany;
248 248 params['type'] = "query";
249   - $(".hidden").removeClass("hidden");
  249 +// $(".hidden").removeClass("hidden");
250 250 $get('/busInterval/interval', params, function(result){
251 251 // 把数据填充到模版中
252   - var tbodyHtml = template('list_workDaily',{list:result});
  252 + var tbodyHtml = template('list_workDaily',{list:result,statu:statu});
253 253 // 把渲染好的模版html文本追加到表格中
254   - $('#forms tbody').html(tbodyHtml);
  254 + $('#forms').html(tbodyHtml);
255 255 _w_table_rowspan("#forms tbody", 1);
256 256 _w_table_rowspan("#forms tbody", 2);
257 257 _w_table_rowspan("#forms tbody", 3);
... ... @@ -266,12 +266,25 @@
266 266 // window.open("/downloadFile/download?fileName=营运服务日报表"+moment(date).format("YYYYMMDD"));
267 267 // });
268 268 // });
269   -
270   -
  269 +
  270 +
  271 + $("#lp1").hide();
  272 + $("#line1").hide();
  273 + $("#statu").on("change", function(){
  274 + statu = $("#statu").val();
  275 + if(statu == 0){
  276 + $("#line1").hide();
  277 + $("#lp1").hide();
  278 + }else{
  279 + $("#line1").show();
  280 + $("#lp1").show();
  281 + }
  282 + updateModel();
  283 + });
271 284 $("#line").on("change", function(){
272 285 line = $("#line").val();
273   - if(line == " ")
274   - line = "";
  286 +// if(line == " ")
  287 +// line = "";
275 288 updateModel();
276 289 });
277 290 $('#startDate').on("blur", function(){
... ... @@ -292,7 +305,10 @@
292 305 flag = 1;
293 306 var treeData = [];
294 307 var params = {};
295   - params['line'] = line;
  308 + if(statu == 0)
  309 + params['line'] = "";
  310 + if(statu == 1)
  311 + params['line'] = line;
296 312 params['startDate'] = startDate;
297 313 params['endDate'] = endDate;
298 314 $get('/pcpc/getModel', params, function(result){
... ... @@ -335,22 +351,45 @@
335 351  
336 352 </script>
337 353 <script type="text/html" id="list_workDaily">
  354 +<thead>
  355 + <tr>
  356 + <th>日期</th>
  357 + <th>公司</th>
  358 + <th>分公司</th>
  359 + <th>线路</th>
  360 + {{if statu == 1}}
  361 + <th>时段</th>
  362 + {{/if}}
  363 + <th>起讫站</th>
  364 + <th>计划车距(分钟)</th>
  365 + <th>实际车距(分钟)</th>
  366 + <th>最大车距(分钟)</th>
  367 + <th>最小车距(分钟)</th>
  368 + <th>误差值</th>
  369 + </tr>
  370 +</thead>
  371 +<tbody>
338 372 {{each list as obj i}}
339 373 <tr>
340   - <td style='text-align:center;vertical-align:middle;'>{{obj.date}}</td>
341   - <td style='text-align:center;vertical-align:middle;'>{{obj.times}}</td>
  374 + <td style='text-align:center;vertical-align:middle;' width='80px'>{{obj.date}}</td>
342 375 <td style='text-align:center;vertical-align:middle;'>{{obj.company}}</td>
343 376 <td style='text-align:center;vertical-align:middle;'>{{obj.subCompany}}</td>
344 377 <td style='text-align:center;vertical-align:middle;'>{{obj.line}}</td>
  378 + {{if statu == 1}}
  379 + <td style='text-align:center;vertical-align:middle;'>{{obj.times}}</td>
  380 + {{/if}}
345 381 <td>{{obj.qdz}}</td>
346 382 <td>{{obj.jhInterval}}</td>
347 383 <td>{{obj.sjInterval}}</td>
  384 + <td>{{obj.MaxInterval}}</td>
  385 + <td>{{obj.MinInterval}}</td>
348 386 <td>{{obj.deviation}}</td>
349 387 </tr>
350 388 {{/each}}
351 389 {{if list.length == 0}}
352 390 <tr>
353   - <td colspan="9"><h6 class="muted">没有找到相关数据</h6></td>
  391 + <td colspan="11"><h6 class="muted">没有找到相关数据</h6></td>
354 392 </tr>
355 393 {{/if}}
  394 +</tbody>
356 395 </script>
357 396 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/statement/correctForm.html
... ... @@ -226,8 +226,8 @@
226 226 // 把渲染好的模版html文本追加到表格中
227 227 $('#forms .list_correctForm').html(list_correctForm);
228 228  
229   - var list_correctForm_statistics = template('list_correctForm_statistics',temp);
230   - $('#forms .list_correctForm_statistics').html(list_correctForm_statistics);
  229 + /* var list_correctForm_statistics = template('list_correctForm_statistics',temp);
  230 + $('#forms .list_correctForm_statistics').html(list_correctForm_statistics); */
231 231 });
232 232 });
233 233 });
... ...
src/main/resources/static/pages/forms/statement/scheduleDaily.html
... ... @@ -42,7 +42,7 @@
42 42 </form>
43 43 </div>
44 44 <div class="portlet-body">
45   - <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  45 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px;height: 400px">
46 46 <label>早高峰:6:31~8:30&nbsp;&nbsp;&nbsp;&nbsp;晚高峰:16:01~18:00</label>
47 47 <table class="table table-bordered table-hover table-checkable" id="forms">
48 48 <thead>
... ...
src/main/resources/static/pages/forms/statement/scheduleDailyQp.html 0 → 100644
  1 +<style type="text/css">
  2 + .table-bordered {
  3 + border: 1px solid; }
  4 + .table-bordered > thead > tr > th,
  5 + .table-bordered > thead > tr > td,
  6 + .table-bordered > tbody > tr > th,
  7 + .table-bordered > tbody > tr > td,
  8 + .table-bordered > tfoot > tr > th,
  9 + .table-bordered > tfoot > tr > td {
  10 + border: 1px solid; }
  11 + .table-bordered > thead > tr > th,
  12 + .table-bordered > thead > tr > td {
  13 + border-bottom-width: 2px; }
  14 +
  15 + .table > tbody + tbody {
  16 + border-top: 1px solid; }
  17 +</style>
  18 +
  19 +<div class="page-head">
  20 + <div class="page-title">
  21 + <h1>调度工作日报表</h1>
  22 + </div>
  23 +</div>
  24 +
  25 +<div class="row">
  26 + <div class="col-md-12">
  27 + <div class="portlet light porttlet-fit bordered">
  28 + <div class="portlet-title">
  29 + <form id="history" class="form-inline" action="">
  30 + <div style="display: inline-block; margin-left: 10px;" id="company1">
  31 + <span class="item-label" style="width: 80px;">公司: </span>
  32 + <select class="form-control" name="company" id="company" style="width: 160px;"></select>
  33 + </div>
  34 + <div style="display: inline-block; margin-left: 10px;" id="subCompany1">
  35 + <span class="item-label" style="width: 80px;">分公司: </span>
  36 + <select class="form-control" name="subCompany" id="subCompany" style="width: 160px;"></select>
  37 + </div>
  38 + <div style="display: inline-block; margin-left: 10px;">
  39 + <span class="item-label" style="width: 80px;">线路: </span>
  40 + <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  41 + </div>
  42 + <div style="display: inline-block;margin-left: 10px;">
  43 + <span class="item-label" style="width: 80px;">时间: </span>
  44 + <input class="form-control" type="text" id="date" style="width: 180px;"/>
  45 + </div>
  46 + <div class="form-group">
  47 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  48 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  49 + </div>
  50 + </form>
  51 + </div>
  52 + <div class="portlet-body" >
  53 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 506px;height: 400px">
  54 + <table class="table table-bordered table-hover table-checkable" id="forms">
  55 + <thead>
  56 + <tr >
  57 + <th style="text-align:center;vertical-align:middle;" rowspan="3">路牌</th>
  58 + <th style="text-align:center;vertical-align:middle;"
  59 + rowspan="2" colspan="2">车号</th>
  60 + <th rowspan="3">班别</th>
  61 + <th colspan="3" style="text-align:center;vertical-align:middle;">驾驶员</th>
  62 + <th colspan="3" style="text-align:center;vertical-align:middle;">售票员</th>
  63 + <th rowspan="3" style="text-align:center;vertical-align:middle;">路牌</th>
  64 + <th rowspan="3" style="text-align:center;vertical-align:middle;">记录项目</th>
  65 + <th colspan="3" style="text-align:center;vertical-align:middle;">1</th>
  66 + <th colspan="3" style="text-align:center;vertical-align:middle;">2</th>
  67 + <th colspan="3" style="text-align:center;vertical-align:middle;">3</th>
  68 + <th colspan="3" style="text-align:center;vertical-align:middle;">4</th>
  69 + <th colspan="3" style="text-align:center;vertical-align:middle;">5</th>
  70 + <th colspan="3" style="text-align:center;vertical-align:middle;">6</th>
  71 + <th colspan="3" style="text-align:center;vertical-align:middle;">7</th>
  72 + <th colspan="3" style="text-align:center;vertical-align:middle;">8</th>
  73 + <th colspan="3" style="text-align:center;vertical-align:middle;">9</th>
  74 + <th colspan="3" style="text-align:center;vertical-align:middle;">10</th>
  75 + <th colspan="3" style="text-align:center;vertical-align:middle;">11</th>
  76 + <th colspan="3" style="text-align:center;vertical-align:middle;">12</th>
  77 + <th colspan="3" style="text-align:center;vertical-align:middle;">13</th>
  78 +
  79 + </tr>
  80 + <tr>
  81 +
  82 + <th rowspan="2">职号</th>
  83 + <th colspan="2">接班时间</th>
  84 + <th rowspan="2">职号</th>
  85 + <th colspan="2">接班时间</th>
  86 + <th rowspan="2">到达</th>
  87 + <th rowspan="2">早/迟</th>
  88 + <th rowspan="2">开出</th>
  89 + <th rowspan="2">到达</th>
  90 + <th rowspan="2">早/迟</th>
  91 + <th rowspan="2">开出</th>
  92 + <th rowspan="2">到达</th>
  93 + <th rowspan="2">早/迟</th>
  94 + <th rowspan="2">开出</th>
  95 + <th rowspan="2">到达</th>
  96 + <th rowspan="2">早/迟</th>
  97 + <th rowspan="2">开出</th>
  98 + <th rowspan="2">到达</th>
  99 + <th rowspan="2">早/迟</th>
  100 + <th rowspan="2">开出</th>
  101 + <th rowspan="2">到达</th>
  102 + <th rowspan="2">早/迟</th>
  103 + <th rowspan="2">开出</th>
  104 + <th rowspan="2">到达</th>
  105 + <th rowspan="2">早/迟</th>
  106 + <th rowspan="2">开出</th>
  107 + <th rowspan="2">到达</th>
  108 + <th rowspan="2">早/迟</th>
  109 + <th rowspan="2">开出</th>
  110 + <th rowspan="2">到达</th>
  111 + <th rowspan="2">早/迟</th>
  112 + <th rowspan="2">开出</th>
  113 + <th rowspan="2">到达</th>
  114 + <th rowspan="2">早/迟</th>
  115 + <th rowspan="2">开出</th>
  116 + <th rowspan="2">到达</th>
  117 + <th rowspan="2">早/迟</th>
  118 + <th rowspan="2">开出</th>
  119 + <th rowspan="2">到达</th>
  120 + <th rowspan="2">早/迟</th>
  121 + <th rowspan="2">开出</th>
  122 + <th rowspan="2">到达</th>
  123 + <th rowspan="2">早/迟</th>
  124 + <th rowspan="2">开出</th>
  125 + </tr>
  126 + <tr>
  127 + <th>出场</th>
  128 + <th>调换</th>
  129 + <th>1</th>
  130 + <th>2</th>
  131 + <th>1</th>
  132 + <th>2</th>
  133 + </tr>
  134 + </thead>
  135 + <tbody>
  136 + <tr >
  137 + <td></td>
  138 + <td>
  139 + </td>
  140 + <td></td>
  141 + <td></td>
  142 + <td></td>
  143 + <td colspan="46">
  144 + <div>
  145 +
  146 + </div>
  147 + </td>
  148 + </tr>
  149 +
  150 + </tbody>
  151 + </table>
  152 + <div style="text-align: right;">
  153 + <ul id="pagination" class="pagination"></ul>
  154 + </div>
  155 + </div>
  156 + </div>
  157 + </div>
  158 + </div>
  159 +</div>
  160 +
  161 +<script>
  162 + $(function(){
  163 +
  164 + // 关闭左侧栏
  165 + if (!$('body').hasClass('page-sidebar-closed'))
  166 + $('.menu-toggler.sidebar-toggler').click();
  167 +
  168 + $("#date").datetimepicker({
  169 + format : 'YYYY-MM-DD',
  170 + locale : 'zh-cn'
  171 + });
  172 +
  173 + var d = new Date();
  174 + var year = d.getFullYear();
  175 + var month = d.getMonth() + 1;
  176 + var day = d.getDate();
  177 + if(month < 10)
  178 + month = "0" + month;
  179 + if(day < 10)
  180 + day = "0" + day;
  181 + $("#date").val(year + "-" + month + "-" + day);
  182 +
  183 + $.get('/basic/lineCode2Name',function(result){
  184 + var data=[];
  185 +
  186 + data.push({id: " ", text: "全部线路"});
  187 + for(var code in result){
  188 + data.push({id: code, text: result[code]});
  189 + }
  190 + initPinYinSelect2('#line',data,'');
  191 + })
  192 +
  193 + var obj = [];
  194 + $.get('/user/companyData', function(result){
  195 + obj = result;
  196 + var options = '';
  197 + for(var i = 0; i < obj.length; i++){
  198 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  199 + }
  200 + if(obj.length == 1){
  201 + $('#company1').hide();
  202 + if(obj[0].children.length == 1)
  203 + $('#subCompany1').hide();
  204 + }
  205 + $('#company').html(options);
  206 + updateCompany();
  207 + });
  208 + $("#company").on("change",updateCompany);
  209 + function updateCompany(){
  210 + var company = $('#company').val();
  211 + var options = '';
  212 + for(var i = 0; i < obj.length; i++){
  213 + if(obj[i].companyCode == company){
  214 + var children = obj[i].children;
  215 + for(var j = 0; j < children.length; j++){
  216 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  217 + }
  218 + }
  219 + }
  220 + $('#subCompany').html(options);
  221 + }
  222 +
  223 +
  224 + $("#query").on("click",jsDoQuery);
  225 +
  226 + var line = $("#line").val();
  227 + var date = $("#date").val();
  228 + var company = $("#company").val();
  229 + var subCompany = $("#subCompany").val();
  230 + function jsDoQuery(pagination){
  231 + var params = {};
  232 + line = $("#line").val();
  233 + date = $("#date").val();
  234 + company = $("#company").val();
  235 + subCompany = $("#subCompany").val();
  236 + if(line == " ")
  237 + line = "";
  238 + params['line'] = line;
  239 + params['date'] = date;
  240 + params['type'] = "query";
  241 + params['company'] = company;
  242 + params['subCompany'] = subCompany;
  243 + $(".hidden").removeClass("hidden");
  244 + /* $get('/pcpc/workDaily', params, function(result){
  245 + // 把数据填充到模版中
  246 + var tbodyHtml = template('list_workDaily',{list:result});
  247 + // 把渲染好的模版html文本追加到表格中
  248 + $('#forms tbody').html(tbodyHtml);
  249 +
  250 + }); */
  251 + }
  252 +
  253 + $("#export").on("click",function(){
  254 + $get('/pcpc/workDaily',{line:line,date:date,type:'export'},function(result){
  255 + window.open("/downloadFile/download?fileName=营运服务日报表"+moment(date).format("YYYYMMDD"));
  256 + });
  257 + });
  258 +
  259 +
  260 + });
  261 +
  262 +</script>
  263 +<script type="text/html" id="list_workDaily">
  264 + {{each list as obj i}}
  265 + <tr>
  266 + <td>{{obj.date}}</td>
  267 + <td>{{obj.line}}</td>
  268 + <td>{{obj.jhbc}}</td>
  269 + <td>{{obj.dftz}}</td>
  270 + <td>{{obj.dftzl}}</td>
  271 + <td>{{obj.ccl}}</td>
  272 + <td>{{obj.upfk}}</td>
  273 + <td>{{obj.updk}}</td>
  274 + <td>{{obj.dnfk}}</td>
  275 + <td>{{obj.dndk}}</td>
  276 + <td>{{obj.upfm}}</td>
  277 + <td>{{obj.updm}}</td>
  278 + <td>{{obj.dnfm}}</td>
  279 + <td>{{obj.dndm}}</td>
  280 + <td>{{obj.wdzs}}</td>
  281 + <td>{{obj.smbzdl}}</td>
  282 + <td>{{obj.gfbczxl}}</td>
  283 + </tr>
  284 + {{/each}}
  285 + {{if list.length == 0}}
  286 + <tr>
  287 + <td colspan="17"><h6 class="muted">没有找到相关数据</h6></td>
  288 + </tr>
  289 + {{/if}}
  290 +</script>
... ...
src/main/resources/static/pages/forms/statement/timeAndSpeed.html
... ... @@ -16,6 +16,13 @@
16 16 #forms > tbody > tr{
17 17 background-color: #FFFFFF;
18 18 }
  19 + #works > tbody > tr{
  20 + background-color: #FFFFFF;
  21 + }
  22 + tbody > tr > td{
  23 + text-align: center;
  24 + vertical-align: middle;
  25 + }
19 26 </style>
20 27  
21 28 <div class="page-head">
... ... @@ -37,16 +44,23 @@
37 44 <span class="item-label" style="width: 80px;">分公司: </span>
38 45 <select class="form-control" name="subCompany" id="subCompany" style="width: 140px;"></select>
39 46 </div>
40   - <div style="display: inline-block; margin-left: 24px;">
  47 + <div style="display: inline-block; margin-left: 10px;">
41 48 <span class="item-label" style="width: 80px;">线路: </span>
42   - <select class="form-control" name="line" id="line" style="width: 140px;"></select>
43   - </div>
44   - <div style="display: inline-block; margin-left: 8px;">
45   - <span class="item-label" style="width: 80px;">方向: </span>
46   - <select class="form-control" name="upDown" id="upDown" style="width: 140px;">
47   - <option value="">请先选择线路</option>
  49 + <select class="form-control" name="statu" id="statu" style="width: 140px;">
  50 + <option value="0">多线</option>
  51 + <option value="1">单线</option>
48 52 </select>
49 53 </div>
  54 + <div style="display: inline-block; margin-left: 0px;" id="line1">
  55 + <span class="item-label" style="width: 80px;"> - </span>
  56 + <select class="form-control" name="line" id="line" style="width: 140px;"/>
  57 + </div>
  58 +<!-- <div style="display: inline-block; margin-left: 8px;"> -->
  59 +<!-- <span class="item-label" style="width: 80px;">方向: </span> -->
  60 +<!-- <select class="form-control" name="upDown" id="upDown" style="width: 140px;"> -->
  61 +<!-- <option value="">请先选择线路</option> -->
  62 +<!-- </select> -->
  63 +<!-- </div> -->
50 64 <div style="display: inline-block; margin-left: 10px">
51 65 <span class="item-label" style="width: 80px;">时刻类型: </span>
52 66 <select class="form-control" name="model" id="model" style="width: 165px;">
... ... @@ -62,15 +76,11 @@
62 76 <span class="item-label" style="width: 80px;">结束时间: </span>
63 77 <input class="form-control" type="text" id="endDate" style="width: 140px;"/>
64 78 </div>
65   - <div style="display: inline-block; margin-left: 10px;">
66   - <span class="item-label" style="width: 80px;">时间段: </span>
67   - <input class="form-control" type="text" id="times1" style="width: 60px;"/>
  79 + <div style="display: inline-block; margin-left: 10px" id="lp1">
  80 + <span class="item-label" style="width: 80px;">路牌: </span>
  81 + <select class="form-control" name="lp" id="lp" style="width: 140px;"></select>
68 82 </div>
69   - <div style="display: inline-block;">
70   - <span class="item-label" style="width: 80px;"> - </span>
71   - <input class="form-control" type="text" id="times2" style="width: 60px;"/>
72   - </div>
73   - <div class="form-group" style="margin-left: 10px">
  83 + <div class="form-group" style="margin-left: 14px">
74 84 <input class="btn btn-default" type="button" id="query" value="筛选"/>
75 85 <!-- <input class="btn btn-default" type="button" id="export" value="导出"/> -->
76 86 </div>
... ... @@ -79,26 +89,20 @@
79 89 <div class="portlet-body">
80 90 <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
81 91 <table class="table table-bordered table-hover table-checkable" id="forms">
82   - <thead>
83   - <tr class="hidden">
84   - <th>日期</th>
85   - <th>时段</th>
86   - <th>公司</th>
87   - <th>分公司</th>
88   - <th>线路</th>
89   - <th>路牌</th>
90   - <th>起讫站</th>
91   - <th>行驶方向</th>
92   - <th>营运时间(小时/分钟)</th>
93   - <th>营运车速(公里/小时)</th>
94   - <th>运送时间(小时/分钟)</th>
95   - <th>运送车速(公里/小时)</th>
96   - </tr>
97   - </thead>
98   - <tbody>
99   -
100   - </tbody>
101 92 </table>
  93 + <div id="works_hidden" class="hidden">
  94 + <span class="item-label" style="width: 80px;margin-left: 20px;">明细: </span>
  95 + <span class="item-label" style="width: 80px;margin-left: 60px;">日期: </span>
  96 + <span class="item-label" style="width: 80px;" id="date0"></span>
  97 + <span class="item-label" style="width: 80px;margin-left: 60px;">公司: </span>
  98 + <span class="item-label" style="width: 80px;" id="company0"></span>
  99 + <span class="item-label" style="width: 80px;margin-left: 60px;">分公司: </span>
  100 + <span class="item-label" style="width: 80px;" id="subCompany0"></span>
  101 + <span class="item-label" style="width: 80px;margin-left: 60px;">线路: </span>
  102 + <span class="item-label" style="width: 80px;" id="line0"></span>
  103 + <table class="table table-bordered table-hover table-checkable" id="works">
  104 + </table>
  105 + </div>
102 106 <div style="text-align: right;">
103 107 <ul id="pagination" class="pagination"></ul>
104 108 </div>
... ... @@ -110,7 +114,7 @@
110 114  
111 115 <script>
112 116 $(function(){
113   -
  117 +
114 118 // 关闭左侧栏
115 119 if (!$('body').hasClass('page-sidebar-closed'))
116 120 $('.menu-toggler.sidebar-toggler').click();
... ... @@ -123,15 +127,7 @@
123 127 format : 'YYYY-MM-DD',
124 128 locale : 'zh-cn'
125 129 });
126   - $("#times1").datetimepicker({
127   - format : 'HH:mm',
128   - locale : 'zh-cn'
129   - });
130   - $("#times2").datetimepicker({
131   - format : 'HH:mm',
132   - locale : 'zh-cn'
133   - });
134   -
  130 +
135 131 var d = new Date();
136 132 var year = d.getFullYear();
137 133 var month = d.getMonth() + 1;
... ... @@ -142,10 +138,7 @@
142 138 day = "0" + day;
143 139 $("#startDate").val(year + "-" + month + "-" + day);
144 140 $("#endDate").val(year + "-" + month + "-" + day);
145   -
146   - $("#times1").val("06:00");
147   - $("#times2").val("07:00");
148   -
  141 +
149 142 var obj = [];
150 143 $.get('/user/companyData', function(result){
151 144 obj = result;
... ... @@ -179,71 +172,83 @@
179 172 $.get('/basic/lineCode2Name',function(result){
180 173 var data=[];
181 174  
182   - data.push({id: " ", text: "全部线路"});
183 175 for(var code in result){
184 176 data.push({id: code, text: result[code]});
185 177 }
186 178 console.log(data);
187 179 initPinYinSelect2('#line',data,'');
188 180  
189   - line = "";
190   - updateModel();
  181 + line = data[0].id;
191 182  
192   - var params = {};
193   - params['line'] = line;
194   - $get('/busInterval/getDir', params, function(result){
195   - dirData = createTreeData(result);
196   - var options = '<option value="">全部方向</option>';;
197   - $.each(dirData, function(i, g){
198   - options += '<option value="'+g.name+'">'+g.name+'</option>';
199   - });
200   - $('#upDown').html(options);
201   - });
  183 + updateModel();
  184 + updateLp("");
202 185 })
203 186  
204 187 $("#query").on("click", function (){
205 188 jsDoQuery();
206 189 });
207   -
  190 +
  191 + var list = [];
208 192 var line = $("#line").val();
  193 + var statu = $("#statu").val();
209 194 var startDate = $("#startDate").val();
210 195 var endDate = $("#endDate").val();
211 196 var model = $("#model").val();
212   - var times = $("#times1").val() + "-" + $("#times2").val();
213   - var upDown = $("#upDown").val();
214 197 var company = $("#company").val();
215 198 var subCompany = $("#subCompany").val();
  199 + var lp = $("#lp").val();
216 200 function jsDoQuery(pagination){
217 201 var params = {};
218   -// line = $("#line").val();
  202 + line = $("#line").val();
219 203 startDate = $("#startDate").val();
220 204 endDate = $("#endDate").val();
221 205 model = $("#model").val();
222   - times = $("#times1").val() + "-" + $("#times2").val();
223   - upDown = $("#upDown").val();
224 206 company = $("#company").val();
225 207 subCompany = $("#subCompany").val();
  208 + lp = $("#lp").val();
  209 + params['lp'] = lp;
226 210 params['line'] = line;
  211 + params['statu'] = statu;
227 212 params['startDate'] = startDate;
228 213 params['endDate'] = endDate;
229 214 params['model'] = model;
230   - params['times'] = times;
231   - params['upDown'] = upDown;
232 215 params['company'] = company;
233 216 params['subCompany'] = subCompany;
234 217 params['type'] = "query";
235   - $(".hidden").removeClass("hidden");
  218 +// $(".hidden").removeClass("hidden");
236 219 $get('/busInterval/timeAndSpeed', params, function(result){
237 220 // 把数据填充到模版中
238   - var tbodyHtml = template('list_timeAndSpeed',{list:result});
  221 + var tbodyHtml = template('list_timeAndSpeed', {list:result});
239 222 // 把渲染好的模版html文本追加到表格中
240   - $('#forms tbody').html(tbodyHtml);
241   - _w_table_rowspan("#forms tbody", 1);
242   - _w_table_rowspan("#forms tbody", 2);
243   - _w_table_rowspan("#forms tbody", 3);
244   - _w_table_rowspan("#forms tbody", 4);
245   - _w_table_rowspan("#forms tbody", 5);
246   -
  223 + $('#forms').html(tbodyHtml);
  224 + list = result;
  225 + $("#works_hidden").addClass("hidden");
  226 +
  227 + _w_table_rowspan("#forms", 1);
  228 + _w_table_rowspan("#forms", 2);
  229 + _w_table_rowspan("#forms", 3);
  230 + _w_table_rowspan("#forms", 4);
  231 +
  232 + if(result.statu == 0)
  233 + $("#forms tbody").on("click", "a", function(){
  234 + var key = $(this).parent().prev().html();
  235 + $.each(list.dataList, function(i, g){
  236 + if(g.line == key){
  237 + var tbodyHtml = template('list_workList',{list:g});
  238 + $("#works_hidden").removeClass("hidden");
  239 + $("#date0").html(g.date);
  240 + $("#line0").html(g.line);
  241 + $("#company0").html(g.company);
  242 + $("#subCompany0").html(g.subCompany);
  243 + $("#works").html(tbodyHtml);
  244 +
  245 + _w_table_rowspan("#works", 1);
  246 + _w_table_rowspan("#works", 2);
  247 + _w_table_rowspan("#works", 3);
  248 + _w_table_rowspan("#works", 4);
  249 + }
  250 + });
  251 + });
247 252 });
248 253 }
249 254  
... ... @@ -254,21 +259,28 @@
254 259 // });
255 260  
256 261  
  262 + $("#lp1").hide();
  263 + $("#line1").hide();
  264 + $("#statu").on("change", function(){
  265 + statu = $("#statu").val();
  266 + if(statu == 0){
  267 + $("#line1").hide();
  268 + $("#lp1").hide();
  269 + }else{
  270 + $("#line1").show();
  271 + $("#lp1").show();
  272 + updateLp("");
  273 + }
  274 + updateModel();
  275 + });
257 276 $("#line").on("change", function(){
258 277 line = $("#line").val();
259   - if(line == " ")
260   - line = "";
261 278 updateModel();
262   - var params = {};
263   - params['line'] = line;
264   - $get('/busInterval/getDir', params, function(result){
265   - dirData = createTreeData(result);
266   - var options = '<option value="">全部方向</option>';
267   - $.each(dirData, function(i, g){
268   - options += '<option value="'+g.name+'">'+g.name+'</option>';
269   - });
270   - $('#upDown').html(options);
271   - });
  279 + updateLp("");
  280 + });
  281 + $("#model").on("change", function(){
  282 + model = $("#model").val();
  283 + updateLp(model);
272 284 });
273 285 $('#startDate').on("blur", function(){
274 286 startDate = $("#startDate").val();
... ... @@ -288,7 +300,10 @@
288 300 flag = 1;
289 301 var treeData = [];
290 302 var params = {};
291   - params['line'] = line;
  303 + if(statu == 0)
  304 + params['line'] = "";
  305 + if(statu == 1)
  306 + params['line'] = line;
292 307 params['startDate'] = startDate;
293 308 params['endDate'] = endDate;
294 309 $get('/pcpc/getModel', params, function(result){
... ... @@ -297,11 +312,26 @@
297 312 $.each(treeData, function(i, g){
298 313 options += '<option value="'+g.id+'">'+g.name+'</option>';
299 314 });
300   - $('#model').html(options)/* .select2() */;
  315 + $('#model').html(options);
301 316 flag = 0;
302 317 });
303 318 }
304 319  
  320 + function updateLp(ttId){
  321 + var treeData = [];
  322 + var params = {};
  323 + params['line'] = line;
  324 + params['ttId'] = ttId;
  325 + $get('/busInterval/getLp', params, function(result){
  326 + treeData = createTreeData(result);
  327 + var options = '<option value="">全部路牌</option>';
  328 + $.each(treeData, function(i, g){
  329 +// options += '<option value="'+g.id+'">'+g.name+'</option>';
  330 + options += '<option value="'+g.name+'">'+g.name+'</option>';
  331 + });
  332 + $('#lp').html(options);
  333 + });
  334 + }
305 335  
306 336 function _w_table_rowspan(_w_table_id, _w_table_colnum){
307 337 _w_table_firsttd = "";
... ... @@ -330,35 +360,118 @@
330 360 });
331 361  
332 362 </script>
  363 +
333 364 <script type="text/html" id="list_timeAndSpeed">
334   - {{each list.dateList as obj i}}
  365 +<thead>
  366 + <tr>
  367 + <th width='80px'>日期</th>
  368 + <th style='text-align:center;'>公司</th>
  369 + <th style='text-align:center;'>分公司</th>
  370 + <th style='text-align:center;'>线路</th>
  371 + {{if list.statu == 0}}<th style='text-align:center;'>路牌数</th>{{/if}}
  372 + {{if list.statu == 1}}<th style='text-align:center;'>路牌</th>{{/if}}
  373 + <th>计划营运时间(小时)</th>
  374 + <th>计划营运车速(公里/小时)</th>
  375 + <th>实际营运时间(小时)</th>
  376 + <th>实际营运车速(公里/小时)</th>
  377 + <th>计划运送时间(小时)</th>
  378 + <th>计划运送车速(公里/小时)</th>
  379 + <th>实际运送时间(小时)</th>
  380 + <th>实际运送车速(公里/小时)</th>
  381 + </tr>
  382 +</thead>
  383 +<tbody>
  384 + {{each list.dataList as obj i}}
  385 + <tr>
  386 + <td style='vertical-align:middle;'>{{obj.date}}</td>
  387 + <td style='vertical-align:middle;'>{{obj.company}}</td>
  388 + <td style='vertical-align:middle;'>{{obj.subCompany}}</td>
  389 + <td style='vertical-align:middle;'>{{obj.line}}</td>
  390 + {{if list.statu == 0}}<td><a>{{obj.lp}}</a></td>{{/if}}
  391 + {{if list.statu == 1}}<td>{{obj.lp}}</td>{{/if}}
  392 + <td>{{obj.jhyysj}}</td>
  393 + <td>{{obj.jhyycs}}</td>
  394 + <td>{{obj.sjyysj}}</td>
  395 + <td>{{obj.sjyycs}}</td>
  396 + <td>{{obj.jhyssj}}</td>
  397 + <td>{{obj.jhyscs}}</td>
  398 + <td>{{obj.sjyssj}}</td>
  399 + <td>{{obj.sjyscs}}</td>
  400 + </tr>
  401 + {{/each}}
  402 + {{if list.dataList.length > 1}}
  403 + <tr>
  404 + <td style='vertical-align:middle;' colspan='5'>合计平均值</td>
  405 + <td>{{list.jhyysj}}</td>
  406 + <td>{{list.jhyycs}}</td>
  407 + <td>{{list.sjyysj}}</td>
  408 + <td>{{list.sjyycs}}</td>
  409 + <td>{{list.jhyssj}}</td>
  410 + <td>{{list.jhyscs}}</td>
  411 + <td>{{list.sjyssj}}</td>
  412 + <td>{{list.sjyscs}}</td>
  413 + </tr>
  414 + {{/if}}
  415 + {{if list.dataList.length == 0}}
  416 + <tr>
  417 + <td colspan="13"><h6 class="muted">没有找到相关数据</h6></td>
  418 + </tr>
  419 + {{/if}}
  420 +</tbody>
  421 +</script>
  422 +<script type="text/html" id="list_workList">
  423 +<thead>
  424 + <tr>
  425 + <th width='80px'>日期</th>
  426 + <th style='text-align:center;'>公司</th>
  427 + <th style='text-align:center;'>分公司</th>
  428 + <th style='text-align:center;'>线路</th>
  429 + <th style='text-align:center;'>路牌</th>
  430 + <th>计划营运时间(小时)</th>
  431 + <th>计划营运车速(公里/小时)</th>
  432 + <th>实际营运时间(小时)</th>
  433 + <th>实际营运车速(公里/小时)</th>
  434 + <th>计划运送时间(小时)</th>
  435 + <th>计划运送车速(公里/小时)</th>
  436 + <th>实际运送时间(小时)</th>
  437 + <th>实际运送车速(公里/小时)</th>
  438 + </tr>
  439 +</thead>
  440 +<tbody>
  441 + {{each list.work as obj i}}
335 442 <tr>
336   - <td style='text-align:center;vertical-align:middle;'>{{obj.date}}</td>
337   - <td style='text-align:center;vertical-align:middle;'>{{obj.times}}</td>
338   - <td style='text-align:center;vertical-align:middle;'>{{obj.company}}</td>
339   - <td style='text-align:center;vertical-align:middle;'>{{obj.subCompany}}</td>
340   - <td style='text-align:center;vertical-align:middle;'>{{obj.line}}</td>
  443 + <td style='vertical-align:middle;'>{{obj.date}}</td>
  444 + <td style='vertical-align:middle;'>{{obj.company}}</td>
  445 + <td style='vertical-align:middle;'>{{obj.subCompany}}</td>
  446 + <td style='vertical-align:middle;'>{{obj.line}}</td>
341 447 <td>{{obj.lp}}</td>
342   - <td>{{obj.qdz_zdz}}</td>
343   - <td>{{obj.zdz}}</td>
344   - <td>{{obj.yysj}}</td>
345   - <td>{{obj.yysd}}</td>
346   - <td>{{obj.yssj}}</td>
347   - <td>{{obj.yssd}}</td>
  448 + <td>{{obj.jhyysj}}</td>
  449 + <td>{{obj.jhyycs}}</td>
  450 + <td>{{obj.sjyysj}}</td>
  451 + <td>{{obj.sjyycs}}</td>
  452 + <td>{{obj.jhyssj}}</td>
  453 + <td>{{obj.jhyscs}}</td>
  454 + <td>{{obj.sjyssj}}</td>
  455 + <td>{{obj.sjyscs}}</td>
348 456 </tr>
349 457 {{/each}}
350   - {{if list.dateList.length != 0}}
  458 + {{if list.work.length > 1}}
351 459 <tr>
352   - <td colspan="8">汇总平均</td>
353   - <td>{{list.yysj}}</td>
354   - <td>{{list.yysd}}</td>
355   - <td>{{list.yssj}}</td>
356   - <td>{{list.yssd}}</td>
  460 + <td style='vertical-align:middle;' colspan='5'>合计平均值</td>
  461 + <td>{{list.jhyysj}}</td>
  462 + <td>{{list.jhyycs}}</td>
  463 + <td>{{list.sjyysj}}</td>
  464 + <td>{{list.sjyycs}}</td>
  465 + <td>{{list.jhyssj}}</td>
  466 + <td>{{list.jhyscs}}</td>
  467 + <td>{{list.sjyssj}}</td>
  468 + <td>{{list.sjyscs}}</td>
357 469 </tr>
358 470 {{/if}}
359   - {{if list.dateList.length == 0}}
  471 + {{if list.work.length == 0}}
360 472 <tr>
361   - <td colspan="12"><h6 class="muted">没有找到相关数据</h6></td>
  473 + <td colspan="13"><h6 class="muted">没有找到相关数据</h6></td>
362 474 </tr>
363 475 {{/if}}
  476 +</tbody>
364 477 </script>
365 478 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/statement/waybill.html
... ... @@ -152,7 +152,7 @@
152 152 var line = $("#line").val();
153 153 date = $("#date").val();
154 154 $(".hidden").removeClass("hidden");
155   - $get('/realSchedule/queryUserInfo',{line:line,date:date},function(result){
  155 + $get('/realSchedule/queryUserInfo',{line:line,date:date,state:2},function(result){
156 156 // 把数据填充到模版中
157 157 var tbodyHtml = template('list_info',{list:result});
158 158 // 把渲染好的模版html文本追加到表格中
... ...
src/main/resources/static/pages/forms/statement/waybillQp.html
... ... @@ -152,7 +152,7 @@
152 152 var line = $("#line").val();
153 153 date = $("#date").val();
154 154 $(".hidden").removeClass("hidden");
155   - $get('/realSchedule/queryUserInfo',{line:line,date:date},function(result){
  155 + $get('/realSchedule/queryUserInfo',{line:line,date:date,state:3},function(result){
156 156 // 把数据填充到模版中
157 157 var tbodyHtml = template('list_info',{list:result});
158 158 // 把渲染好的模版html文本追加到表格中
... ...
src/main/resources/static/pages/oil/list.html
... ... @@ -330,7 +330,6 @@
330 330 $('tr.filter .filter-submit').on('click', function () {
331 331 var ylbGsdm=$("#ylbListGsdmId").val();
332 332 var ylbFgsdm=$("#ylbListFgsdmId").val();
333   - console.log();
334 333 if ($("#rq").val() == "" || $("#rq").val() ==null){
335 334 layer.msg('请选择日期.');
336 335 }else if(ylbGsdm=="" || ylbGsdm==null || ylbFgsdm=="" ||ylbFgsdm==null){
... ...
src/main/resources/static/pages/oil/list_ph.html 0 → 100644
  1 +<div class="page-head">
  2 + <div class="page-title">
  3 + <h1>进出场存油量</h1>
  4 + </div>
  5 +</div>
  6 +
  7 +<ul class="page-breadcrumb breadcrumb">
  8 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  9 + <li><span class="active">用油管理</span> <i class="fa fa-circle"></i></li>
  10 + <li><span class="active">进出场存油量</span></li>
  11 +</ul>
  12 +
  13 +<div class="row" id="ll_oil_list">
  14 + <div class="col-md-12">
  15 + <!-- Begin: life time stats -->
  16 + <div class="portlet light portlet-fit portlet-datatable bordered">
  17 + <div class="portlet-title">
  18 + <div class="caption">
  19 + <i class="fa fa-fire-extinguisher"></i> <span
  20 + class="caption-subject font-dark sbold uppercase">进出场存油量表</span>
  21 + </div>
  22 + <div class="actions">
  23 + <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加</a>
  24 + <!-- <button type="button" class="btn btn-circle blue" id="removeButton"><i class="fa fa-trash-o"></i> 删除</button> -->
  25 + <button type="button" class="btn btn-circle blue" id="sortButton"><i class="fa fa-minus-square"></i>
  26 + 拆分/保存
  27 + </button>
  28 + <!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> 删除用户</button> -->
  29 + <div class="btn-group">
  30 + <a class="btn red btn-outline btn-circle" href="javascript:;"
  31 + data-toggle="dropdown"> <i class="fa fa-share"></i> <span
  32 + class="hidden-xs"> 系统工具 </span> <i class="fa fa-angle-down"></i>
  33 + </a>
  34 + <ul class="dropdown-menu pull-right" id="datatable_ajax_tools">
  35 + <li><a href="javascript:;" data-action="0"
  36 + class="tool-action" id="obtain"> <i class="fa fa-hourglass-half"></i> 获取加/存油信息
  37 + </a></li>
  38 + <li><a href="javascript:;" data-action="1"
  39 + class="tool-action" id="outAndIn"> <i class="fa fa-pencil"></i> 油耗计算(进场=出场)
  40 + </a></li>
  41 + <li><a href="javascript:;" id="checkYl" data-action="3"
  42 + class="tool-action"> <i class="fa fa-gg-circle"></i>
  43 + 核对加注量(有加油无里程)
  44 + </a></li>
  45 + <li class="divider"></li>
  46 + <li><a href="javascript:;" data-action="3"
  47 + class="tool-action" id="export"> <i class="fa fa-file-excel-o"></i>
  48 + 导出Excel
  49 + </a></li>
  50 + </ul>
  51 + </div>
  52 + </div>
  53 + </div>
  54 + <div class="portlet-body">
  55 + <div class="table-container" style="margin-top: 10px">
  56 + <table
  57 + class="table table-striped table-bordered table-hover table-checkable"
  58 + id="datatable_ylb">
  59 + <thead>
  60 + <tr role="row" class="filter">
  61 + <td> 公司:</td>
  62 + <td colspan="2">
  63 +
  64 + <select class="form-control" name="ssgsdm_like" id="ylbListGsdmId" ></select>
  65 +
  66 + </td>
  67 + <td>
  68 + 分公司:
  69 + </td>
  70 + <td colspan="2">
  71 +
  72 + <select class="form-control" name="fgsdm_like" id="ylbListFgsdmId" ></select>
  73 + </td>
  74 +
  75 + <td>
  76 + 日期:
  77 + </td>
  78 + <td>
  79 + <input type="text" style="width: 80px" name="rq" id="rq"/>
  80 + </td>
  81 + <td >
  82 + 线路:
  83 + </td>
  84 + <td colspan="3">
  85 + <select class="form-control" name="xlbm_eq" id="xlbm" style="width: 120px;"></select>
  86 + &nbsp;
  87 + </td>
  88 + <td >
  89 + 内部编码:
  90 + </td>
  91 + <td colspan="3">
  92 + <select class="form-control" name="nbbm_eq" id="nbbm" style="width: 120px;"></select>
  93 + </td>
  94 + <td colspan="4">
  95 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right:0px">
  96 + <i class="fa fa-search"></i> 搜索
  97 + </button>
  98 +
  99 + <button class="btn btn-sm red btn-outline filter-cancel" style="margin-right:0px">
  100 + <i class="fa fa-times"></i> 重置
  101 + </button>
  102 +
  103 + </td>
  104 + </tr>
  105 + <tr role="row" class="heading">
  106 + <th width="2%">#</th>
  107 + <th width="8%">日期</th>
  108 + <th width="5%">公司</th>
  109 + <th width="8%">线路</th>
  110 + <th width="5%">自编号</th>
  111 + <th width="6%">驾驶员</th>
  112 + <th width="4%">加油量</th>
  113 + <th width="5%">出场公里</th>
  114 + <th width="4%">进场公里</th>
  115 + <th width="4%">出场存油</th>
  116 + <th width="4%">进场存油</th>
  117 + <th width="5%">油耗</th>
  118 + <th width="5%">燃油类型</th>
  119 + <th width="4%">尿素</th>
  120 + <th width="5%">耗损原因</th>
  121 + <th width="5%">耗损油量</th>
  122 + <th width="5%">当日总里程</th>
  123 + <th width="5%">数据类型</th>
  124 + <th width="5%">百公里油耗</th>
  125 + <!-- <th width="5%">操作</th> -->
  126 + </tr>
  127 + </thead>
  128 + <tbody></tbody>
  129 + </table>
  130 + <div style="text-align: right;">
  131 + <ul id="pagination" class="pagination"></ul>
  132 + </div>
  133 + </div>
  134 + </div>
  135 + </div>
  136 + </div>
  137 +</div>
  138 +
  139 +<script id="ylb_list_temp" type="text/html">
  140 + {{each list as obj i}}
  141 + <tr>
  142 + <td style="vertical-align: middle;">
  143 + <input type="radio" name="id" class="group-checkable icheck" data-id="{{obj.id}}">
  144 + </td>
  145 +
  146 + <td>
  147 + {{obj.rq}}
  148 + </td>
  149 + <td>
  150 + {{obj.gsname}}
  151 + </td>
  152 + <td>
  153 + {{obj.xlname}}
  154 + </td>
  155 + <td>
  156 + {{obj.nbbm}}
  157 + </td>
  158 + <td>
  159 + {{obj.jsy}}
  160 + </td>
  161 + <td>
  162 + {{obj.jzl}}
  163 + </td>
  164 + <td>
  165 + {{obj.czlc}}
  166 + </td>
  167 + <td>
  168 + {{obj.jzlc}}
  169 + </td>
  170 + <td>
  171 + {{obj.czyl}}
  172 + </td>
  173 + <td>
  174 + <a data-id="{{obj.id}}" href="javascript:;" class="in_carpark_jzyl">
  175 + {{obj.jzyl}}
  176 + </a>
  177 + </td>
  178 + <td>
  179 + {{obj.yh}}
  180 + </td>
  181 + <td>
  182 + {{obj.rylx}}
  183 + </td>
  184 + <td>
  185 + {{obj.ns}}
  186 + </td>
  187 + <td>
  188 + {{obj.shyy}}
  189 + </td>
  190 + <td>
  191 + {{obj.sh}}
  192 + </td>
  193 + <td>
  194 + {{obj.zlc}}
  195 + </td>
  196 + <td>
  197 + {{obj.yhlx}}
  198 + </td>
  199 + <td>
  200 + {{obj.bglyh}}
  201 + </td>
  202 + <td>
  203 + <!--<a class="btn btn-sm blue btn-outline" href="edit.html?no={{obj.id}}" data-pjax><i class="fa fa-edit"></i> 编辑</a>-->
  204 + </td>
  205 + </tr>
  206 + {{/each}}
  207 + {{if list.length == 0}}
  208 + <tr>
  209 + <td colspan=20><h6 class="muted">没有找到相关数据</h6></td>
  210 + </tr>
  211 + {{/if}}
  212 +</script>
  213 +
  214 +<script>
  215 + $(function () {
  216 + //var id = 15;
  217 + //$('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list')
  218 +
  219 + $("#checkYl").on('click', function () {
  220 + console.log("核对加注量");
  221 + if ($("#rq").val() != "") {
  222 + var cells = $('tr.filter')[0].cells
  223 + , params = {}
  224 + , name;
  225 + $.each(cells, function (i, cell) {
  226 + var items = $('input,select', cell);
  227 + for (var j = 0, item; item = items[j++];) {
  228 + name = $(item).attr('name');
  229 + if (name) {
  230 + params[name] = $(item).val();
  231 + }
  232 + }
  233 + });
  234 + $get('/ylb/checkYl', params, function () {
  235 + jsDoQuery(null, true);
  236 + });
  237 + } else {
  238 + layer.msg('请选择日期.');
  239 + }
  240 + })
  241 +
  242 + //进场等于出场
  243 + $("#outAndIn").on('click', function () {
  244 + console.log("进场油量等于出场油量");
  245 + if ($("#rq").val() != "") {
  246 + var cells = $('tr.filter')[0].cells
  247 + , params = {}
  248 + , name;
  249 + $.each(cells, function (i, cell) {
  250 + var items = $('input,select', cell);
  251 + for (var j = 0, item; item = items[j++];) {
  252 + name = $(item).attr('name');
  253 + if (name) {
  254 + params[name] = $(item).val();
  255 + }
  256 + }
  257 + });
  258 + $get('/ylb/outAndIn', params, function () {
  259 + jsDoQuery(null, true);
  260 + });
  261 + } else {
  262 + layer.msg('请选择日期.');
  263 + }
  264 + })
  265 + //拆分
  266 + $("#sortButton").on('click', function () {
  267 + if ($("#rq").val() != "") {
  268 + var id = $('input.icheck:checked').data('id');
  269 +
  270 + if (typeof(id) == 'undefined') {
  271 + layer.msg("请选择一行进行拆分");
  272 + } else {
  273 + //获取输入的进场存油
  274 + var jzyl = $('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list').html();
  275 + // $("#jzyl" + id).html();
  276 + console.log(jzyl);
  277 + var params = {};
  278 + params['jzyl'] = jzyl;
  279 + params['id'] = id;
  280 + $get('/ylb/sort', params, function () {
  281 + jsDoQuery(null, true);
  282 + });
  283 +
  284 + }
  285 + } else {
  286 + layer.msg('请选择日期.');
  287 + }
  288 + })
  289 + //获取加存信息
  290 + $("#obtain").on('click', function () {
  291 + console.log("获取加存");
  292 + if ($("#rq").val() != "") {
  293 + var cells = $('tr.filter')[0].cells
  294 + , params = {}
  295 + , name;
  296 + $.each(cells, function (i, cell) {
  297 + var items = $('input,select', cell);
  298 + for (var j = 0, item; item = items[j++];) {
  299 + name = $(item).attr('name');
  300 + if (name) {
  301 + params[name] = $(item).val();
  302 + }
  303 + }
  304 + });
  305 + $get('/ylb/obtain', params, function () {
  306 + jsDoQuery(params, true);
  307 + });
  308 + } else {
  309 + layer.msg('请选择日期.');
  310 + }
  311 +
  312 + })
  313 + $("#rq").datetimepicker({
  314 + format: 'YYYY-MM-DD',
  315 + locale: 'zh-cn'
  316 + });
  317 +
  318 + var page = 0, initPagination;
  319 + var icheckOptions = {
  320 + radioClass: 'iradio_square-blue icheck',
  321 + increaseArea: '20%'
  322 + }
  323 +
  324 + //重置
  325 + $('tr.filter .filter-cancel').on('click', function () {
  326 + $('tr.filter input, select').val('').change();
  327 + });
  328 +
  329 + //提交
  330 + $('tr.filter .filter-submit').on('click', function () {
  331 + var ylbGsdm=$("#ylbListGsdmId").val();
  332 + var ylbFgsdm=$("#ylbListFgsdmId").val();
  333 + if ($("#rq").val() == "" || $("#rq").val() ==null){
  334 + layer.msg('请选择日期.');
  335 + }else if(ylbGsdm=="" || ylbGsdm==null || ylbFgsdm=="" ||ylbFgsdm==null){
  336 + layer.msg('请选择公司和分公司.');
  337 + }else {
  338 + var cells = $('tr.filter')[0].cells
  339 + , params = {}
  340 + , name;
  341 + $.each(cells, function (i, cell) {
  342 + var items = $('input,select', cell);
  343 + for (var j = 0, item; item = items[j++];) {
  344 + name = $(item).attr('name');
  345 + if (name) {
  346 + params[name] = $(item).val();
  347 + }
  348 + }
  349 + });
  350 + page = 0;
  351 + jsDoQuery(params, true);
  352 + }
  353 + });
  354 +
  355 +
  356 +// var gsqxdm="";
  357 +
  358 +
  359 + $.get('/user/companyData', function(result){
  360 + obj = result;
  361 + var options="";
  362 +// = '<option value="">请选择</option>';
  363 + for(var i = 0; i < obj.length; i++){
  364 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  365 +// setFgsqx(obj[i].companyCode);
  366 + }
  367 + $('#ylbListGsdmId').html(options);
  368 + updateCompany();
  369 + });
  370 + /* function setFgsqx(gs){
  371 + var company =gs
  372 + var options = '';
  373 + for(var i = 0; i < obj.length; i++){
  374 + if(obj[i].companyCode == company){
  375 + var children = obj[i].children;
  376 + for(var j = 0; j < children.length; j++){
  377 + gsqxdm +=company+""+children[j].code+",";
  378 + }
  379 + }
  380 + }
  381 + } */
  382 + $("#ylbListGsdmId").on("change",updateCompany);
  383 + function updateCompany(){
  384 + var company = $('#ylbListGsdmId').val();
  385 + var options ="";
  386 +// = '<option value="">请选择</option>';
  387 + for(var i = 0; i < obj.length; i++){
  388 + if(obj[i].companyCode == company){
  389 + var children = obj[i].children;
  390 + for(var j = 0; j < children.length; j++){
  391 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  392 + }
  393 + }
  394 + }
  395 + $('#ylbListFgsdmId').html(options);
  396 + }
  397 + /*
  398 + * 获取数据 p: 要提交的参数, pagination: 是否重新分页
  399 + */
  400 + function jsDoQuery(p, pagination) {
  401 + var params = {};
  402 + if (p)
  403 + params = p;
  404 + //更新时间排序
  405 + params['order'] = 'nbbm';
  406 + params['page'] = page;
  407 + params['rq'] = $("#rq").val();
  408 +
  409 + /* var ylbGsdm=$("#ylbListGsdmId").val();
  410 + var ylbFgsdm=$("#ylbListFgsdmId").val();
  411 + if(ylbGsdm==''|| ylbGsdm==null){
  412 + params['concat(ssgsdm,fgsdm)_in']=gsqxdm;
  413 + }else{
  414 + if(ylbFgsdm==''||ylbFgsdm==null){
  415 + var fgsqx1='';
  416 + for(var i = 0; i < obj.length; i++){
  417 + if(obj[i].companyCode == ylbGsdm){
  418 + var children = obj[i].children;
  419 + for(var j = 0; j < children.length; j++){
  420 + fgsqx1 +=children[j].code+",";
  421 + }
  422 + }
  423 + }
  424 + params['fgsdm_in']=fgsqx1;
  425 + }
  426 + } */
  427 + var i = layer.load(2);
  428 + $get('/ylb', params, function (data) {
  429 + $.each(data.content, function (i, obj) {
  430 + obj.rq = moment(obj.rq).format("YYYY-MM-DD");
  431 + });
  432 + var bodyHtm = template('ylb_list_temp', {list: data.content});
  433 +
  434 + $('#datatable_ylb tbody').html(bodyHtm)
  435 + .find('.icheck').iCheck(icheckOptions)
  436 + .on('ifChanged', iCheckChange);
  437 + if (pagination && data.content.length > 0) {
  438 + //重新分页
  439 + initPagination = true;
  440 + showPagination(data);
  441 + }
  442 + layer.close(i);
  443 +
  444 + startOptJzylLink($('#ll_oil_list .in_carpark_jzyl'));
  445 + });
  446 + }
  447 +
  448 + //改变状态
  449 + function startOptJzylLink(es) {
  450 + es.editable({
  451 + type: 'text',
  452 + placement: 'right',
  453 + width: 100,
  454 + display: false,
  455 + validate: function (value) {
  456 + if (!value)
  457 + return '值不能为空!';
  458 + if (isNaN(value))
  459 + return '只能为数字!';
  460 + if (value < 0)
  461 + return '值不能小于0!';
  462 + },
  463 + inputclass: 'form-control input-medium input-edtable-sm'
  464 + })
  465 + .on('save', function (e, params) {
  466 + $(this).text(params.newValue);
  467 + });
  468 + }
  469 +
  470 + function iCheckChange() {
  471 + var tr = $(this).parents('tr');
  472 + if (this.checked)
  473 + tr.addClass('row-active');
  474 + else
  475 + tr.removeClass('row-active');
  476 +
  477 + /* if($('#datatable_resource input.icheck:checked').length == 1)
  478 + $('#removeButton').removeAttr('disabled');
  479 + else
  480 + $('#removeButton').attr('disabled', 'disabled'); */
  481 + }
  482 +
  483 + function showPagination(data) {
  484 + //分页
  485 + $('#pagination').jqPaginator({
  486 + totalPages: data.totalPages,
  487 + visiblePages: 6,
  488 + currentPage: page + 1,
  489 + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
  490 + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
  491 + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
  492 + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
  493 + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
  494 + onPageChange: function (num, type) {
  495 + if (initPagination) {
  496 + initPagination = false;
  497 + return;
  498 + }
  499 +
  500 + var cells = $('tr.filter')[0].cells
  501 + , params = {}
  502 + , name;
  503 + $.each(cells, function (i, cell) {
  504 + var items = $('input,select', cell);
  505 + for (var j = 0, item; item = items[j++];) {
  506 + name = $(item).attr('name');
  507 + if (name) {
  508 + params[name] = $(item).val();
  509 + }
  510 + }
  511 + });
  512 + page = num - 1;
  513 + jsDoQuery(params, true);
  514 + }
  515 + });
  516 + }
  517 +
  518 +
  519 + //删除
  520 + $('#removeButton').on('click', function () {
  521 + if ($(this).attr('disabled'))
  522 + return;
  523 +
  524 + var id = $('input.icheck:checked').data('id');
  525 + removeConfirm('确定要删除选中的数据?', '/resource/' + id, function () {
  526 + $('tr.filter .filter-submit').click();
  527 + });
  528 + });
  529 +
  530 + //搜索线路
  531 + $.get('/basic/lineCode2Name',function(result){
  532 + var data=[];
  533 +
  534 + for(var code in result){
  535 + data.push({id: code, text: result[code]});
  536 + }
  537 + console.log(data);
  538 + initPinYinSelect2('#xlbm',data,'');
  539 +
  540 + })
  541 +
  542 + $('#nbbm').select2({
  543 + placeholder: '搜索车辆...',
  544 + ajax: {
  545 + url: '/realSchedule/sreachVehic',
  546 + dataType: 'json',
  547 + delay: 150,
  548 + data: function (params) {
  549 + return {nbbm: params.term};
  550 + },
  551 + processResults: function (data) {
  552 + return {
  553 + results: data
  554 + };
  555 + },
  556 + cache: true
  557 + },
  558 + templateResult: function (repo) {
  559 + if (repo.loading) return repo.text;
  560 + var h = '<span>' + repo.text + '</span>';
  561 + h += (repo.lineName ? '&nbsp;<span class="select2-desc">' + repo.lineName + '</span>' : '');
  562 + return h;
  563 + },
  564 + escapeMarkup: function (markup) {
  565 + return markup;
  566 + },
  567 + minimumInputLength: 1,
  568 + templateSelection: function (repo) {
  569 + return repo.text;
  570 + },
  571 + language: {
  572 + noResults: function () {
  573 + return '<span style="color:red;font-size: 12px;">没有搜索到车辆!</span>';
  574 + },
  575 + inputTooShort: function (e) {
  576 + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入自编号搜索车辆</span>';
  577 + },
  578 + searching: function () {
  579 + return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>';
  580 + }
  581 + }
  582 + })
  583 +
  584 +
  585 +//导出
  586 +
  587 + $("#export").on("click", function () {
  588 + if ($("#rq").val() != "") {
  589 + var cells = $('tr.filter')[0].cells
  590 + , params = {}
  591 + , name;
  592 + $.each(cells, function (i, cell) {
  593 + var items = $('input,select', cell);
  594 + for (var j = 0, item; item = items[j++];) {
  595 + name = $(item).attr('name');
  596 + if (name) {
  597 + params[name] = $(item).val();
  598 + }
  599 + }
  600 + });
  601 + console.log(params);
  602 + $post('/ylb/listExport', params, function (result) {
  603 + console.log(result);
  604 + window.open("/downloadFile/download?fileName=进出场存油量" + moment($("#rq").val()).format("YYYYMMDD"));
  605 + });
  606 + } else {
  607 + layer.msg('请选择日期.');
  608 + }
  609 + });
  610 +
  611 + });
  612 +</script>
0 613 \ No newline at end of file
... ...
src/main/resources/static/pages/report/timetable/timetable.html
... ... @@ -40,8 +40,8 @@
40 40 <select class="form-control" name="line" id="line" style="width: 180px;"></select>
41 41 </div>
42 42 <div style="display: inline-block;margin-left: 15px;">
43   - <span class="item-label" style="width: 80px;">时间: </span>
44   - <input class="form-control" type="text" id="date" style="width: 180px;"/>
  43 + <span class="item-label" style="width: 80px;">时刻表: </span>
  44 + <select class="form-control" name="ttinfo" id="ttinfo" style="width: 180px;"></select>
45 45 </div>
46 46 <div class="form-group">
47 47 <input class="btn btn-default" type="button" id="query" value="查询"/>
... ... @@ -196,10 +196,6 @@
196 196 if (!$('body').hasClass('page-sidebar-closed'))
197 197 $('.menu-toggler.sidebar-toggler').click();
198 198  
199   - $("#date").datetimepicker({
200   - format : 'YYYY-MM-DD',
201   - locale : 'zh-cn'
202   - });
203 199  
204 200 var obj = [];
205 201 $.get('/user/companyData', function(result){
... ... @@ -246,27 +242,49 @@
246 242  
247 243 })
248 244  
  245 +
  246 + var flag = 0;
  247 + function updateTtinfo(){
  248 + if(flag == 1)
  249 + return;
  250 + flag = 1;
  251 + var treeData = [];
  252 + var params = {};
  253 + params['line'] = $("#line").val();
  254 + $get('/report/getTtinfo', params, function(result){
  255 + treeData = createTreeData(result);
  256 + var options = '<option value="">请选择...</option>';
  257 + $.each(treeData, function(i, g){
  258 + options += '<option value="'+g.id+'">'+g.name+'</option>';
  259 + });
  260 + $('#ttinfo').html(options)/* .select2() */;
  261 + flag = 0;
  262 + });
  263 + }
  264 +
  265 + $("#line").on("change", function(){
  266 + updateTtinfo();
  267 + })
  268 +
249 269 //查询
250 270 $("#query").on('click',function(){
251   - console.log($("#gsdmTime").val());
252   - console.log($("#fgsdmTime").val());
253 271 var line = $("#line").val();
254 272 var xlName = $("#select2-line-container").html();
255   - var date = $("#date").val();
256   - if(date==null|| date==""){
257   - layer.msg('请选择日期.');
258   - }else if(line==null || line ==""){
  273 + var ttinfo = $("#ttinfo").val();
  274 + if(line==null || line ==""){
259 275 layer.msg('请选择线路.');
  276 + }else if(ttinfo==null|| ttinfo==""){
  277 + layer.msg('请选择时刻表.');
260 278 }else{
261   - $get('/report/tbodyTime1',{line:line,date:date},function(result){
  279 + $get('/report/tbodyTime1',{line:line,ttinfo:ttinfo},function(result){
262 280 var tbodyTime1 = template('tbodyTime1',{map:result});
263 281 $('#formsTime1 .tbody_time_1').html(tbodyTime1);
264 282 });
265   - $.get('/report/tbodyTime2',{line:line,date:date},function(result){
  283 + $.get('/report/tbodyTime2',{line:line,ttinfo:ttinfo},function(result){
266 284 var tbodyTime2 = template('tbodyTime2',{map:result});
267 285 $('#formsTime2 .tbody_time_2').html(tbodyTime2);
268   - });
269   - $.get('/report/tbodyTime3',{line:line,date:date},function(result){
  286 + });/*
  287 + $.get('/report/tbodyTime3',{line:line,ttinfo:ttinfo},function(result){
270 288  
271 289 var tbodyTime3 = template('tbodyTime3',{list:result});
272 290 $('#formsTime3 .tbody_time_3').html(tbodyTime3);
... ... @@ -274,15 +292,17 @@
274 292 var divTime2 = window.document.getElementById('formsTime2');
275 293 console.log(divTime3.offsetHeight);
276 294 divTime2.style.height=divTime3.offsetHeight+"px";
277   - });/*
  295 + }); */
  296 +
  297 + /*
278 298 $.get('/report/tbodyTime4',{line:line,date:date},function(result){
279 299 var scheduleDaily_3 = template('scheduleDaily_3',{list:result});
280 300 $('#forms .scheduleDaily_3').html(scheduleDaily_3);
281 301 });*/
282   - $.get('/report/tbodyTime5',{line:line,date:date},function(result){
  302 + /* $.get('/report/tbodyTime5',{line:line,ttinfo:ttinfo},function(result){
283 303 var tbodyTime5 = template('tbodyTime5',{list:result});
284 304 $('#formsTime5 .tbody_time_5').html(tbodyTime5);
285   - });
  305 + }); */
286 306 }
287 307  
288 308  
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/list.html
... ... @@ -26,7 +26,7 @@
26 26 <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition().equipmentCode_like" placeholder="输入设备编号..."/>
27 27 </td>
28 28 <td>
29   - <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition().carCode_like" placeholder="输入车牌号..."/>
  29 + <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition().carPlate_like" placeholder="输入车牌号..."/>
30 30 </td>
31 31 <td>
32 32 <div>
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice-legacy.js
... ... @@ -158,12 +158,20 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;$$SearchInfoService_g&#39;, [&#39;$resource&#39;, fun
158 158 }
159 159 ),
160 160 ttInfo: $resource(
161   - '/tic/:type',
  161 + '/tic_ec/:type',
162 162 {order: "name", direction: 'ASC'},
163 163 {
164 164 list: {
165 165 method: 'GET',
166   - isArray: true
  166 + isArray: true,
  167 + transformResponse: function(rs) {
  168 + var dst = angular.fromJson(rs);
  169 + if (dst.status == 'SUCCESS') {
  170 + return dst.data;
  171 + } else {
  172 + return dst; // 业务错误留给控制器处理
  173 + }
  174 + }
167 175 }
168 176 }
169 177 ),
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
... ... @@ -522,78 +522,86 @@ angular.module(&#39;ScheduleApp&#39;).factory(
522 522 );
523 523  
524 524 // 时刻表明细管理service
525   -angular.module('ScheduleApp').factory('TimeTableDetailManageService_g', ['$resource', function($resource) {
526   - return {
527   - rest: $resource(
528   - '/tidc/:id',
529   - {order: 'createDate', direction: 'DESC', id: '@id_route'},
530   - {
531   - get: {
532   - method: 'GET'
533   - },
534   - save: {
535   - method: 'POST'
536   - }
537   - }
538   - ),
539   - import: $resource(
540   - '/tidc/importfile',
541   - {},
542   - {
543   - do: {
544   - method: 'POST',
545   - headers: {
546   - 'Content-Type': 'application/x-www-form-urlencoded'
547   - },
548   - transformRequest: function(obj) {
549   - var str = [];
550   - for (var p in obj) {
551   - str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  525 +angular.module('ScheduleApp').factory(
  526 + 'TimeTableDetailManageService_g',
  527 + [
  528 + '$resource',
  529 + function($resource) {
  530 + return {
  531 + rest: $resource(
  532 + '/tidc/:id',
  533 + {order: 'createDate', direction: 'DESC', id: '@id'},
  534 + {
  535 + get: {
  536 + method: 'GET'
  537 + },
  538 + save: {
  539 + method: 'POST'
552 540 }
553   - return str.join("&");
554 541 }
555   - }
556   - }
557   - ),
558   - edit: $resource(
559   - '/tidc/edit/:xlid/:ttid',
560   - {},
561   - {
562   - list: {
563   - method: 'GET'
564   - }
565   - }
566   - ),
567   - bcdetails: $resource(
568   - '/tidc/bcdetail',
569   - {},
570   - {
571   - list: {
572   - method: 'GET',
573   - isArray: true
574   - }
575   - }
576   - ),
577   - dataTools: $resource(
578   - '/tidc/:type',
579   - {},
580   - {
581   - dataExport: {
582   - method: 'GET',
583   - responseType: "arraybuffer",
584   - params: {
585   - type: "dataExportExt"
586   - },
587   - transformResponse: function(data, headers){
588   - return {data : data};
  542 + ),
  543 + import: $resource(
  544 + '/tidc/importfile',
  545 + {},
  546 + {
  547 + do: {
  548 + method: 'POST',
  549 + headers: {
  550 + 'Content-Type': 'application/x-www-form-urlencoded'
  551 + },
  552 + transformRequest: function(obj) {
  553 + var str = [];
  554 + for (var p in obj) {
  555 + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  556 + }
  557 + return str.join("&");
  558 + }
  559 + }
589 560 }
590   - }
591   - }
592   - )
  561 + ),
  562 + edit: $resource(
  563 + '/tidc/edit/:xlid/:ttid',
  564 + {},
  565 + {
  566 + list: {
  567 + method: 'GET'
  568 + }
  569 + }
  570 + ),
  571 + bcdetails: $resource(
  572 + '/tidc/bcdetail',
  573 + {},
  574 + {
  575 + list: {
  576 + method: 'GET',
  577 + isArray: true
  578 + }
  579 + }
  580 + ),
  581 + dataTools: $resource(
  582 + '/tidc/:type',
  583 + {},
  584 + {
  585 + dataExport: {
  586 + method: 'GET',
  587 + responseType: "arraybuffer",
  588 + params: {
  589 + type: "dataExportExt"
  590 + },
  591 + transformResponse: function(data, headers){
  592 + return {data : data};
  593 + }
  594 + }
  595 + }
  596 + )
593 597  
594   - // TODO:导入数据
595   - };
596   -}]);
  598 + // TODO:导入数据
  599 + };
  600 +
  601 + }
  602 +
  603 + ]
  604 +);
597 605 // 项目通用的全局service服务,供不同的controller使用,自定义指令不使用
598 606  
599 607 // 文件下载服务
... ... @@ -754,12 +762,20 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;$$SearchInfoService_g&#39;, [&#39;$resource&#39;, fun
754 762 }
755 763 ),
756 764 ttInfo: $resource(
757   - '/tic/:type',
  765 + '/tic_ec/:type',
758 766 {order: "name", direction: 'ASC'},
759 767 {
760 768 list: {
761 769 method: 'GET',
762   - isArray: true
  770 + isArray: true,
  771 + transformResponse: function(rs) {
  772 + var dst = angular.fromJson(rs);
  773 + if (dst.status == 'SUCCESS') {
  774 + return dst.data;
  775 + } else {
  776 + return dst; // 业务错误留给控制器处理
  777 + }
  778 + }
763 779 }
764 780 }
765 781 ),
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-ui-route-state.js
... ... @@ -1096,7 +1096,7 @@ ScheduleApp.config([
1096 1096 }
1097 1097 })
1098 1098 .state("ttInfoDetailManage_edit", { // 时刻表详细信息编辑
1099   - url: '/ttInfoDetailManage_edit/:xlid/:ttid/:xlname/:ttname',
  1099 + url: '/ttInfoDetailManage_edit/:xlid/:ttid/:xlname/:ttname/:rflag',
1100 1100 views: {
1101 1101 "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/detailedit/edit.html'}
1102 1102 },
... ... @@ -1123,7 +1123,7 @@ ScheduleApp.config([
1123 1123 name: 'ttInfoDetailManage_edit_module',
1124 1124 insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
1125 1125 files: [
1126   - "pages/scheduleApp/module/core/ttInfoManage/detailedit/timeTableDetailManage_old.js"
  1126 + "pages/scheduleApp/module/core/ttInfoManage/detailedit/module2.js"
1127 1127 ]
1128 1128 });
1129 1129 }]
... ... @@ -1147,6 +1147,25 @@ ScheduleApp.config([
1147 1147 });
1148 1148 }]
1149 1149 }
  1150 + })
  1151 + .state("ttInfoDetailManage_detail_edit2", { // 时刻表详细信息批量单元格修改
  1152 + url: '/ttInfoDetailManage_detail_edit/:xlid/:ttid/:xlname/:ttname',
  1153 + views: {
  1154 + "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-detail2.html'}
  1155 + },
  1156 + resolve: {
  1157 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  1158 + return $ocLazyLoad.load({
  1159 + name: 'ttInfoDetailManage_detail_edit_module',
  1160 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  1161 + files: [
  1162 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  1163 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  1164 + "pages/scheduleApp/module/core/ttInfoManage/detailedit/timeTableDetailManage_old.js"
  1165 + ]
  1166 + });
  1167 + }]
  1168 + }
1150 1169 });
1151 1170  
1152 1171 }
... ...