Commit 37e0a8f3d45c4d7e3c9ac45bf30195628f0be707

Authored by 潘钊
2 parents 3d094fb5 9f277f10

Merge branch 'minhang' into qingpu

Showing 35 changed files with 3080 additions and 541 deletions

Too many changes to show.

To preserve performance only 35 of 92 files are displayed.

src/main/java/com/bsth/controller/BusIntervalController.java 0 → 100644
  1 +package com.bsth.controller;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
  9 +import org.springframework.web.bind.annotation.RequestParam;
  10 +import org.springframework.web.bind.annotation.RestController;
  11 +
  12 +import com.bsth.service.BusIntervalService;
  13 +
  14 +@RestController
  15 +@RequestMapping("busInterval")
  16 +public class BusIntervalController {
  17 +
  18 + @Autowired
  19 + private BusIntervalService busIntervalService;
  20 +
  21 + @RequestMapping(value = "/getDir", method = RequestMethod.GET)
  22 + public List<Map<String,Object>> getDir(@RequestParam Map<String, Object> map){
  23 + return busIntervalService.getDir(map);
  24 + }
  25 +
  26 + @RequestMapping(value = "/interval", method = RequestMethod.GET)
  27 + public List<Map<String,Object>> interval(@RequestParam Map<String, Object> map){
  28 + return busIntervalService.interval(map);
  29 + }
  30 +
  31 + @RequestMapping(value = "/timeAndSpeed", method = RequestMethod.GET)
  32 + public Map<String,Object> timeAndSpeed(@RequestParam Map<String, Object> map){
  33 + return busIntervalService.timeAndSpeed(map);
  34 + }
  35 +
  36 + @RequestMapping(value = "/lineTimeAnaliy", method = RequestMethod.GET)
  37 + public List<Map<String,Object>> lineTimeAnaliy(@RequestParam Map<String, Object> map){
  38 + return busIntervalService.lineTimeAnaliy(map);
  39 + }
  40 +
  41 + @RequestMapping(value = "/lbStatuAnaly", method = RequestMethod.GET)
  42 + public List<Map<String,Object>> lbStatuAnaly(@RequestParam Map<String, Object> map){
  43 + return busIntervalService.lbStatuAnaly(map);
  44 + }
  45 +
  46 + @RequestMapping(value = "/correctStatis", method = RequestMethod.GET)
  47 + public List<Map<String,Object>> correctStatis(@RequestParam Map<String, Object> map){
  48 + return busIntervalService.correctStatis(map);
  49 + }
  50 +
  51 +}
... ...
src/main/java/com/bsth/controller/forms/ExportController.java
... ... @@ -13,12 +13,15 @@ import org.springframework.web.bind.annotation.RequestMethod;
13 13 import org.springframework.web.bind.annotation.RequestParam;
14 14 import org.springframework.web.bind.annotation.RestController;
15 15  
  16 +import com.bsth.entity.mcy_forms.Allline;
16 17 import com.bsth.entity.mcy_forms.Changetochange;
  18 +import com.bsth.entity.mcy_forms.Executionrate;
17 19 import com.bsth.entity.mcy_forms.Linepasswengerflow;
18 20 import com.bsth.entity.mcy_forms.Operationservice;
19 21 import com.bsth.entity.mcy_forms.Shifday;
20 22 import com.bsth.entity.mcy_forms.Shiftuehiclemanth;
21 23 import com.bsth.entity.mcy_forms.Singledata;
  24 +import com.bsth.entity.mcy_forms.Turnoutrate;
22 25 import com.bsth.entity.mcy_forms.Vehicleloading;
23 26 import com.bsth.entity.mcy_forms.Waybillday;
24 27 import com.bsth.service.forms.ExportService;
... ... @@ -28,33 +31,31 @@ import com.bsth.util.ReportUtils;
28 31 @RestController
29 32 @RequestMapping("mcy_export")
30 33 public class ExportController {
31   -
  34 +
32 35 @Autowired
33 36 FormsService formsService;
34 37  
35 38 @Autowired
36 39 ExportService exportService;
37   -
38   - //行车路单日报表
39   - @RequestMapping(value = "/waybilldayExport",method = RequestMethod.POST)
40   - public List<Waybillday> waybilldayExport(@RequestParam Map<String, Object> map){
  40 +
  41 + // 行车路单日报表
  42 + @RequestMapping(value = "/waybilldayExport", method = RequestMethod.POST)
  43 + public List<Waybillday> waybilldayExport(@RequestParam Map<String, Object> map) {
41 44 List<Waybillday> waybillday = formsService.waybillday(map);
42 45 exportService.waybillday(map.get("date").toString(), waybillday);
43 46 return waybillday;
44 47 }
45   -
46   -
47   - //线路客流量报表
48   - @RequestMapping(value = "/linepasswengerflowExport",method = RequestMethod.POST)
49   - public List<Map<String, Object>> linepasswengerflowExport(@RequestParam Map<String, Object> map){
50   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
51   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
  48 +
  49 + // 线路客流量报表
  50 + @RequestMapping(value = "/linepasswengerflowExport", method = RequestMethod.POST)
  51 + public List<Map<String, Object>> linepasswengerflowExport(@RequestParam Map<String, Object> map) {
  52 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
52 53 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
53 54 ReportUtils ee = new ReportUtils();
54 55 List<Linepasswengerflow> linepasswengerflow = formsService.linepasswengerflow(map);
55 56 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
56   - int i=1;
57   - for(Linepasswengerflow l : linepasswengerflow){
  57 + int i = 1;
  58 + for (Linepasswengerflow l : linepasswengerflow) {
58 59 Map<String, Object> m = new HashMap<String, Object>();
59 60 m.put("i", i);
60 61 m.put("stationName", l.getStationName());
... ... @@ -62,78 +63,74 @@ public class ExportController {
62 63 m.put("2", " ");
63 64 resList.add(m);
64 65 i++;
65   - }
66   -
67   - try {
  66 + }
  67 +
  68 + try {
68 69 listI.add(resList.iterator());
69   - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
70   - ee.excelReplace(listI, new Object[] { map }, path+"mould\\linepassengerflow.xls",
71   - path+"export\\线路客流量报表" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls");
72   - } catch (Exception e) {
73   - e.printStackTrace();
74   - }
  70 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  71 + ee.excelReplace(listI, new Object[] { map }, path + "mould\\linepassengerflow.xls",
  72 + path + "export\\线路客流量报表" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls");
  73 + } catch (Exception e) {
  74 + e.printStackTrace();
  75 + }
75 76 return resList;
76 77 }
77 78  
78   -
79   -
80   - //班次车辆人员日统计
81   - @RequestMapping(value = "/shifdayExport",method = RequestMethod.POST)
82   - public List<Map<String, Object>> shifdayExport(@RequestParam Map<String, Object> map){
83   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
84   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
  79 + // 班次车辆人员日统计
  80 + @RequestMapping(value = "/shifdayExport", method = RequestMethod.POST)
  81 + public List<Map<String, Object>> shifdayExport(@RequestParam Map<String, Object> map) {
  82 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
85 83 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
86 84 ReportUtils ee = new ReportUtils();
87 85 List<Shifday> shifday = formsService.shifday(map);
88 86 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
89   - for(Shifday l : shifday){
  87 + for (Shifday l : shifday) {
90 88 Map<String, Object> m = new HashMap<String, Object>();
91   - m.put("jName",l.getjName());
  89 + m.put("jName", l.getjName());
92 90 m.put("sName", l.getsName());
93 91 m.put("lpName", l.getLpName());
94 92 m.put("carPlate", l.getCarPlate());
95 93 m.put("jhlc", l.getJhlc());
96   - //m.put("sjjhlc", l.getSjjhlc());
  94 + // m.put("sjjhlc", l.getSjjhlc());
97 95 m.put("yygl", l.getYygl());
98 96 m.put("emptMileage", l.getEmptMileage());
99 97 m.put("remMileage", l.getRemMileage());
100 98 m.put("addMileage", l.getAddMileage());
101 99 m.put("totalm", l.getTotalm());
102 100 m.put("jhbc", l.getJhbc());
103   - //m.put("sjjhbc", l.getSjjhbc());
  101 + // m.put("sjjhbc", l.getSjjhbc());
104 102 m.put("cjbc", l.getCjbc());
105 103 m.put("ljbc", l.getLjbc());
106 104 m.put("sjbc", l.getSjbc());
107 105 resList.add(m);
108   - }
109   -
110   - try {
  106 + }
  107 +
  108 + try {
111 109 listI.add(resList.iterator());
112   - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
113   - ee.excelReplace(listI, new Object[] { map }, path+"mould\\shifday.xls",
114   - path+"export\\班次车辆人员日报表" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls");
115   - } catch (Exception e) {
116   - e.printStackTrace();
117   - }
  110 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  111 + ee.excelReplace(listI, new Object[] { map }, path + "mould\\shifday.xls",
  112 + path + "export\\班次车辆人员日报表" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls");
  113 + } catch (Exception e) {
  114 + e.printStackTrace();
  115 + }
118 116 return resList;
119 117 }
120   -
121   - //班次车辆人员月统计
122   - @RequestMapping(value = "/shiftuehiclemanthExport",method = RequestMethod.POST)
123   - public List<Map<String, Object>> shiftuehiclemanthExport(@RequestParam Map<String, Object> map){
124   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
125   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
  118 +
  119 + // 班次车辆人员月统计
  120 + @RequestMapping(value = "/shiftuehiclemanthExport", method = RequestMethod.POST)
  121 + public List<Map<String, Object>> shiftuehiclemanthExport(@RequestParam Map<String, Object> map) {
  122 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
126 123 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
127 124 ReportUtils ee = new ReportUtils();
128 125 List<Shiftuehiclemanth> shiftuehiclemanth = formsService.shiftuehiclemanth(map);
129 126 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
130   - int i=1;
131   - for(Shiftuehiclemanth l : shiftuehiclemanth){
  127 + int i = 1;
  128 + for (Shiftuehiclemanth l : shiftuehiclemanth) {
132 129 Map<String, Object> m = new HashMap<String, Object>();
133 130 m.put("i", i);
134   - m.put("jName",l.getjName() );
  131 + m.put("jName", l.getjName());
135 132 m.put("jhlc", l.getJhlc());
136   - m.put("emptMileage",l.getEmptMileage() );
  133 + m.put("emptMileage", l.getEmptMileage());
137 134 m.put("remMileage", l.getRemMileage());
138 135 m.put("addMileage", l.getAddMileage());
139 136 m.put("totalm", l.getTotalm());
... ... @@ -142,39 +139,37 @@ public class ExportController {
142 139 m.put("sjbc", l.getSjbc());
143 140 resList.add(m);
144 141 i++;
145   - }
146   -
147   - try {
  142 + }
  143 +
  144 + try {
148 145 listI.add(resList.iterator());
149   -
150   - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
151   - ee.excelReplace(listI, new Object[] { map }, path+"mould\\shiftuehiclemanth.xls",
152   - path+"export\\班次车辆人员月报表" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
153   -
154   - } catch (Exception e) {
155   - e.printStackTrace();
156   - }
157   -
  146 +
  147 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  148 + ee.excelReplace(listI, new Object[] { map }, path + "mould\\shiftuehiclemanth.xls", path
  149 + + "export\\班次车辆人员月报表" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  150 +
  151 + } catch (Exception e) {
  152 + e.printStackTrace();
  153 + }
  154 +
158 155 return resList;
159 156 }
160   -
161 157  
162   - //路单数据报表
163   - @RequestMapping(value = "/singledataExport",method = RequestMethod.POST)
164   - public List<Map<String, Object>> singledataExport(@RequestParam Map<String, Object> map){
165   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
166   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
  158 + // 路单数据报表
  159 + @RequestMapping(value = "/singledataExport", method = RequestMethod.POST)
  160 + public List<Map<String, Object>> singledataExport(@RequestParam Map<String, Object> map) {
  161 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
167 162 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
168 163 ReportUtils ee = new ReportUtils();
169 164 List<Singledata> singledata = formsService.singledata(map);
170 165 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
171   - int i=1;
172   - for(Singledata l : singledata){
  166 + int i = 1;
  167 + for (Singledata l : singledata) {
173 168 Map<String, Object> m = new HashMap<String, Object>();
174 169 m.put("i", i);
175   - m.put("rQ",l.getrQ());
  170 + m.put("rQ", l.getrQ());
176 171 m.put("gS", l.getgS());
177   - m.put("xL",l.getxL() );
  172 + m.put("xL", l.getxL());
178 173 m.put("clzbh", l.getClzbh());
179 174 m.put("jsy", l.getJsy());
180 175 m.put("jName", l.getjName());
... ... @@ -184,35 +179,35 @@ public class ExportController {
184 179 m.put("emptMileage", l.getEmptMileage());
185 180 m.put("hyl", l.getHyl());
186 181 m.put("jzl", l.getJzl());
187   - m.put("unyyyl",l.getUnyyyl());
  182 + m.put("unyyyl", l.getUnyyyl());
188 183 m.put("jhjl", l.getJhjl());
189 184 resList.add(m);
190 185 i++;
191   - }
192   -
193   - try {
  186 + }
  187 +
  188 + try {
194 189 listI.add(resList.iterator());
195   - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
196   - ee.excelReplace(listI, new Object[] { map }, path+"mould\\singledata.xls",
197   - path+"export\\路单报表" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
198   - } catch (Exception e) {
199   - e.printStackTrace();
200   - }
201   -
  190 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  191 + ee.excelReplace(listI, new Object[] { map }, path + "mould\\singledata.xls",
  192 + path + "export\\路单报表" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  193 + } catch (Exception e) {
  194 + e.printStackTrace();
  195 + }
  196 +
202 197 return resList;
203 198 }
204   -
205   - //车辆加注
206   - @RequestMapping(value = "/vehicleloadingExport",method = RequestMethod.POST)
207   - public List<Map<String, Object>> vehicleloadingExport(@RequestParam Map<String, Object> map){
208   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
209   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
  199 +
  200 + // 车辆加注
  201 + @RequestMapping(value = "/vehicleloadingExport", method = RequestMethod.POST)
  202 + public List<Map<String, Object>> vehicleloadingExport(@RequestParam Map<String, Object> map) {
  203 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
210 204 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
211 205 ReportUtils ee = new ReportUtils();
212   - List<Vehicleloading> vehicleloading = formsService.vehicleloading(map.get("line").toString(), map.get("date").toString());
  206 + List<Vehicleloading> vehicleloading = formsService.vehicleloading(map.get("line").toString(),
  207 + map.get("date").toString());
213 208 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
214   - int i=1;
215   - for(Vehicleloading l : vehicleloading){
  209 + int i = 1;
  210 + for (Vehicleloading l : vehicleloading) {
216 211 Map<String, Object> m = new HashMap<String, Object>();
217 212 m.put("i", i);
218 213 m.put("rQ", l.getrQ());
... ... @@ -228,96 +223,199 @@ public class ExportController {
228 223 m.put("sjbc", l.getSjbc());
229 224 resList.add(m);
230 225 i++;
231   - }
232   -
233   - try {
  226 + }
  227 +
  228 + try {
234 229 listI.add(resList.iterator());
235   - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
236   - ee.excelReplace(listI, new Object[] { map }, path+"mould\\vehicleloading.xls",
237   - path+"export\\车辆加注" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls");
238   - } catch (Exception e) {
239   - e.printStackTrace();
240   - }
  230 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  231 + ee.excelReplace(listI, new Object[] { map }, path + "mould\\vehicleloading.xls",
  232 + path + "export\\车辆加注" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls");
  233 + } catch (Exception e) {
  234 + e.printStackTrace();
  235 + }
241 236 return resList;
242 237 }
243   -
244   - //运营服务阶段报表
245   - @RequestMapping(value = "/operationserviceExport",method = RequestMethod.POST)
246   - public List<Map<String, Object>> operationserviceExport(@RequestParam Map<String, Object> map){
247   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
248   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
  238 +
  239 + // 运营服务阶段报表
  240 + @RequestMapping(value = "/operationserviceExport", method = RequestMethod.POST)
  241 + public List<Map<String, Object>> operationserviceExport(@RequestParam Map<String, Object> map) {
  242 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
249 243 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
250 244 ReportUtils ee = new ReportUtils();
251 245 List<Operationservice> operationservice = formsService.operationservice(map);
252 246 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
253   - int i=1;
254   - for(Operationservice l : operationservice){
255   - Map<String, Object> m = new HashMap<String, Object>();
256   - m.put("i", i);
257   - m.put("xlName", l.getXlName());
258   - m.put("jzl", l.getJzl());
259   - m.put("xhl", l.getXhl());
260   - m.put("xsgl", l.getXsgl());
261   - m.put("emptMileage", l.getEmptMileage());
262   - m.put("sjbc", l.getSjbc());
263   - resList.add(m);
264   - i++;
  247 + int i = 1;
  248 + for (Operationservice l : operationservice) {
  249 + Map<String, Object> m = new HashMap<String, Object>();
  250 + m.put("i", i);
  251 + m.put("xlName", l.getXlName());
  252 + m.put("jzl", l.getJzl());
  253 + m.put("xhl", l.getXhl());
  254 + m.put("xsgl", l.getXsgl());
  255 + m.put("emptMileage", l.getEmptMileage());
  256 + m.put("sjbc", l.getSjbc());
  257 + resList.add(m);
  258 + i++;
265 259 }
266   -
  260 +
267 261 try {
268 262 listI.add(resList.iterator());
269   - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
270   - ee.excelReplace(listI, new Object[] { map }, path+"mould\\operationservice.xls",
271   - path+"export\\运营服务阶段报表" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
272   - } catch (Exception e) {
273   - e.printStackTrace();
274   - }
  263 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  264 + ee.excelReplace(listI, new Object[] { map }, path + "mould\\operationservice.xls", path + "export\\运营服务阶段报表"
  265 + + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  266 + } catch (Exception e) {
  267 + e.printStackTrace();
  268 + }
275 269 return resList;
276 270 }
277   -
278 271  
279   - //换人换车情况日统计
280   - @RequestMapping(value = "/changetochangeExport",method = RequestMethod.POST)
281   - public List<Map<String, Object>> changetochangeExport(@RequestParam Map<String, Object> map){
282   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
283   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
284   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
285   - ReportUtils ee = new ReportUtils();
286   - List<Changetochange> changetochange = formsService.changetochange(map);
287   - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
288   - for(Changetochange l : changetochange){
  272 + // 换人换车情况日统计
  273 + @RequestMapping(value = "/changetochangeExport", method = RequestMethod.POST)
  274 + public List<Map<String, Object>> changetochangeExport(@RequestParam Map<String, Object> map) {
  275 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  276 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  277 + ReportUtils ee = new ReportUtils();
  278 + List<Changetochange> changetochange = formsService.changetochange(map);
  279 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  280 + for (Changetochange l : changetochange) {
289 281 Map<String, Object> m = new HashMap<String, Object>();
290   - m.put("rq",l.getRq());
291   - m.put("gs",l.getGs());
292   - m.put("fgs",l.getFgs());
293   - m.put("xl",l.getXl());
294   - m.put("lp",l.getLp());
295   - m.put("fssj",l.getFssj());
296   - m.put("xgsj",l.getXgsj());
297   - m.put("pcch",l.getPcch());
298   - m.put("pcry",l.getPcry());
299   - m.put("jhch",l.getJhch());
300   - m.put("jhgh",l.getJhgh());
301   - m.put("sjch",l.getSjch());
302   - m.put("sjgh",l.getSjgh());
303   - m.put("yy",l.getYy());
304   - m.put("xgr",l.getXgr());
  282 + m.put("rq", l.getRq());
  283 + m.put("gs", l.getGs());
  284 + m.put("fgs", l.getFgs());
  285 + m.put("xl", l.getXl());
  286 + m.put("lp", l.getLp());
  287 + m.put("fssj", l.getFssj());
  288 + m.put("xgsj", l.getXgsj());
  289 + m.put("pcch", l.getPcch());
  290 + m.put("pcry", l.getPcry());
  291 + m.put("jhch", l.getJhch());
  292 + m.put("jhgh", l.getJhgh());
  293 + m.put("sjch", l.getSjch());
  294 + m.put("sjgh", l.getSjgh());
  295 + m.put("yy", l.getYy());
  296 + m.put("xgr", l.getXgr());
305 297 resList.add(m);
306   - }
307   -
308   - try {
309   - listI.add(resList.iterator());
310   - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
311   - ee.excelReplace(listI, new Object[] { map }, path+"mould\\changetochange.xls",
312   - path+"export\\换人换车情况日统计" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
313   - } catch (Exception e) {
314   - e.printStackTrace();
315   - }
316   - return resList;
317 298 }
318   -
319   -
320   -
321   -
  299 +
  300 + try {
  301 + listI.add(resList.iterator());
  302 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  303 + ee.excelReplace(listI, new Object[] { map }, path + "mould\\changetochange.xls", path + "export\\换人换车情况日统计"
  304 + + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  305 + } catch (Exception e) {
  306 + e.printStackTrace();
  307 + }
  308 + return resList;
  309 + }
  310 +
  311 + // 营运线路出车率统计表
  312 + @RequestMapping(value = "/turnoutrateExport", method = RequestMethod.POST)
  313 + public List<Map<String, Object>> turnoutrateExport(@RequestParam Map<String, Object> map) {
  314 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  315 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  316 + ReportUtils ee = new ReportUtils();
  317 + List<Turnoutrate> turnoutrate = formsService.turnoutrate(map);
  318 + Map<String, Object> map1 = new HashMap<String, Object>();
  319 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  320 + for (Turnoutrate l : turnoutrate) {
  321 + Map<String, Object> m = new HashMap<String, Object>();
  322 + m.put("rq", l.getRq());
  323 + m.put("gs", l.getGs());
  324 + m.put("zhgs", l.getZhgs());
  325 + m.put("xl", l.getXl());
  326 + m.put("cchjh", l.getCchjh());
  327 + m.put("cchsj", l.getCchsj());
  328 + m.put("cchqz", l.getCchqz());
  329 + m.put("chl", l.getChl());
  330 + m.put("bcjh", l.getBcjh());
  331 + m.put("bcsj", l.getBbzxl());
  332 + m.put("bbzxl", l.getBbzxl());
  333 + m.put("sm", l.getSm());
  334 + resList.add(m);
  335 + }
  336 +
  337 + try {
  338 + listI.add(resList.iterator());
  339 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  340 + ee.excelReplace(listI, new Object[] { map1 }, path + "mould\\turnoutrate.xls", path + "export\\营运线路出车率统计表"
  341 + + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  342 + } catch (Exception e) {
  343 + e.printStackTrace();
  344 + }
  345 + return resList;
  346 + }
  347 +
  348 + //营运线路出车率统计表
  349 + @RequestMapping(value = "/executionrateExport", method = RequestMethod.POST)
  350 + public List<Map<String, Object>> executionrateExport(@RequestParam Map<String, Object> map) {
  351 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  352 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  353 + ReportUtils ee = new ReportUtils();
  354 + List<Executionrate> executionrate = formsService.executionrate(map);
  355 + Map<String, Object> map1 = new HashMap<String, Object>();
  356 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  357 + for (Executionrate l : executionrate) {
  358 + Map<String, Object> m = new HashMap<String, Object>();
  359 + m.put("rq", l.getRq());
  360 + m.put("gs", l.getGs());
  361 + m.put("zhgs", l.getZhgs());
  362 + m.put("xl", l.getXl());
  363 + m.put("cchjh", l.getCchjh());
  364 + m.put("cchsj", l.getCchsj());
  365 + m.put("chl", l.getChl());
  366 + m.put("bcjh", l.getBcjh());
  367 + m.put("bcsj", l.getBbzxl());
  368 + m.put("bbzxl", l.getBbzxl());
  369 + m.put("sm", l.getSm());
  370 + resList.add(m);
  371 + }
  372 +
  373 + try {
  374 + listI.add(resList.iterator());
  375 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  376 + ee.excelReplace(listI, new Object[] { map1 }, path + "mould\\executionrate.xls", path + "export\\班次执行率统计表"
  377 + + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  378 + } catch (Exception e) {
  379 + e.printStackTrace();
  380 + }
  381 + return resList;
  382 + }
  383 +
322 384  
  385 + ////营运线路名称统计表
  386 + @RequestMapping(value = "/alllineExport", method = RequestMethod.POST)
  387 + public List<Map<String, Object>> alllineExport(@RequestParam Map<String, Object> map) {
  388 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  389 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  390 + ReportUtils ee = new ReportUtils();
  391 + List<Allline> allline = formsService.allline(map);
  392 + Map<String, Object> map1 = new HashMap<String, Object>();
  393 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  394 + for (Allline l : allline) {
  395 + Map<String, Object> m = new HashMap<String, Object>();
  396 + m.put("rq", l.getRq());
  397 + m.put("gs", l.getGs());
  398 + m.put("zhgs", l.getZhgs());
  399 + m.put("xl", l.getXl());
  400 + m.put("cchjh", l.getCchjh());
  401 + m.put("cchsj", l.getCchsj());
  402 + m.put("chl", l.getChl());
  403 + m.put("bcjh", l.getBcjh());
  404 + m.put("bcsj", l.getBbzxl());
  405 + m.put("bbzxl", l.getBbzxl());
  406 + m.put("sm", l.getSm());
  407 + resList.add(m);
  408 + }
  409 +
  410 + try {
  411 + listI.add(resList.iterator());
  412 + String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
  413 + ee.excelReplace(listI, new Object[] { map1 }, path + "mould\\allline.xls", path + "export\\营运线路名称统计表"
  414 + + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  415 + } catch (Exception e) {
  416 + e.printStackTrace();
  417 + }
  418 + return resList;
  419 + }
  420 +
323 421 }
... ...
src/main/java/com/bsth/controller/forms/MCY_FormsController.java
... ... @@ -9,12 +9,15 @@ import org.springframework.web.bind.annotation.RequestMethod;
9 9 import org.springframework.web.bind.annotation.RequestParam;
10 10 import org.springframework.web.bind.annotation.RestController;
11 11  
  12 +import com.bsth.entity.mcy_forms.Allline;
12 13 import com.bsth.entity.mcy_forms.Changetochange;
  14 +import com.bsth.entity.mcy_forms.Executionrate;
13 15 import com.bsth.entity.mcy_forms.Linepasswengerflow;
14 16 import com.bsth.entity.mcy_forms.Operationservice;
15 17 import com.bsth.entity.mcy_forms.Shifday;
16 18 import com.bsth.entity.mcy_forms.Shiftuehiclemanth;
17 19 import com.bsth.entity.mcy_forms.Singledata;
  20 +import com.bsth.entity.mcy_forms.Turnoutrate;
18 21 import com.bsth.entity.mcy_forms.Vehicleloading;
19 22 import com.bsth.entity.mcy_forms.Waybillday;
20 23 import com.bsth.service.forms.FormsService;
... ... @@ -39,12 +42,6 @@ public class MCY_FormsController {
39 42 return formsService.waybillday(map);
40 43 }
41 44  
42   - @RequestMapping(value = "/waybilldayExcel")
43   - public List<Waybillday> dailyInfo(@RequestParam Map<String, Object> map) {
44   - return formsService.waybilldayExcel(map);
45   - }
46   -
47   -
48 45 //线路客流量报表
49 46 @RequestMapping(value = "/linepasswengerflow",method = RequestMethod.POST)
50 47 public List<Linepasswengerflow> linepasswengerflow(@RequestParam Map<String, Object> map){
... ... @@ -88,6 +85,8 @@ public class MCY_FormsController {
88 85 public List<Vehicleloading> vehicleloading(@RequestParam String line ,@RequestParam String data){
89 86 return formsService.vehicleloading(line,data);
90 87 }
  88 +
  89 +
91 90 //运营服务阶段报表
92 91 @RequestMapping(value = "/operationservice",method = RequestMethod.POST)
93 92 public List<Operationservice> operationservice(@RequestParam Map<String, Object> map){
... ... @@ -95,5 +94,25 @@ public class MCY_FormsController {
95 94 return formsService.operationservice(map);
96 95 }
97 96  
  97 + //营运线路出车率统计表
  98 + @RequestMapping(value = "/turnoutrate",method = RequestMethod.POST)
  99 + public List<Turnoutrate> turnoutrate(@RequestParam Map<String, Object> map){
  100 +
  101 + return formsService.turnoutrate(map);
  102 + }
98 103  
  104 + //班次执行率统计表
  105 + @RequestMapping(value = "/executionrate",method = RequestMethod.POST)
  106 + public List<Executionrate> executionrate(@RequestParam Map<String, Object> map){
  107 +
  108 + return formsService.executionrate(map);
  109 + }
  110 +
  111 +
  112 + //营运线路名称统计表
  113 + @RequestMapping(value = "/allline",method = RequestMethod.POST)
  114 + public List<Allline> allline(@RequestParam Map<String, Object> map){
  115 +
  116 + return formsService.allline(map);
  117 + }
99 118 }
... ...
src/main/java/com/bsth/controller/oil/CwjyController.java
... ... @@ -5,7 +5,6 @@ import java.util.Date;
5 5 import java.util.Map;
6 6  
7 7 import org.springframework.beans.factory.annotation.Autowired;
8   -import org.springframework.web.bind.annotation.PathVariable;
9 8 import org.springframework.web.bind.annotation.RequestMapping;
10 9 import org.springframework.web.bind.annotation.RequestMethod;
11 10 import org.springframework.web.bind.annotation.RequestParam;
... ... @@ -62,5 +61,4 @@ public class CwjyController extends BaseController&lt;Cwjy, Integer&gt;{
62 61 return map;
63 62 }
64 63  
65   -
66 64 }
... ...
src/main/java/com/bsth/controller/oil/CylController.java
... ... @@ -22,7 +22,6 @@ public class CylController extends BaseController&lt;Cyl, Integer&gt;{
22 22 @RequestMapping(value = "/save",method = RequestMethod.POST)
23 23 public Map<String, Object> saveYlb(Cyl t){
24 24 // SysUser user = SecurityUtils.getCurrentUser();
25   - t.setGsdm("77");
26 25 t.setUpdatetime(new Date());
27 26 /*SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
28 27 try {
... ...
src/main/java/com/bsth/controller/realcontrol/RealMapController.java
... ... @@ -35,4 +35,17 @@ public class RealMapController {
35 35 public Map<String, Object> carParkSpatialData(){
36 36 return realMapService.carParkSpatialData();
37 37 }
  38 +
  39 +
  40 + /**
  41 + *
  42 + * @Title: findRouteByLine
  43 + * @Description: TODO(获取线路的站点,路段路由)
  44 + * @param @param lineCode
  45 + * @throws
  46 + */
  47 + @RequestMapping(value = "/findRouteByLine")
  48 + public Map<String, Object> findRouteByLine(@RequestParam String lineCode){
  49 + return realMapService.findRouteByLine(lineCode);
  50 + }
38 51 }
... ...
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
... ... @@ -351,7 +351,15 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
351 351 @RequestMapping(value="/queryListWaybill")
352 352 public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
353 353 ,@RequestParam String date){
354   - return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName,date);
  354 + String type="fqp";
  355 + return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName,date,type);
  356 + }
  357 +
  358 + @RequestMapping(value="/queryListWaybillQp")
  359 + public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
  360 + ,@RequestParam String date){
  361 + String type="qp";
  362 + return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName,date,type);
355 363 }
356 364  
357 365 @RequestMapping(value="/statisticsDaily")
... ...
src/main/java/com/bsth/controller/schedule/PeopleCarPlanController.java
... ... @@ -20,33 +20,33 @@ public class PeopleCarPlanController {
20 20 private PeopleCarPlanService peopleCarPlanService;
21 21  
22 22 @RequestMapping(value = "/queryPeopleCar", method = RequestMethod.GET)
23   - public List<Map<String,Object>> queryPeopleCar(@RequestParam String line, @RequestParam String date, @RequestParam String type){
24   - return peopleCarPlanService.queryPeopleCar(line, date, type);
  23 + public List<Map<String,Object>> queryPeopleCar(@RequestParam Map<String, Object> map){
  24 + return peopleCarPlanService.queryPeopleCar(map);
25 25 }
26 26  
27 27 @RequestMapping(value="/workDaily", method = RequestMethod.GET)
28   - public List<Map<String,Object>> workDaily(@RequestParam String line, @RequestParam String date, @RequestParam String type){
29   - return peopleCarPlanService.workDaily(line, date, type);
  28 + public List<Map<String,Object>> workDaily(@RequestParam Map<String, Object> map){
  29 + return peopleCarPlanService.workDaily(map);
30 30 }
31 31  
32 32 @RequestMapping(value="/scheduleAnaly", method = RequestMethod.GET)
33   - public Map<String, Object> scheduleAnaly(@RequestParam String page, @RequestParam String line, @RequestParam String startDate, @RequestParam String endDate, @RequestParam String model, @RequestParam String type){
34   - return peopleCarPlanService.scheduleAnaly(page, line, startDate, endDate, model, type);
  33 + public Map<String, Object> scheduleAnaly(@RequestParam Map<String, Object> map){
  34 + return peopleCarPlanService.scheduleAnaly(map);
35 35 }
36 36  
37 37 @RequestMapping(value="/getModel", method = RequestMethod.GET)
38   - public List<Map<String,Object>> getModel(@RequestParam String line, @RequestParam String startDate, @RequestParam String endDate){
39   - return peopleCarPlanService.getModel(line, startDate, endDate);
  38 + public List<Map<String,Object>> getModel(@RequestParam Map<String, Object> map){
  39 + return peopleCarPlanService.getModel(map);
40 40 }
41 41  
42 42 @RequestMapping(value="/firstAndLastBus", method = RequestMethod.GET)
43   - public List<Map<String,Object>> firstAndLastBus(@RequestParam String line, @RequestParam String date, @RequestParam String type){
44   - return peopleCarPlanService.firstAndLastBus(line, date, type);
  43 + public List<Map<String,Object>> firstAndLastBus(@RequestParam Map<String, Object> map){
  44 + return peopleCarPlanService.firstAndLastBus(map);
45 45 }
46 46  
47 47 @RequestMapping(value="/commandState", method = RequestMethod.GET)
48   - public List<Map<String,Object>> commandState(@RequestParam String line, @RequestParam String date, @RequestParam String code){
49   - return peopleCarPlanService.commandState(line, date, code);
  48 + public List<Map<String,Object>> commandState(@RequestParam Map<String, Object> map){
  49 + return peopleCarPlanService.commandState(map);
50 50 }
51 51  
52 52 }
... ...
src/main/java/com/bsth/data/BasicData.java
... ... @@ -25,6 +25,12 @@ import java.util.concurrent.TimeUnit;
25 25 */
26 26 @Component
27 27 public class BasicData implements CommandLineRunner {
  28 +
  29 + //公司代码和公司名对照(K: 公司编码,V:公司名)
  30 + public static Map<String, String> businessCodeNameMap;
  31 +
  32 + //分公司公司代码和分公司公司名对照(K: 公司编码+分公司编码,V:分公司公司名)
  33 + public static Map<String, String> businessFgsCodeNameMap;
28 34  
29 35 //设备号和车辆自编号 (K: 设备编码 ,V:车辆自编号)
30 36 public static BiMap<String, String> deviceId2NbbmMap;
... ... @@ -107,6 +113,9 @@ public class BasicData implements CommandLineRunner {
107 113  
108 114 @Autowired
109 115 PersonnelRepository personnelRepository;
  116 +
  117 + @Autowired
  118 + BusinessRepository businessRepository;
110 119  
111 120  
112 121 @Override
... ... @@ -132,6 +141,8 @@ public class BasicData implements CommandLineRunner {
132 141 loadStationRouteInfo();
133 142 //人员信息
134 143 loadPersonnelInfo();
  144 + //公司信息
  145 + loadBusinessInfo();
135 146 logger.info("加载基础数据成功!,");
136 147 } catch (Exception e) {
137 148 logger.error("加载基础数据时出现异常,", e);
... ... @@ -164,6 +175,23 @@ public class BasicData implements CommandLineRunner {
164 175 }
165 176  
166 177 /**
  178 + * loadBusinessInfo
  179 + * (公司代码公司名对照)
  180 + */
  181 + public void loadBusinessInfo(){
  182 + Map<String, String> businessMap=new HashMap<String,String>();
  183 + Map<String, String> businessFgsMap=new HashMap<String,String>();
  184 + Iterator<Business> busIter=businessRepository.findAll().iterator();
  185 + Business t;
  186 + while(busIter.hasNext()){
  187 + t=busIter.next();
  188 + businessMap.put(t.getBusinessCode(), t.getBusinessName());
  189 + businessFgsMap.put(t.getBusinessCode()+"_"+t.getUpCode(), t.getBusinessName());
  190 + }
  191 + businessCodeNameMap=businessMap;
  192 + businessFgsCodeNameMap=businessFgsMap;
  193 + }
  194 + /**
167 195 * @Title: loadDeviceInfo
168 196 * @Description: TODO(加载设备相关信息)
169 197 */
... ...
src/main/java/com/bsth/data/forecast/ForecastRealServer.java
... ... @@ -61,7 +61,7 @@ public class ForecastRealServer implements CommandLineRunner {
61 61 @Override
62 62 public void run(String... arg0) throws Exception {
63 63 //2小时更新一次站点间耗时数据
64   - Application.mainServices.scheduleWithFixedDelay(dataLoader, 12, 120 * 60, TimeUnit.SECONDS);
  64 +// Application.mainServices.scheduleWithFixedDelay(dataLoader, 12, 120 * 60, TimeUnit.SECONDS);
65 65 }
66 66  
67 67 /**
... ...
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
... ... @@ -117,13 +117,13 @@ public class DayOfSchedule implements CommandLineRunner {
117 117 @Override
118 118 public void run(String... arg0) throws Exception {
119 119 //翻班线程
120   - Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS);
  120 +// Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS);
121 121 //入库
122   - Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS);
  122 +// Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS);
123 123 //首班出场指令补发器
124   - Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 30, 240, TimeUnit.SECONDS);
  124 +// Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 30, 240, TimeUnit.SECONDS);
125 125 //班次误点扫描
126   - Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS);
  126 +// Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS);
127 127  
128 128 //每天凌晨2点20提交数据到运管处
129 129 long diff = (DateUtils.getTimestamp() + 1000*60*140) - System.currentTimeMillis();
... ...
src/main/java/com/bsth/entity/mcy_forms/Allline.java 0 → 100644
  1 +package com.bsth.entity.mcy_forms;
  2 +
  3 +public class Allline {
  4 +
  5 + private String rq;//日期
  6 +
  7 + private String gs;//公司
  8 +
  9 + private String zhgs;//直属公司
  10 +
  11 + private String fgs;//分公司
  12 +
  13 + private String xl;//线路条数
  14 +
  15 + private String xlmc;//线路名称
  16 +
  17 + private String gsgs;
  18 + private String fgsgs;
  19 +
  20 + private String size;
  21 +
  22 +
  23 + public String getGsgs() {
  24 + return gsgs;
  25 + }
  26 +
  27 + public void setGsgs(String gsgs) {
  28 + this.gsgs = gsgs;
  29 + }
  30 +
  31 + public String getFgsgs() {
  32 + return fgsgs;
  33 + }
  34 +
  35 + public void setFgsgs(String fgsgs) {
  36 + this.fgsgs = fgsgs;
  37 + }
  38 +
  39 +
  40 + public String getSize() {
  41 + return size;
  42 + }
  43 +
  44 + public void setSize(String size) {
  45 + this.size = size;
  46 + }
  47 +
  48 + public String getZhgs() {
  49 + return zhgs;
  50 + }
  51 +
  52 + public void setZhgs(String zhgs) {
  53 + this.zhgs = zhgs;
  54 + }
  55 +
  56 + public String getXlmc() {
  57 + return xlmc;
  58 + }
  59 +
  60 + public void setXlmc(String xlmc) {
  61 + this.xlmc = xlmc;
  62 + }
  63 +
  64 + private String cchjh;//出车数计划
  65 +
  66 + private String cchsj;//出车数计划
  67 +
  68 + private String cchqz;//出车数权证
  69 +
  70 + private String chl;//出车率
  71 +
  72 + private String bcjh;//班次计划
  73 +
  74 + private String bcsj;//班次实际
  75 +
  76 + private String bbzxl;//班次执行率
  77 +
  78 + private String sm;//说明
  79 +
  80 + public String getRq() {
  81 + return rq;
  82 + }
  83 +
  84 + public void setRq(String rq) {
  85 + this.rq = rq;
  86 + }
  87 +
  88 + public String getGs() {
  89 + return gs;
  90 + }
  91 +
  92 + public void setGs(String gs) {
  93 + this.gs = gs;
  94 + }
  95 +
  96 + public String getFgs() {
  97 + return fgs;
  98 + }
  99 +
  100 + public void setFgs(String fgs) {
  101 + this.fgs = fgs;
  102 + }
  103 +
  104 + public String getXl() {
  105 + return xl;
  106 + }
  107 +
  108 + public void setXl(String xl) {
  109 + this.xl = xl;
  110 + }
  111 +
  112 + public String getCchjh() {
  113 + return cchjh;
  114 + }
  115 +
  116 + public void setCchjh(String cchjh) {
  117 + this.cchjh = cchjh;
  118 + }
  119 +
  120 + public String getCchsj() {
  121 + return cchsj;
  122 + }
  123 +
  124 + public void setCchsj(String cchsj) {
  125 + this.cchsj = cchsj;
  126 + }
  127 +
  128 + public String getCchqz() {
  129 + return cchqz;
  130 + }
  131 +
  132 + public void setCchqz(String cchqz) {
  133 + this.cchqz = cchqz;
  134 + }
  135 +
  136 + public String getChl() {
  137 + return chl;
  138 + }
  139 +
  140 + public void setChl(String chl) {
  141 + this.chl = chl;
  142 + }
  143 +
  144 + public String getBcjh() {
  145 + return bcjh;
  146 + }
  147 +
  148 + public void setBcjh(String bcjh) {
  149 + this.bcjh = bcjh;
  150 + }
  151 +
  152 + public String getBcsj() {
  153 + return bcsj;
  154 + }
  155 +
  156 + public void setBcsj(String bcsj) {
  157 + this.bcsj = bcsj;
  158 + }
  159 +
  160 + public String getBbzxl() {
  161 + return bbzxl;
  162 + }
  163 +
  164 + public void setBbzxl(String bbzxl) {
  165 + this.bbzxl = bbzxl;
  166 + }
  167 +
  168 + public String getSm() {
  169 + return sm;
  170 + }
  171 +
  172 + public void setSm(String sm) {
  173 + this.sm = sm;
  174 + }
  175 +
  176 +
  177 +
  178 +
  179 +}
... ...
src/main/java/com/bsth/entity/mcy_forms/Executionrate.java 0 → 100644
  1 +package com.bsth.entity.mcy_forms;
  2 +
  3 +public class Executionrate {
  4 +
  5 + private String rq;//日期
  6 +
  7 + private String gs;//公司
  8 +
  9 + private String zhgs;//直属公司
  10 +
  11 + private String fgs;//分公司
  12 +
  13 + private String xl;//线路条数
  14 +
  15 + private String xlmc;//线路名称
  16 +
  17 + private String gsgs;
  18 + private String fgsgs;
  19 +
  20 + private String size;
  21 +
  22 +
  23 + public String getGsgs() {
  24 + return gsgs;
  25 + }
  26 +
  27 + public void setGsgs(String gsgs) {
  28 + this.gsgs = gsgs;
  29 + }
  30 +
  31 + public String getFgsgs() {
  32 + return fgsgs;
  33 + }
  34 +
  35 + public void setFgsgs(String fgsgs) {
  36 + this.fgsgs = fgsgs;
  37 + }
  38 +
  39 +
  40 + public String getSize() {
  41 + return size;
  42 + }
  43 +
  44 + public void setSize(String size) {
  45 + this.size = size;
  46 + }
  47 +
  48 + public String getZhgs() {
  49 + return zhgs;
  50 + }
  51 +
  52 + public void setZhgs(String zhgs) {
  53 + this.zhgs = zhgs;
  54 + }
  55 +
  56 + public String getXlmc() {
  57 + return xlmc;
  58 + }
  59 +
  60 + public void setXlmc(String xlmc) {
  61 + this.xlmc = xlmc;
  62 + }
  63 +
  64 + private String cchjh;//出车数计划
  65 +
  66 + private String cchsj;//出车数计划
  67 +
  68 + private String cchqz;//出车数权证
  69 +
  70 + private String chl;//出车率
  71 +
  72 + private String bcjh;//班次计划
  73 +
  74 + private String bcsj;//班次实际
  75 +
  76 + private String bbzxl;//班次执行率
  77 +
  78 + private String sm;//说明
  79 +
  80 + public String getRq() {
  81 + return rq;
  82 + }
  83 +
  84 + public void setRq(String rq) {
  85 + this.rq = rq;
  86 + }
  87 +
  88 + public String getGs() {
  89 + return gs;
  90 + }
  91 +
  92 + public void setGs(String gs) {
  93 + this.gs = gs;
  94 + }
  95 +
  96 + public String getFgs() {
  97 + return fgs;
  98 + }
  99 +
  100 + public void setFgs(String fgs) {
  101 + this.fgs = fgs;
  102 + }
  103 +
  104 + public String getXl() {
  105 + return xl;
  106 + }
  107 +
  108 + public void setXl(String xl) {
  109 + this.xl = xl;
  110 + }
  111 +
  112 + public String getCchjh() {
  113 + return cchjh;
  114 + }
  115 +
  116 + public void setCchjh(String cchjh) {
  117 + this.cchjh = cchjh;
  118 + }
  119 +
  120 + public String getCchsj() {
  121 + return cchsj;
  122 + }
  123 +
  124 + public void setCchsj(String cchsj) {
  125 + this.cchsj = cchsj;
  126 + }
  127 +
  128 + public String getCchqz() {
  129 + return cchqz;
  130 + }
  131 +
  132 + public void setCchqz(String cchqz) {
  133 + this.cchqz = cchqz;
  134 + }
  135 +
  136 + public String getChl() {
  137 + return chl;
  138 + }
  139 +
  140 + public void setChl(String chl) {
  141 + this.chl = chl;
  142 + }
  143 +
  144 + public String getBcjh() {
  145 + return bcjh;
  146 + }
  147 +
  148 + public void setBcjh(String bcjh) {
  149 + this.bcjh = bcjh;
  150 + }
  151 +
  152 + public String getBcsj() {
  153 + return bcsj;
  154 + }
  155 +
  156 + public void setBcsj(String bcsj) {
  157 + this.bcsj = bcsj;
  158 + }
  159 +
  160 + public String getBbzxl() {
  161 + return bbzxl;
  162 + }
  163 +
  164 + public void setBbzxl(String bbzxl) {
  165 + this.bbzxl = bbzxl;
  166 + }
  167 +
  168 + public String getSm() {
  169 + return sm;
  170 + }
  171 +
  172 + public void setSm(String sm) {
  173 + this.sm = sm;
  174 + }
  175 +
  176 +
  177 +
  178 +}
... ...
src/main/java/com/bsth/entity/mcy_forms/Turnoutrate.java 0 → 100644
  1 +package com.bsth.entity.mcy_forms;
  2 +
  3 +public class Turnoutrate {
  4 +private String rq;//日期
  5 +
  6 + private String gs;//公司
  7 +
  8 + private String zhgs;//直属公司
  9 +
  10 + private String fgs;//分公司
  11 +
  12 + private String xl;//线路条数
  13 +
  14 + private String xlmc;//线路名称
  15 +
  16 + private String gsgs;
  17 + private String fgsgs;
  18 +
  19 + private String size;
  20 +
  21 +
  22 + public String getGsgs() {
  23 + return gsgs;
  24 + }
  25 +
  26 + public void setGsgs(String gsgs) {
  27 + this.gsgs = gsgs;
  28 + }
  29 +
  30 + public String getFgsgs() {
  31 + return fgsgs;
  32 + }
  33 +
  34 + public void setFgsgs(String fgsgs) {
  35 + this.fgsgs = fgsgs;
  36 + }
  37 +
  38 +
  39 + public String getSize() {
  40 + return size;
  41 + }
  42 +
  43 + public void setSize(String size) {
  44 + this.size = size;
  45 + }
  46 +
  47 + public String getZhgs() {
  48 + return zhgs;
  49 + }
  50 +
  51 + public void setZhgs(String zhgs) {
  52 + this.zhgs = zhgs;
  53 + }
  54 +
  55 + public String getXlmc() {
  56 + return xlmc;
  57 + }
  58 +
  59 + public void setXlmc(String xlmc) {
  60 + this.xlmc = xlmc;
  61 + }
  62 +
  63 + private String cchjh;//出车数计划
  64 +
  65 + private String cchsj;//出车数计划
  66 +
  67 + private String cchqz;//出车数权证
  68 +
  69 + private String chl;//出车率
  70 +
  71 + private String bcjh;//班次计划
  72 +
  73 + private String bcsj;//班次实际
  74 +
  75 + private String bbzxl;//班次执行率
  76 +
  77 + private String sm;//说明
  78 +
  79 + public String getRq() {
  80 + return rq;
  81 + }
  82 +
  83 + public void setRq(String rq) {
  84 + this.rq = rq;
  85 + }
  86 +
  87 + public String getGs() {
  88 + return gs;
  89 + }
  90 +
  91 + public void setGs(String gs) {
  92 + this.gs = gs;
  93 + }
  94 +
  95 + public String getFgs() {
  96 + return fgs;
  97 + }
  98 +
  99 + public void setFgs(String fgs) {
  100 + this.fgs = fgs;
  101 + }
  102 +
  103 + public String getXl() {
  104 + return xl;
  105 + }
  106 +
  107 + public void setXl(String xl) {
  108 + this.xl = xl;
  109 + }
  110 +
  111 + public String getCchjh() {
  112 + return cchjh;
  113 + }
  114 +
  115 + public void setCchjh(String cchjh) {
  116 + this.cchjh = cchjh;
  117 + }
  118 +
  119 + public String getCchsj() {
  120 + return cchsj;
  121 + }
  122 +
  123 + public void setCchsj(String cchsj) {
  124 + this.cchsj = cchsj;
  125 + }
  126 +
  127 + public String getCchqz() {
  128 + return cchqz;
  129 + }
  130 +
  131 + public void setCchqz(String cchqz) {
  132 + this.cchqz = cchqz;
  133 + }
  134 +
  135 + public String getChl() {
  136 + return chl;
  137 + }
  138 +
  139 + public void setChl(String chl) {
  140 + this.chl = chl;
  141 + }
  142 +
  143 + public String getBcjh() {
  144 + return bcjh;
  145 + }
  146 +
  147 + public void setBcjh(String bcjh) {
  148 + this.bcjh = bcjh;
  149 + }
  150 +
  151 + public String getBcsj() {
  152 + return bcsj;
  153 + }
  154 +
  155 + public void setBcsj(String bcsj) {
  156 + this.bcsj = bcsj;
  157 + }
  158 +
  159 + public String getBbzxl() {
  160 + return bbzxl;
  161 + }
  162 +
  163 + public void setBbzxl(String bbzxl) {
  164 + this.bbzxl = bbzxl;
  165 + }
  166 +
  167 + public String getSm() {
  168 + return sm;
  169 + }
  170 +
  171 + public void setSm(String sm) {
  172 + this.sm = sm;
  173 + }
  174 +
  175 +
  176 +}
... ...
src/main/java/com/bsth/entity/oil/Cwjy.java
... ... @@ -6,6 +6,9 @@ import javax.persistence.Entity;
6 6 import javax.persistence.GeneratedValue;
7 7 import javax.persistence.Id;
8 8 import javax.persistence.Table;
  9 +import javax.persistence.Transient;
  10 +
  11 +import com.bsth.data.BasicData;
9 12  
10 13 @Entity
11 14 @Table(name = "bsth_c_cwjy")
... ... @@ -24,6 +27,11 @@ public class Cwjy {
24 27  
25 28 private Date createDate;
26 29  
  30 + @Transient
  31 + private String gsname;
  32 +
  33 + @Transient
  34 + private String fgsname;
27 35 public Integer getId() {
28 36 return id;
29 37 }
... ... @@ -71,6 +79,22 @@ public class Cwjy {
71 79 public void setCreateDate(Date createDate) {
72 80 this.createDate = createDate;
73 81 }
  82 +
  83 + public String getGsname() {
  84 + return BasicData.businessCodeNameMap.get(this.gsdm);
  85 + }
  86 +
  87 + public void setGsname(String gsname) {
  88 + this.gsname = gsname;
  89 + }
  90 +
  91 + public String getFgsname() {
  92 + return BasicData.businessFgsCodeNameMap.get(this.fgsdm+"_"+this.gsdm);
  93 + }
  94 +
  95 + public void setFgsname(String fgsname) {
  96 + this.fgsname = fgsname;
  97 + }
74 98  
75 99  
76 100 }
... ...
src/main/java/com/bsth/entity/oil/Cyl.java
... ... @@ -6,6 +6,9 @@ import javax.persistence.Entity;
6 6 import javax.persistence.GeneratedValue;
7 7 import javax.persistence.Id;
8 8 import javax.persistence.Table;
  9 +import javax.persistence.Transient;
  10 +
  11 +import com.bsth.data.BasicData;
9 12  
10 13 @Entity
11 14 @Table(name = "bsth_c_cyl")
... ... @@ -25,6 +28,16 @@ public class Cyl {
25 28 private Double cxrl;
26 29 //公司代码
27 30 private String gsdm;
  31 +
  32 + @Transient
  33 + private String gsname;
  34 +
  35 + @Transient
  36 + private String fgsname;
  37 +
  38 + //分公司代码
  39 + private String fgsdm;
  40 +
28 41 public Integer getId() {
29 42 return id;
30 43 }
... ... @@ -72,4 +85,30 @@ public class Cyl {
72 85 public void setGsdm(String gsdm){
73 86 this.gsdm=gsdm;
74 87 }
  88 +
  89 + public String getFgsdm() {
  90 + return fgsdm;
  91 + }
  92 +
  93 + public void setFgsdm(String fgsdm) {
  94 + this.fgsdm = fgsdm;
  95 + }
  96 +
  97 + public String getGsname() {
  98 + return BasicData.businessCodeNameMap.get(this.gsdm);
  99 + }
  100 +
  101 + public void setGsname(String gsname) {
  102 + this.gsname = gsname;
  103 + }
  104 +
  105 + public String getFgsname() {
  106 + return BasicData.businessFgsCodeNameMap.get(this.fgsdm+"_"+this.gsdm);
  107 + }
  108 +
  109 + public void setFgsname(String fgsname) {
  110 + this.fgsname = fgsname;
  111 + }
  112 +
  113 +
75 114 }
... ...
src/main/java/com/bsth/entity/oil/Ylb.java
... ... @@ -291,7 +291,7 @@ public class Ylb {
291 291 }
292 292  
293 293 public String getGsname() {
294   - return BasicData.nbbm2CompanyCodeMap.get(this.nbbm);
  294 + return BasicData.businessCodeNameMap.get(this.ssgsdm);
295 295 }
296 296  
297 297 public void setGsname(String gsname) {
... ...
src/main/java/com/bsth/entity/oil/Ylxxb.java
... ... @@ -10,6 +10,8 @@ import javax.persistence.Transient;
10 10  
11 11 import org.springframework.format.annotation.DateTimeFormat;
12 12  
  13 +import com.bsth.data.BasicData;
  14 +
13 15 @Entity
14 16 @Table(name = "bsth_c_ylxxb")
15 17 public class Ylxxb {
... ... @@ -25,6 +27,7 @@ public class Ylxxb {
25 27 private String stationid;
26 28 private Date createtime;
27 29 private String gsdm;
  30 + private String fgsdm;
28 31 private String yp;
29 32 private String jyggh;
30 33 private Double yj;
... ... @@ -37,6 +40,10 @@ public class Ylxxb {
37 40 private String ldgh;
38 41 //0为接口数据,1为手工输入
39 42 private int jylx=0;
  43 + @Transient
  44 + private String gsname;
  45 + @Transient
  46 + private String fgsname;
40 47  
41 48  
42 49 public Integer getId() {
... ... @@ -93,6 +100,14 @@ public class Ylxxb {
93 100 public void setGsdm(String gsdm) {
94 101 this.gsdm = gsdm;
95 102 }
  103 +
  104 +
  105 + public String getFgsdm() {
  106 + return fgsdm;
  107 + }
  108 + public void setFgsdm(String fgsdm) {
  109 + this.fgsdm = fgsdm;
  110 + }
96 111 public String getYp() {
97 112 return yp;
98 113 }
... ... @@ -154,6 +169,20 @@ public class Ylxxb {
154 169 this.jylx = jylx;
155 170 }
156 171  
  172 + public String getGsname() {
  173 + return BasicData.businessCodeNameMap.get(this.gsdm);
  174 + }
  175 +
  176 + public void setGsname(String gsname) {
  177 + this.gsname = gsname;
  178 + }
157 179  
  180 + public String getFgsname() {
  181 + return BasicData.businessFgsCodeNameMap.get(this.fgsdm+"_"+this.gsdm);
  182 + }
  183 +
  184 + public void setFgsname(String fgsname) {
  185 + this.fgsname = fgsname;
  186 + }
158 187  
159 188 }
... ...
src/main/java/com/bsth/entity/search/PredicatesBuilder.java
... ... @@ -8,7 +8,9 @@ import javax.persistence.criteria.Predicate;
8 8 import java.text.NumberFormat;
9 9 import java.text.ParseException;
10 10 import java.text.SimpleDateFormat;
  11 +import java.util.ArrayList;
11 12 import java.util.Date;
  13 +import java.util.List;
12 14  
13 15 /**
14 16 *
... ... @@ -58,6 +60,15 @@ public class PredicatesBuilder {
58 60 return cb.notEqual(expression, object);
59 61 }
60 62  
  63 + public static Predicate in(CriteriaBuilder cb,Path<?> expression, Object object){
  64 + String[] obj=object.toString().split(",");
  65 + List<String> list=new ArrayList<String>();
  66 + for(int i=0;i<obj.length;i++){
  67 + list.add(obj[i]);
  68 + }
  69 + return cb.in(expression).value(list);
  70 + }
  71 +
61 72 public static Predicate gt(CriteriaBuilder cb,Path<Number> expression, Object object){
62 73 try {
63 74 return cb.gt(expression, nf.parse(object.toString()));
... ...
src/main/java/com/bsth/entity/search/SearchOperator.java
... ... @@ -26,5 +26,6 @@ public enum SearchOperator {
26 26 isNotNull, // 非空
27 27 isf, //假 isFalse,boolean
28 28 ist, //真 isTrue,boolean
29   - date //时间
  29 + date, //时间
  30 + in //数组
30 31 }
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -82,7 +82,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
82 82 @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and bcType='normal' order by bcs")
83 83 List<ScheduleRealInfo> queryListWaybill2(String jName,String clZbh,String lpName,String date);
84 84  
85   - @Query(value="select s from ScheduleRealInfo s where s.jGh = ?1 and s.clZbh = ?2 and s.scheduleDate = str_to_date(?3,'%Y-%m-%d') and bcType='normal' order by bcs")
  85 + @Query(value="select s from ScheduleRealInfo s where s.jGh = ?1 and s.clZbh = ?2 and s.scheduleDate = str_to_date(?3,'%Y-%m-%d') order by bcs")
86 86 List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date);
87 87  
88 88 @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2")
... ...
src/main/java/com/bsth/service/BusIntervalService.java 0 → 100644
  1 +package com.bsth.service;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +
  7 +public interface BusIntervalService {
  8 +
  9 + List<Map<String, Object>> getDir(Map<String, Object> map);
  10 +
  11 + List<Map<String, Object>> interval(Map<String, Object> map);
  12 +
  13 + Map<String, Object> timeAndSpeed(Map<String, Object> map);
  14 +
  15 + List<Map<String, Object>> lineTimeAnaliy(Map<String, Object> map);
  16 +
  17 + List<Map<String, Object>> lbStatuAnaly(Map<String, Object> map);
  18 +
  19 + List<Map<String, Object>> correctStatis(Map<String, Object> map);
  20 +}
... ...
src/main/java/com/bsth/service/forms/FormsService.java
... ... @@ -3,12 +3,15 @@ package com.bsth.service.forms;
3 3 import java.util.List;
4 4 import java.util.Map;
5 5  
  6 +import com.bsth.entity.mcy_forms.Allline;
6 7 import com.bsth.entity.mcy_forms.Changetochange;
  8 +import com.bsth.entity.mcy_forms.Executionrate;
7 9 import com.bsth.entity.mcy_forms.Linepasswengerflow;
8 10 import com.bsth.entity.mcy_forms.Operationservice;
9 11 import com.bsth.entity.mcy_forms.Shifday;
10 12 import com.bsth.entity.mcy_forms.Shiftuehiclemanth;
11 13 import com.bsth.entity.mcy_forms.Singledata;
  14 +import com.bsth.entity.mcy_forms.Turnoutrate;
12 15 import com.bsth.entity.mcy_forms.Vehicleloading;
13 16 import com.bsth.entity.mcy_forms.Waybillday;
14 17  
... ... @@ -17,8 +20,6 @@ public interface FormsService {
17 20  
18 21 public List<Waybillday> waybillday(Map<String, Object> map);
19 22  
20   - List<Waybillday> waybilldayExcel(Map<String, Object> map);
21   -
22 23 public List<Linepasswengerflow> linepasswengerflow(Map<String, Object> map);
23 24  
24 25 public List<Shiftuehiclemanth> shiftuehiclemanth(Map<String, Object> map);
... ... @@ -32,4 +33,10 @@ public interface FormsService {
32 33 public List<Vehicleloading> vehicleloading(String line,String data);
33 34  
34 35 public List<Operationservice> operationservice(Map<String, Object> map);
  36 +
  37 + public List<Turnoutrate> turnoutrate(Map<String, Object> map);
  38 +
  39 + public List<Executionrate> executionrate(Map<String, Object> map);
  40 +
  41 + public List<Allline> allline(Map<String, Object> map);
35 42 }
... ...
src/main/java/com/bsth/service/forms/impl/ExportServiceImpl.java
... ... @@ -270,4 +270,5 @@ public class ExportServiceImpl implements ExportService{
270 270 }
271 271  
272 272  
  273 +
273 274 }
... ...
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
1 1 package com.bsth.service.forms.impl;
2 2  
  3 +import java.math.BigDecimal;
  4 +import java.math.MathContext;
  5 +import java.math.RoundingMode;
3 6 import java.sql.ResultSet;
4 7 import java.sql.SQLException;
5   -import java.text.DecimalFormat;
  8 +import java.text.NumberFormat;
6 9 import java.text.ParseException;
7 10 import java.text.SimpleDateFormat;
8 11 import java.util.ArrayList;
9 12 import java.util.Date;
10 13 import java.util.HashMap;
11   -import java.util.Iterator;
12 14 import java.util.List;
13 15 import java.util.Map;
14 16  
... ... @@ -22,379 +24,522 @@ import com.bsth.entity.mcy_forms.Operationservice;
22 24 import com.bsth.entity.mcy_forms.Shifday;
23 25 import com.bsth.entity.mcy_forms.Shiftuehiclemanth;
24 26 import com.bsth.entity.mcy_forms.Singledata;
  27 +import com.bsth.entity.mcy_forms.Turnoutrate;
25 28 import com.bsth.entity.mcy_forms.Vehicleloading;
26 29 import com.bsth.entity.mcy_forms.Waybillday;
  30 +import com.bsth.entity.mcy_forms.Allline;
27 31 import com.bsth.entity.mcy_forms.Changetochange;
  32 +import com.bsth.entity.mcy_forms.Executionrate;
28 33 import com.bsth.service.forms.FormsService;
29 34 import com.bsth.service.realcontrol.ScheduleRealInfoService;
30 35 import com.bsth.util.ReportRelatedUtils;
31 36 import com.bsth.util.ReportUtils;
32 37  
33 38 @Service
34   -public class FormsServiceImpl implements FormsService{
35   -
  39 +public class FormsServiceImpl implements FormsService {
  40 +
36 41 @Autowired
37 42 JdbcTemplate jdbcTemplate;
38   -
  43 +
39 44 @Autowired
40 45 ScheduleRealInfoService scheduleRealInfoService;
41   -
42   - //行车路单日报表
  46 +
  47 + // 行车路单日报表
43 48 @Override
44 49 public List<Waybillday> waybillday(Map<String, Object> map) {
45   - List list1=new ArrayList<>();//
46   - String sql = "select y.RQ,y.XLBM,y.NBBM,y.JSY,y.JZL,y.YH,y.YH,c.personnel_name from bsth_c_ylb y" +
47   - " LEFT JOIN bsth_c_personnel c ON c.job_code=y.JSY " +
48   - " where to_days(y.RQ)=to_days('"+map.get("date").toString()+"') " +
49   - " and y.XLBM="+map.get("line").toString()+
50   - " GROUP BY y.NBBM";
51   -
  50 + List list1 = new ArrayList<>();//
  51 + String sql ="select x.schedule_date,x.j_gh,x.cl_zbh,z.JZL,z.YH,z.personnel_name "
  52 + + "from bsth_c_s_sp_info_real x INNER join "
  53 + + "( select y.RQ,y.XLBM,y.NBBM,y.JSY,y.JZL,y.YH,c.personnel_name from"
  54 + + " bsth_c_ylb y LEFT JOIN bsth_c_personnel c ON c.job_code=y.JSY "
  55 + + "where to_days(y.RQ)=to_days('"+map.get("date").toString() + "') and y.XLBM= '"+ map.get("line").toString()+"' GROUP BY y.NBBM) "
  56 + + "z on x.cl_zbh=z.nbbm where to_days( x.schedule_date)=to_days('"+map.get("date").toString()+"') "
  57 + + "and x.xl_bm='"+map.get("line").toString()+"' GROUP BY x.cl_zbh,j_gh";
52 58 List<Waybillday> list = jdbcTemplate.query(sql, new RowMapper<Waybillday>() {
53 59 @Override
54 60 public Waybillday mapRow(ResultSet arg0, int arg1) throws SQLException {
55 61 Waybillday wbd = new Waybillday();
56   - wbd.setCarPlate(arg0.getString("NBBM"));
  62 + wbd.setCarPlate(arg0.getString("cl_zbh"));
57 63 wbd.setJzl(arg0.getString("JZL"));
58 64 wbd.setYh(arg0.getString("YH"));
59 65 wbd.setjName(arg0.getString("personnel_name"));
60   - //wbd.setZlc(arg0.getInt("zlc"));
61   - //System.out.println(arg0.getObject("yl"));
62   - //wbd.setYl(arg0.getString("yl"));
63   - //wbd.setNbbm(arg0.getString("nbbm"));
64   - Map<String, Object> maps=new HashMap<>();
65   - maps=scheduleRealInfoService.findKMBC2(arg0.getString("JSY"), arg0.getString("nbbm"), arg0.getString("RQ"));
  66 + // wbd.setZlc(arg0.getInt("zlc"));
  67 + // System.out.println(arg0.getObject("yl"));
  68 + // wbd.setYl(arg0.getString("yl"));
  69 + // wbd.setNbbm(arg0.getString("nbbm"));
  70 + Map<String, Object> maps = new HashMap<>();
  71 + maps = scheduleRealInfoService.findKMBC2(arg0.getString("j_gh"), arg0.getString("cl_zbh"),
  72 + arg0.getString("schedule_date"));
66 73 wbd.setJzl1(maps.get("ksgl").toString());
67 74 wbd.setZlc(maps.get("realMileage").toString());
68   -// {realMileage=211.20, cjbc=2, ljbc=0, remMileage=38.40, ksgl=0.00,
69   -// jhlc=211.20, sjbc=9, jhbc=11, addMileage=0.00, yygl=211.20
70   -
  75 +
71 76 return wbd;
72   -
  77 +
73 78 }
74 79 });
75 80 return list;
76 81 }
77   -
78   -
79   -
80   - //线路客流量报表
  82 +
  83 + // 线路客流量报表
81 84 @Override
82 85 public List<Linepasswengerflow> linepasswengerflow(Map<String, Object> map) {
83   - String sql = " SELECT s.station_name,l.name,l.create_date from bsth_c_stationroute s " +
84   - " LEFT JOIN bsth_c_line l on s.line_code=l.line_code " +
85   - " where to_days(l.create_date)=to_days('"+map.get("date").toString()+"') " +
86   - " and l.line_code="+map.get("line").toString()+
87   - " GROUP BY s.station_name ";
88   -
  86 + String sql = " SELECT s.station_name,l.name,l.create_date from bsth_c_stationroute s "
  87 + + " LEFT JOIN bsth_c_line l on s.line_code=l.line_code "
  88 + + " where to_days(l.create_date)=to_days('"+map.get("date").toString() + "') "
  89 + + " and l.line_code=" + map.get("line").toString()
  90 + + " GROUP BY s.station_name ";
  91 +
89 92 List<Linepasswengerflow> list = jdbcTemplate.query(sql, new RowMapper<Linepasswengerflow>() {
90 93  
91 94 @Override
92 95 public Linepasswengerflow mapRow(ResultSet arg0, int arg1) throws SQLException {
93 96 Linepasswengerflow lin = new Linepasswengerflow();
94   - lin.setStationName(arg0.getString("station_name"));
95   -
  97 + lin.setStationName(arg0.getString("station_name"));
  98 +
96 99 return lin;
97 100 }
98 101 });
99 102 return list;
100 103 }
101 104  
  105 + // 班次车辆人员月统计
  106 + String startDate;
  107 + String endDate;
102 108  
103   - //导出
104 109 @Override
105   - public List<Waybillday> waybilldayExcel(Map<String,Object> map) {
106   - ReportUtils ee = new ReportUtils();
107   - ReportRelatedUtils rru = new ReportRelatedUtils();
108   - List<Iterator<?>> list = new ArrayList<Iterator<?>>();
109   - List<Waybillday> Waybilldays = waybillday(map);
110   - List<Map<String,Object>> listMap = new ArrayList<Map<String,Object>>();
111   -
112   - DecimalFormat format = new DecimalFormat("0.00");
113   - String jName=null;
114   - Map<String,Object> map1 = new HashMap<>();
115   - for(Waybillday Waybillday : Waybilldays){
116   - map1.put("carPlate", Waybillday.getCarPlate());
117   - map1.put("jzl1", Waybillday.getJzl1());
118   - map1.put("jzl", Waybillday.getJzl());
119   - map1.put("yh", Waybillday.getYh());
120   - map1.put("jName", Waybillday.getjName());
121   - jName=Waybillday.getjName();
122   - map1.put("zlc", Waybillday.getZlc());
123   - }
124   -//
125   -// //计算里程和班次数,并放入Map里
126   -// map1 = new HashMap<String, Object>();
127   -// map1.put("jhlc", format.format(jhlc));
128   -// map1.put("remMileage", format.format(remMileage));
129   -// map1.put("addMileage", format.format(addMileage));
130   -// map1.put("yygl", format.format(yygl));
131   -// map1.put("ksgl", format.format(ksgl));
132   -// map1.put("realMileage", format.format(yygl+ksgl));
133   -// map1.put("jhbc", jhbc);
134   -// map1.put("cjbc", cjbc);
135   -// map1.put("ljbc", ljbc);
136   -// map1.put("sjbc", jhbc-cjbc+ljbc);
137   -
138   - String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
139   -
140   - list.add(listMap.iterator());
141   - ee.excelReplace(list, new Object[] { Waybilldays.get(0),map1 }, path+"mould\\waybill_minhang.xls",
142   - path+"export\\" + jName + ".xls");
143   - return Waybilldays;
144   - }
  110 + public List<Shiftuehiclemanth> shiftuehiclemanth(Map<String, Object> map) {
  111 + List list1 = new ArrayList<>();//
  112 + String sql = "select r.j_name,r.schedule_date_str,r.update_date,r.cl_zbh " + " from bsth_c_s_sp_info_real r "
  113 + + " LEFT JOIN bsth_c_s_ttinfo_detail d on r.lp_name=d.lp "
  114 + + " LEFT JOIN bsth_c_line_information l on l.line=r.lp_name "
  115 + + " where to_days(r.schedule_date_str) BETWEEN to_days('" + map.get("startDate").toString() + "') "
  116 + + " and to_days('" + map.get("endDate").toString() + "') " + " and r.xl_bm='"
  117 + + map.get("line").toString() + "' " + " GROUP BY r.j_name" + " ORDER BY r.j_name";
  118 + startDate = map.get("startDate").toString();
  119 + endDate = map.get("endDate").toString();
  120 + List<Shiftuehiclemanth> list = jdbcTemplate.query(sql, new RowMapper<Shiftuehiclemanth>() {
145 121  
  122 + @Override
  123 + public Shiftuehiclemanth mapRow(ResultSet arg0, int arg1) throws SQLException {
  124 + Shiftuehiclemanth shif = new Shiftuehiclemanth();
  125 + shif.setjName(arg0.getString("j_name"));
146 126  
147   - //班次车辆人员月统计
148   - String startDate;
149   - String endDate;
  127 + Map<String, Object> maps = new HashMap<>();
  128 +
  129 + maps = scheduleRealInfoService.findKMBC1(arg0.getString("j_name"), arg0.getString("cl_zbh"), startDate,
  130 + endDate);
  131 + shif.setJhlc(maps.get("jhlc").toString());
  132 + shif.setEmptMileage(maps.get("ksgl").toString());
  133 + shif.setRemMileage(maps.get("remMileage").toString());
  134 + shif.setAddMileage(maps.get("addMileage").toString());
  135 + shif.setTotalm(maps.get("realMileage").toString());
  136 + shif.setCjbc(maps.get("cjbc").toString());
  137 + shif.setLjbc(maps.get("ljbc").toString());
  138 + shif.setSjbc(maps.get("sjbc").toString());
  139 +
  140 + return shif;
  141 +
  142 + }
  143 + });
  144 +
  145 + return list;
  146 + }
  147 +
  148 + // 班次车辆人员日统计
150 149 @Override
151   - public List<Shiftuehiclemanth> shiftuehiclemanth( Map<String, Object> map) {
152   - List list1=new ArrayList<>();//
153   - String sql = "select r.j_name,r.schedule_date_str,r.update_date,r.cl_zbh " +
154   - " from bsth_c_s_sp_info_real r " +
155   - " LEFT JOIN bsth_c_s_ttinfo_detail d on r.lp_name=d.lp " +
156   - " LEFT JOIN bsth_c_line_information l on l.line=r.lp_name " +
157   - " where to_days(r.schedule_date_str) BETWEEN to_days('"+map.get("startDate").toString()+"') " +
158   - " and to_days('"+map.get("endDate").toString()+"') " +
159   - " and r.xl_bm='"+map.get("line").toString() +"' " +
160   - " GROUP BY r.j_name" +
161   - " ORDER BY r.j_name";
162   - startDate=map.get("startDate").toString();
163   - endDate=map.get("endDate").toString();
164   - List<Shiftuehiclemanth> list = jdbcTemplate.query(sql, new RowMapper<Shiftuehiclemanth>() {
165   -
166   - @Override
167   - public Shiftuehiclemanth mapRow(ResultSet arg0, int arg1) throws SQLException {
168   - Shiftuehiclemanth shif = new Shiftuehiclemanth();
169   - shif.setjName(arg0.getString("j_name"));
170   -
171   - Map<String, Object> maps=new HashMap<>();
172   -
173   - maps=scheduleRealInfoService.findKMBC1(arg0.getString("j_name"), arg0.getString("cl_zbh"), startDate , endDate );
174   - shif.setJhlc(maps.get("jhlc").toString());
175   - shif.setEmptMileage(maps.get("ksgl").toString());
176   - shif.setRemMileage(maps.get("remMileage").toString());
177   - shif.setAddMileage(maps.get("addMileage").toString());
178   - shif.setTotalm(maps.get("realMileage").toString());
179   - shif.setCjbc(maps.get("cjbc").toString());
180   - shif.setLjbc(maps.get("ljbc").toString());
181   - shif.setSjbc(maps.get("sjbc").toString());
182   -
183   - return shif;
184   -
185   - }
186   - });
187   -
188   - return list;
  150 + public List<Shifday> shifday(Map<String, Object> map) {
  151 + String sql = " select r.lp_name,r.xl_name,r.j_name,r.s_name, r.cl_zbh,r.xl_bm,r.schedule_date,r.cl_zbh,r.j_gh "
  152 + + " FROM bsth_c_s_sp_info_real r " + " where to_days(r.schedule_date)=to_days('"
  153 + + map.get("date").toString() + "') and r.xl_bm=" + map.get("line").toString() + " GROUP BY r.j_name ";
  154 +
  155 + List<Shifday> list = jdbcTemplate.query(sql, new RowMapper<Shifday>() {
  156 +
  157 + @Override
  158 + public Shifday mapRow(ResultSet arg0, int arg1) throws SQLException {
  159 + Shifday shifday = new Shifday();
  160 + shifday.setjName(arg0.getString("j_name").toString());
  161 + shifday.setsName(arg0.getString("s_name") == null ? "" : arg0.getString("s_name").toString());
  162 + shifday.setLpName(arg0.getString("r.lp_name").toString());
  163 + shifday.setCarPlate(arg0.getString("cl_zbh").toString());
  164 +
  165 + Map<String, Object> map = new HashMap<>();
  166 + map = scheduleRealInfoService.findKMBC2(arg0.getString("j_gh"), arg0.getString("cl_zbh"),
  167 + arg0.getString("schedule_date"));
  168 + shifday.setJhlc(map.get("jhlc").toString());// 计划里程
  169 + // shifday.setSjjhlc(map.get("remMileage").toString());//实际计划里程
  170 + shifday.setYygl(map.get("yygl").toString());// 营运里程
  171 + shifday.setEmptMileage(map.get("ksgl").toString());// 空驶里程
  172 + shifday.setRemMileage(map.get("remMileage").toString());// 抽减里程
  173 + shifday.setAddMileage(map.get("addMileage").toString());// 增加里程
  174 + shifday.setTotalm(map.get("realMileage").toString());// 总里程
  175 + shifday.setJhbc(map.get("jhbc").toString());// 计划班次
  176 + // shifday.setSjjhbc(map.get("sjjhbc").toString());//实际计划班次
  177 + shifday.setCjbc(map.get("cjbc").toString());// 抽减班次
  178 + shifday.setLjbc(map.get("ljbc").toString());// 增加班次
  179 + shifday.setSjbc(map.get("sjbc").toString());// 实际班次
  180 + return shifday;
  181 + }
  182 + });
  183 + return list;
189 184 }
190 185  
  186 + // 换人换车情况日统计
  187 + String rq;
191 188  
192   - //班次车辆人员日统计
193 189 @Override
194   - public List<Shifday> shifday(Map<String, Object> map) {
195   - String sql = " select r.lp_name,r.xl_name,r.j_name,r.s_name, r.cl_zbh,r.xl_bm,r.schedule_date,r.cl_zbh,r.j_gh " +
196   - " FROM bsth_c_s_sp_info_real r " +
197   - " where to_days(r.schedule_date)=to_days('"+map.get("date").toString()+"') and r.xl_bm="+map.get("line").toString()+
198   - " GROUP BY r.j_name ";
199   -
200   - List<Shifday> list = jdbcTemplate.query(sql, new RowMapper<Shifday>() {
201   -
202   - @Override
203   - public Shifday mapRow(ResultSet arg0, int arg1) throws SQLException {
204   - Shifday shifday = new Shifday();
205   - shifday.setjName(arg0.getString("j_name").toString());
206   - shifday.setsName(arg0.getString("s_name")==null?"":arg0.getString("s_name").toString());
207   - shifday.setLpName(arg0.getString("r.lp_name").toString());
208   - shifday.setCarPlate(arg0.getString("cl_zbh").toString());
209   -
210   - Map<String, Object> map=new HashMap<>();
211   - map=scheduleRealInfoService.findKMBC2(arg0.getString("j_gh"), arg0.getString("cl_zbh"), arg0.getString("schedule_date"));
212   - shifday.setJhlc(map.get("jhlc").toString());//计划里程
213   - //shifday.setSjjhlc(map.get("remMileage").toString());//实际计划里程
214   - shifday.setYygl(map.get("yygl").toString());//营运里程
215   - shifday.setEmptMileage(map.get("ksgl").toString());//空驶里程
216   - shifday.setRemMileage(map.get("remMileage").toString());//抽减里程
217   - shifday.setAddMileage(map.get("addMileage").toString());//增加里程
218   - shifday.setTotalm(map.get("realMileage").toString());//总里程
219   - shifday.setJhbc(map.get("jhbc").toString());//计划班次
220   - //shifday.setSjjhbc(map.get("sjjhbc").toString());//实际计划班次
221   - shifday.setCjbc(map.get("cjbc").toString());//抽减班次
222   - shifday.setLjbc(map.get("ljbc").toString());//增加班次
223   - shifday.setSjbc(map.get("sjbc").toString());//实际班次
224   - return shifday;
  190 + public List<Changetochange> changetochange(Map<String, Object> map) {
  191 +
  192 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  193 + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日");
  194 + Date d = null;
  195 + Date d1 = null;
  196 + try {
  197 + d = sdf.parse(map.get("startDate").toString());
  198 + d1 = sdf.parse(map.get("endDate").toString());
  199 + } catch (ParseException e) {
  200 +
  201 + e.printStackTrace();
225 202 }
226   - });
227   - return list;
228   - }
  203 + String rq2 = sdf1.format(d);
  204 + String rq3 = sdf1.format(d1);
  205 +
  206 + rq = rq2 + "-" + rq3;
  207 +
  208 + String sql = " select c.*,l.line_code from bsth_c_chtoch c LEFT JOIN bsth_c_line l on c.xl=l.name WHERE 1=1 ";
  209 + if (!map.get("startDate").toString().equals(" ") && !map.get("endDate").toString().equals(" ")) {
  210 + sql += "and DATE_FORMAT( c.rq,'%Y-%m-%d') BETWEEN '" + map.get("startDate").toString() + "' and '"
  211 + + map.get("endDate").toString() + "'";
  212 + }
  213 + if (!map.get("line").equals("")) {
  214 + sql += "and line_code='" + map.get("line") + "'";
  215 + }
  216 + if (map.get("sel").equals("2")) {
  217 + sql += " and c.pcch!=c.pcry";
  218 + } else if (map.get("sel").equals("1")) {
  219 + sql += " and c.jhgh!=c.sjgh";
  220 + }
  221 +
  222 + List<Changetochange> list = jdbcTemplate.query(sql, new RowMapper<Changetochange>() {
229 223  
230   - //换人换车情况日统计
231   - String rq;
232 224 @Override
233   - public List<Changetochange> changetochange(Map<String, Object> map) {
234   -
235   - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd") ;
236   - SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日") ;
237   - Date d = null ;
238   - Date d1 = null ;
239   - try {
240   - d = sdf.parse(map.get("startDate").toString());
241   - d1 = sdf.parse(map.get("endDate").toString());
242   - } catch (ParseException e) {
243   -
244   - e.printStackTrace();
245   - }
246   - String rq2=sdf1.format(d);
247   - String rq3=sdf1.format(d1);
248   -
249   - rq=rq2+"-"+ rq3;
250   -
251   - String sql=" select c.*,l.line_code from bsth_c_chtoch c LEFT JOIN bsth_c_line l on c.xl=l.name WHERE 1=1 ";
252   - if(!map.get("startDate").toString().equals(" ")&&!map.get("endDate").toString().equals(" ")){
253   - sql+= "and DATE_FORMAT( c.rq,'%Y-%m-%d') BETWEEN '"+map.get("startDate").toString()+"' and '"+map.get("endDate").toString()+"'";
254   - }
255   - if(!map.get("line").equals("")){
256   - sql+="and line_code='"+map.get("line")+"'";
257   - }
258   - if(map.get("sel").equals("2")){
259   - sql+=" and c.pcch!=c.pcry";
260   - }else if(map.get("sel").equals("1")){
261   - sql+=" and c.jhgh!=c.sjgh";
262   - }
263   -
264   -
265   - List<Changetochange> list = jdbcTemplate.query(sql, new RowMapper<Changetochange>() {
266   -
267   - @Override
268   - public Changetochange mapRow(ResultSet arg0, int arg1) throws SQLException {
269   - Changetochange chan= new Changetochange();
270   -
271   - chan.setRq(rq);
272   - chan.setGs(arg0.getString("gs").toString());
273   - chan.setFgs(arg0.getString("fgs").toString());
274   - chan.setXl(arg0.getString("xl").toString());
275   - chan.setLp(arg0.getString("lp").toString());
276   - chan.setFssj(arg0.getString("fssj").toString());
277   - chan.setXgsj(arg0.getString("xgsj").toString());
278   - chan.setPcch(arg0.getString("pcch").toString());
279   - chan.setPcry(arg0.getString("pcry").toString());
280   - chan.setJhch(arg0.getString("jhch").toString());
281   - chan.setJhgh(arg0.getString("jhgh").toString());
282   - chan.setSjch(arg0.getString("sjch").toString());
283   - chan.setSjgh(arg0.getString("sjgh").toString());
284   - chan.setYy(arg0.getString("yy").toString());
285   - chan.setXgr(arg0.getString("xgr").toString());
286   - return chan;
287   - }
288   - });
289   - return list;
290   - }
  225 + public Changetochange mapRow(ResultSet arg0, int arg1) throws SQLException {
  226 + Changetochange chan = new Changetochange();
291 227  
  228 + chan.setRq(rq);
  229 + chan.setGs(arg0.getString("gs").toString());
  230 + chan.setFgs(arg0.getString("fgs").toString());
  231 + chan.setXl(arg0.getString("xl").toString());
  232 + chan.setLp(arg0.getString("lp").toString());
  233 + chan.setFssj(arg0.getString("fssj").toString());
  234 + chan.setXgsj(arg0.getString("xgsj").toString());
  235 + chan.setPcch(arg0.getString("pcch").toString());
  236 + chan.setPcry(arg0.getString("pcry").toString());
  237 + chan.setJhch(arg0.getString("jhch").toString());
  238 + chan.setJhgh(arg0.getString("jhgh").toString());
  239 + chan.setSjch(arg0.getString("sjch").toString());
  240 + chan.setSjgh(arg0.getString("sjgh").toString());
  241 + chan.setYy(arg0.getString("yy").toString());
  242 + chan.setXgr(arg0.getString("xgr").toString());
  243 + return chan;
  244 + }
  245 + });
  246 + return list;
  247 + }
292 248  
293   - //路单数据
  249 + // 路单数据
294 250 @Override
295 251 public List<Singledata> singledata(Map<String, Object> map) {
296   -
297   - String sql = " SELECT y.RQ,y.SSGSDM,y.XLBM,y.NBBM,y.JSY,y.YH,y.JZL " +
298   - " FROM bsth_c_ylb y" +
299   - " where y.RQ BETWEEN '"+map.get("startDate").toString() +"'" +
300   - " and '"+map.get("endDate").toString()+"'"+
301   - " and y.XLBM='"+map.get("line").toString()+"'"+
302   - " GROUP BY y.NBBM ";
303   -
304   - List<Singledata> list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
305   - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
306   - @Override
307   - public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
308   - Singledata sin = new Singledata();
309   - sin.setrQ(sdf.format(arg0.getDate("rq")));
310   - sin.setgS(arg0.getString("SSGSDM").toString());
311   - sin.setxL(arg0.getString("XLBM").toString());
312   - sin.setClzbh(arg0.getString("NBBM").toString());
313   - sin.setJsy(arg0.getString("JSY").toString());
314   - sin.setHyl(arg0.getString("YH").toString());
315   - sin.setJzl(arg0.getString("JZL").toString());
316   - // sin.setJzl(arg0.getString(""));//非营业性用油
317   - sin.setJhjl(arg0.getString("JZL"));
318   - Map<String, Object> maps=new HashMap<>();
319   - maps=scheduleRealInfoService.findKMBC2(sin.getJsy(),sin.getClzbh(),sin.getrQ());
320   - sin.setjName(maps.get("j_name")==null?"":maps.get("j_name").toString());
321   - sin.setSgh(maps.get("s_gh")==null?"":maps.get("s_gh").toString());
322   - sin.setsName(maps.get("s_name")==null?"":maps.get("s_name").toString());
323   - sin.setJhlc(maps.get("yygl")==null?"":maps.get("yygl").toString());
324   - sin.setEmptMileage(maps.get("ksgl")==null?"":maps.get("ksgl").toString());
325   - sin.setJhjl(maps.get("jhlc")==null?"":maps.get("jhlc").toString());
326   -
327   - return sin;
328   - }
329   - });
330   - return list;
331   -}
332 252  
  253 + String sql = " SELECT y.RQ,y.SSGSDM,y.XLBM,y.NBBM,y.JSY,y.YH,y.JZL " + " FROM bsth_c_ylb y"
  254 + + " where y.RQ BETWEEN '" + map.get("startDate").toString() + "'" + " and '"
  255 + + map.get("endDate").toString() + "'" + " and y.XLBM='" + map.get("line").toString() + "'"
  256 + + " GROUP BY y.NBBM ";
333 257  
334   - //运营服务阶段报表
  258 + List<Singledata> list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
  259 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  260 +
  261 + @Override
  262 + public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
  263 + Singledata sin = new Singledata();
  264 + sin.setrQ(sdf.format(arg0.getDate("rq")));
  265 + sin.setgS(arg0.getString("SSGSDM").toString());
  266 + sin.setxL(arg0.getString("XLBM").toString());
  267 + sin.setClzbh(arg0.getString("NBBM").toString());
  268 + sin.setJsy(arg0.getString("JSY").toString());
  269 + sin.setHyl(arg0.getString("YH").toString());
  270 + sin.setJzl(arg0.getString("JZL").toString());
  271 + // sin.setJzl(arg0.getString(""));//非营业性用油
  272 + sin.setJhjl(arg0.getString("JZL"));
  273 + Map<String, Object> maps = new HashMap<>();
  274 + maps = scheduleRealInfoService.findKMBC2(sin.getJsy(), sin.getClzbh(), sin.getrQ());
  275 + sin.setjName(maps.get("j_name") == null ? "" : maps.get("j_name").toString());
  276 + sin.setSgh(maps.get("s_gh") == null ? "" : maps.get("s_gh").toString());
  277 + sin.setsName(maps.get("s_name") == null ? "" : maps.get("s_name").toString());
  278 + sin.setJhlc(maps.get("yygl") == null ? "" : maps.get("yygl").toString());
  279 + sin.setEmptMileage(maps.get("ksgl") == null ? "" : maps.get("ksgl").toString());
  280 + sin.setJhjl(maps.get("jhlc") == null ? "" : maps.get("jhlc").toString());
  281 +
  282 + return sin;
  283 + }
  284 + });
  285 + return list;
  286 + }
  287 +
  288 + // 运营服务阶段报表
335 289 @Override
336 290 public List<Operationservice> operationservice(Map<String, Object> map) {
337   -
338   - String sql = " SELECT y.RQ,y.XLBM,y.NBBM,y.JSY,y.YH,y.JZL " +
339   - " FROM bsth_c_ylb y" +
340   - " where y.RQ BETWEEN '"+map.get("startDate").toString() +"'" +
341   - " and '"+map.get("endDate").toString()+"'"+
342   - " and y.XLBM='"+map.get("line").toString()+"'"+
343   - " GROUP BY y.NBBM ";
344   -
345   - List<Operationservice> list = jdbcTemplate.query(sql, new RowMapper<Operationservice>() {
346   - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
347   - @Override
348   - public Operationservice mapRow(ResultSet arg0, int arg1) throws SQLException {
349   - Singledata sin = new Singledata();
350   - Operationservice op = new Operationservice();
351   - op.setXlName(arg0.getString("XLBM").toString());
352   - op.setJzl(arg0.getString("JZL").toString());
353   - op.setXhl(arg0.getString("YH").toString());
354   - Map<String, Object> maps=new HashMap<>();
355   - maps=scheduleRealInfoService.findKMBC2(sin.getJsy(),sin.getClzbh(),sin.getrQ());
356   - op.setXsgl(maps.get("yygl").toString()==null?"":maps.get("yygl").toString());
357   - op.setEmptMileage(maps.get("ksgl").toString()==null?"":maps.get("ksgl").toString());
358   - op.setSjbc(maps.get("sjbc").toString()==null?"":maps.get("sjbc").toString());
359   - return op;
360   - }
361   - });
362   - return list;
  291 +
  292 + String sql = " SELECT y.RQ,y.XLBM,y.NBBM,y.JSY,y.YH,y.JZL " + " FROM bsth_c_ylb y" + " where y.RQ BETWEEN '"
  293 + + map.get("startDate").toString() + "'" + " and '" + map.get("endDate").toString() + "'"
  294 + + " and y.XLBM='" + map.get("line").toString() + "'" + " GROUP BY y.NBBM ";
  295 +
  296 + List<Operationservice> list = jdbcTemplate.query(sql, new RowMapper<Operationservice>() {
  297 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  298 +
  299 + @Override
  300 + public Operationservice mapRow(ResultSet arg0, int arg1) throws SQLException {
  301 + Singledata sin = new Singledata();
  302 + Operationservice op = new Operationservice();
  303 + op.setXlName(arg0.getString("XLBM").toString());
  304 + op.setJzl(arg0.getString("JZL").toString());
  305 + op.setXhl(arg0.getString("YH").toString());
  306 + Map<String, Object> maps = new HashMap<>();
  307 + maps = scheduleRealInfoService.findKMBC2(sin.getJsy(), sin.getClzbh(), sin.getrQ());
  308 + op.setXsgl(maps.get("yygl").toString() == null ? "" : maps.get("yygl").toString());
  309 + op.setEmptMileage(maps.get("ksgl").toString() == null ? "" : maps.get("ksgl").toString());
  310 + op.setSjbc(maps.get("sjbc").toString() == null ? "" : maps.get("sjbc").toString());
  311 + return op;
  312 + }
  313 + });
  314 + return list;
363 315 }
364 316  
  317 + // 车辆加注
  318 + @Override
  319 + public List<Vehicleloading> vehicleloading(String line, String data) {
  320 +
  321 + String sql = " SELECT y.RQ,y.SSGSDM,y.XLBM,y.NBBM,y.JSY,y.YH,y.JZL " + " FROM bsth_c_ylb y "
  322 + + " where to_days(y.RQ)=to_days('" + data + "')" + " and y.XLBM='" + line + "' "
  323 + + " GROUP BY y.NBBM ";
  324 +
  325 + List<Vehicleloading> list = jdbcTemplate.query(sql, new RowMapper<Vehicleloading>() {
  326 + @Override
  327 + public Vehicleloading mapRow(ResultSet arg0, int arg1) throws SQLException {
  328 + Vehicleloading ve = new Vehicleloading();
  329 + ve.setrQ(arg0.getString("RQ").toString());
  330 + ve.setgS(arg0.getString("SSDM").toString());
  331 + ve.setxL(arg0.getString("XLBM").toString());
  332 + ve.setClzbh(arg0.getString("NBBM").toString());
  333 + ve.setHyl(arg0.getString("YH").toString());
  334 + ve.setJzl(arg0.getString("JZL").toString());
  335 + // ve.setLs(arg0.getString("").toString());//尿素
  336 + Map<String, Object> maps = new HashMap<>();
  337 + maps = scheduleRealInfoService.findKMBC2(arg0.getString("JSY"), arg0.getString("NBBM"),
  338 + arg0.getString("RQ"));
  339 + ve.setJhlc(maps.get("yygl") == null ? "" : maps.get("yygl").toString());
  340 + ve.setJhbc(maps.get("jhbc").toString() == null ? "" : maps.get("jhbc").toString());// 计划班次
  341 + ve.setSjbc(maps.get("sjbc").toString() == null ? "" : maps.get("sjbc").toString());// 实际班次
  342 + return ve;
  343 + }
  344 + });
  345 + return list;
  346 + }
  347 +
  348 + // 营运线路出车率统计表
  349 + @Override
  350 + public List<Turnoutrate> turnoutrate(Map<String, Object> map) {
  351 +
  352 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  353 + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日");
  354 + Date d = null;
  355 + Date d1 = null;
  356 + try {
  357 + d = sdf.parse(map.get("startDate").toString());
  358 + d1 = sdf.parse(map.get("endDate").toString());
  359 + } catch (ParseException e) {
  360 +
  361 + e.printStackTrace();
  362 + }
  363 + String rq2 = sdf1.format(d);
  364 + String rq3 = sdf1.format(d1);
  365 +
  366 + rq = rq2 + "-" + rq3;
  367 +
  368 + String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm,b.warrant_car from "
  369 + + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl"
  370 + + " from bsth_c_s_sp_info" + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '"
  371 + + map.get("startDate").toString() + "' and '" + map.get("endDate").toString() + "' and xl_bm='"
  372 + + map.get("line").toString() + "' AND gs_bm is not null"
  373 + + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name ) a left JOIN ("
  374 + + "SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl,t.warrant_car "
  375 + + "from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl from bsth_c_s_sp_info_real "
  376 + + "where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '" + map.get("startDate").toString() + "' and '"
  377 + + map.get("endDate").toString() + "' and xl_bm='" + map.get("line").toString()
  378 + + "' AND gs_bm is not null "
  379 + + "GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name) b ON t.company=b.gs_bm) b on "
  380 + + " a.gs_bm=b.gs_bm and a.fgs_bm=b.fgs_bm and a.xl_bm=b.xl_bm ";
  381 + List<Turnoutrate> list = jdbcTemplate.query(sql, new RowMapper<Turnoutrate>() {
  382 +
  383 + @Override
  384 + public Turnoutrate mapRow(ResultSet arg0, int arg1) throws SQLException {
  385 + Turnoutrate tu = new Turnoutrate();
  386 + NumberFormat numberFormat = NumberFormat.getInstance();
  387 + numberFormat.setMaximumFractionDigits(2);
  388 + String result1 = numberFormat.format((float) Integer.parseInt(arg0.getString("scl"))
  389 + / (float) Integer.parseInt(arg0.getString("jcl")) * 100);
  390 + String result2 = numberFormat.format((float) Integer.parseInt(arg0.getString("sbc"))
  391 + / (float) Integer.parseInt(arg0.getString("jbc")) * 100);
  392 + tu.setRq(rq);
  393 + tu.setGs(arg0.getString("gs_name").toString());
  394 + tu.setZhgs(arg0.getString("fgs_name").toString());
  395 + tu.setXl(arg0.getString("xlgs"));
  396 + tu.setXlmc(arg0.getString("sxl"));
  397 + tu.setCchjh(arg0.getString("jcl").toString());
  398 + tu.setCchsj(arg0.getString("scl").toString());
  399 + tu.setCchqz(arg0.getString("sxl").toString());
  400 + tu.setChl(result1 + "%");// 出车率
  401 + tu.setBcjh(arg0.getString("jbc").toString());
  402 + tu.setBcsj(arg0.getString("sbc").toString());
  403 + tu.setBbzxl(result2 + "%");// 班次执行率
  404 + // tu.setSm(arg0.getString("gs_name").toString());
  405 + tu.setGsgs(arg0.getString("gslsbm").toString());
  406 + tu.setFgsgs(arg0.getString("fgsbm").toString());
  407 + return tu;
  408 + }
  409 +
  410 + });
  411 +
  412 + return list;
  413 + }
365 414  
366   - //车辆加注
367 415 @Override
368   - public List<Vehicleloading> vehicleloading(String line,String data) {
369   -
370   - String sql = " SELECT y.RQ,y.SSGSDM,y.XLBM,y.NBBM,y.JSY,y.YH,y.JZL " +
371   - " FROM bsth_c_ylb y " +
372   - " where to_days(y.RQ)=to_days('"+data +"')" +
373   - " and y.XLBM='"+line+"' "+
374   - " GROUP BY y.NBBM ";
375   -
376   - List<Vehicleloading> list = jdbcTemplate.query(sql, new RowMapper<Vehicleloading>() {
377   - @Override
378   - public Vehicleloading mapRow(ResultSet arg0, int arg1) throws SQLException {
379   - Vehicleloading ve = new Vehicleloading();
380   - ve.setrQ(arg0.getString("RQ").toString());
381   - ve.setgS(arg0.getString("SSGSDM").toString());
382   - ve.setxL(arg0.getString("XLBM").toString());
383   - ve.setClzbh(arg0.getString("NBBM").toString());
384   - ve.setHyl(arg0.getString("YH").toString());
385   - ve.setJzl(arg0.getString("JZL").toString());
386   - //ve.setLs(arg0.getString("").toString());//尿素
387   - Map<String, Object> maps=new HashMap<>();
388   - maps=scheduleRealInfoService.findKMBC2(arg0.getString("JSY"), arg0.getString("NBBM"), arg0.getString("RQ"));
389   - ve.setJhlc(maps.get("yygl")==null?"":maps.get("yygl").toString());
390   - ve.setJhbc(maps.get("jhbc").toString()==null?"":maps.get("jhbc").toString());//计划班次
391   - ve.setSjbc(maps.get("sjbc").toString()==null?"":maps.get("sjbc").toString());//实际班次
392   - return ve;
  416 + public List<Executionrate> executionrate(Map<String, Object> map) {
  417 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  418 + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日");
  419 + Date d = null;
  420 + Date d1 = null;
  421 + try {
  422 + d = sdf.parse(map.get("startDate").toString());
  423 + d1 = sdf.parse(map.get("endDate").toString());
  424 + } catch (ParseException e) {
  425 +
  426 + e.printStackTrace();
393 427 }
394   - });
395   - return list;
  428 + String rq2 = sdf1.format(d);
  429 + String rq3 = sdf1.format(d1);
  430 +
  431 + rq = rq2 + "-" + rq3;
  432 +
  433 + String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.xl_name,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm from "
  434 + + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl"
  435 + + " from bsth_c_s_sp_info" + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '"
  436 + + map.get("startDate").toString() + "' and '" + map.get("endDate").toString() + "' and xl_bm='"
  437 + + map.get("line").toString() + "' AND gs_bm is not null"
  438 + + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name ) a left JOIN ("
  439 + + "SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.xl_name,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl "
  440 + + "from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,xl_name,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl from bsth_c_s_sp_info_real "
  441 + + "where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '" + map.get("startDate").toString() + "' and '"
  442 + + map.get("endDate").toString() + "' and xl_bm='" + map.get("line").toString()
  443 + + "' AND gs_bm is not null "
  444 + + "GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name) b ON t.company=b.gs_bm) b on "
  445 + + " a.gs_bm=b.gs_bm and a.fgs_bm=b.fgs_bm and a.xl_bm=b.xl_bm ";
  446 + List<Executionrate> list = jdbcTemplate.query(sql, new RowMapper<Executionrate>() {
  447 +
  448 + @Override
  449 + public Executionrate mapRow(ResultSet arg0, int arg1) throws SQLException {
  450 + Executionrate tu = new Executionrate();
  451 + NumberFormat numberFormat = NumberFormat.getInstance();
  452 + numberFormat.setMaximumFractionDigits(2);
  453 + String result1 = numberFormat.format((float) Integer.parseInt(arg0.getString("scl"))
  454 + / (float) Integer.parseInt(arg0.getString("jcl")) * 100);
  455 + String result2 = numberFormat.format((float) Integer.parseInt(arg0.getString("sbc"))
  456 + / (float) Integer.parseInt(arg0.getString("jbc")) * 100);
  457 + tu.setRq(rq);
  458 + tu.setGs(arg0.getString("gs_name").toString());
  459 + tu.setZhgs(arg0.getString("fgs_name").toString());
  460 + tu.setXl(arg0.getString("xlgs"));
  461 + tu.setXlmc(arg0.getString("sxl"));
  462 + tu.setCchjh(arg0.getString("jcl").toString());
  463 + tu.setCchsj(arg0.getString("scl").toString());
  464 + tu.setCchqz(arg0.getString("sxl").toString());
  465 + tu.setChl(result1 + "%");// 出车率
  466 + tu.setBcjh(arg0.getString("jbc").toString());
  467 + tu.setBcsj(arg0.getString("sbc").toString());
  468 + tu.setBbzxl(result2 + "%");// 班次执行率
  469 + tu.setSm(arg0.getString("xl_name").toString());
  470 + tu.setGsgs(arg0.getString("gslsbm").toString());
  471 + tu.setFgsgs(arg0.getString("fgsbm").toString());
  472 + return tu;
  473 + }
  474 +
  475 + });
  476 +
  477 + return list;
396 478 }
397 479  
  480 + // 营运线路名称统计表
  481 + @Override
  482 + public List<Allline> allline(Map<String, Object> map) {
  483 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  484 + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日");
  485 + Date d = null;
  486 + Date d1 = null;
  487 + try {
  488 + d = sdf.parse(map.get("startDate").toString());
  489 + d1 = sdf.parse(map.get("endDate").toString());
  490 + } catch (ParseException e) {
398 491  
  492 + e.printStackTrace();
  493 + }
  494 + String rq2 = sdf1.format(d);
  495 + String rq3 = sdf1.format(d1);
399 496  
  497 + rq = rq2 + "-" + rq3;
  498 +
  499 + String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.xl_name,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm from "
  500 + + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl"
  501 + + " from bsth_c_s_sp_info" + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '"
  502 + + map.get("startDate").toString() + "' and '" + map.get("endDate").toString() + "' and xl_bm='"
  503 + + map.get("line").toString() + "' AND gs_bm is not null"
  504 + + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name ) a left JOIN ("
  505 + + "SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.xl_name,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl "
  506 + + "from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,xl_name,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl from bsth_c_s_sp_info_real "
  507 + + "where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '" + map.get("startDate").toString() + "' and '"
  508 + + map.get("endDate").toString() + "' and xl_bm='" + map.get("line").toString()
  509 + + "' AND gs_bm is not null "
  510 + + "GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name) b ON t.company=b.gs_bm) b on "
  511 + + " a.gs_bm=b.gs_bm and a.fgs_bm=b.fgs_bm and a.xl_bm=b.xl_bm ";
  512 + List<Allline> list = jdbcTemplate.query(sql, new RowMapper<Allline>() {
  513 +
  514 + @Override
  515 + public Allline mapRow(ResultSet arg0, int arg1) throws SQLException {
  516 + Allline tu = new Allline();
  517 + NumberFormat numberFormat = NumberFormat.getInstance();
  518 + numberFormat.setMaximumFractionDigits(2);
  519 + String result1 = numberFormat.format((float) Integer.parseInt(arg0.getString("scl"))
  520 + / (float) Integer.parseInt(arg0.getString("jcl")) * 100);
  521 + String result2 = numberFormat.format((float) Integer.parseInt(arg0.getString("sbc"))
  522 + / (float) Integer.parseInt(arg0.getString("jbc")) * 100);
  523 + tu.setRq(rq);
  524 + tu.setGs(arg0.getString("gs_name").toString());
  525 + tu.setZhgs(arg0.getString("fgs_name").toString());
  526 + tu.setXl(arg0.getString("xl_name"));
  527 + tu.setXlmc(arg0.getString("sxl"));
  528 + tu.setCchjh(arg0.getString("jcl").toString());
  529 + tu.setCchsj(arg0.getString("scl").toString());
  530 + tu.setCchqz(arg0.getString("sxl").toString());
  531 + tu.setChl(result1 + "%");// 出车率
  532 + tu.setBcjh(arg0.getString("jbc").toString());
  533 + tu.setBcsj(arg0.getString("sbc").toString());
  534 + tu.setBbzxl(result2 + "%");// 班次执行率
  535 + // tu.setSm(arg0.getString("xl_name").toString());
  536 + tu.setGsgs(arg0.getString("gslsbm").toString());
  537 + tu.setFgsgs(arg0.getString("fgsbm").toString());
  538 + return tu;
  539 + }
  540 +
  541 + });
  542 +
  543 + return list;
  544 + }
400 545 }
... ...
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java 0 → 100644
  1 +package com.bsth.service.impl;
  2 +
  3 +import java.sql.ResultSet;
  4 +import java.sql.SQLException;
  5 +import java.text.DecimalFormat;
  6 +import java.text.SimpleDateFormat;
  7 +import java.util.ArrayList;
  8 +import java.util.Collections;
  9 +import java.util.Comparator;
  10 +import java.util.Date;
  11 +import java.util.HashMap;
  12 +import java.util.List;
  13 +import java.util.Map;
  14 +
  15 +import org.springframework.beans.factory.annotation.Autowired;
  16 +import org.springframework.jdbc.core.JdbcTemplate;
  17 +import org.springframework.jdbc.core.RowMapper;
  18 +import org.springframework.stereotype.Service;
  19 +
  20 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  21 +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
  22 +import com.bsth.service.BusIntervalService;
  23 +import com.bsth.service.schedule.PeopleCarPlanService;
  24 +
  25 +
  26 +@Service
  27 +public class BusIntervalServiceImpl implements BusIntervalService {
  28 +
  29 + @Autowired
  30 + private PeopleCarPlanService peopleCarPlanService;
  31 +
  32 + @Autowired
  33 + private ScheduleRealInfoRepository scheduleRealInfoRepository;
  34 +
  35 + @Autowired
  36 + private JdbcTemplate jdbcTemplate;
  37 +
  38 + private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  39 + private DecimalFormat df = new DecimalFormat("##0.00");
  40 +
  41 + public List<ScheduleRealInfo> getSchedule(String company, String subCompany, String line, String startDate, String endDate, String model, String times){
  42 + List<Long> ttList = new ArrayList<Long>();
  43 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
  44 + List<ScheduleRealInfo> resList = new ArrayList<ScheduleRealInfo>();
  45 +
  46 + try {
  47 +
  48 + 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+"'";
  49 + if(line.length() != 0){
  50 + sql += " and xl_bm = '"+line+"'";
  51 + }
  52 + if(times.length() != 0){
  53 + String[] split = times.split("-");
  54 + sql += " and fcsj >= '"+split[0]+"' and fcsj <= '"+split[1]+"'";
  55 + }
  56 + if(company.length() != 0){
  57 + sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'";
  58 + }
  59 + sql += " and bc_type = 'normal'";
  60 +
  61 + list =jdbcTemplate.query(sql,
  62 + new RowMapper<ScheduleRealInfo>(){
  63 + @Override
  64 + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
  65 + ScheduleRealInfo schedule = new ScheduleRealInfo();
  66 + schedule.setScheduleDateStr(rs.getString("schedule_date_Str"));
  67 + schedule.setXlName(rs.getString("xl_name"));
  68 + schedule.setLpName(rs.getString("lp_name"));
  69 + schedule.setBcType(rs.getString("bc_type"));
  70 + schedule.setBcs(rs.getInt("bcs"));
  71 + schedule.setBcsj(rs.getInt("bcsj"));
  72 + schedule.setJhlc(rs.getDouble("jhlc"));
  73 + schedule.setDfsj(rs.getString("dfsj"));
  74 + schedule.setFcsj(rs.getString("fcsj"));
  75 + schedule.setFcsjActual(rs.getString("fcsj_actual"));
  76 + schedule.setZdsj(rs.getString("zdsj"));
  77 + schedule.setZdsjActual(rs.getString("zdsj_actual"));
  78 + schedule.setQdzName(rs.getString("qdz_name"));
  79 + schedule.setZdzName(rs.getString("zdz_name"));
  80 + schedule.setXlDir(rs.getString("xl_dir"));
  81 + schedule.setStatus(rs.getInt("status"));
  82 + schedule.setRemarks(rs.getString("remarks"));
  83 + schedule.setGsName(rs.getString("gs_name"));
  84 + schedule.setFgsName(rs.getString("fgs_name"));
  85 + schedule.setDfAuto(rs.getBoolean("df_auto"));
  86 + schedule.setOnline(rs.getBoolean("online"));
  87 + schedule.setClZbh(rs.getString("cl_zbh"));
  88 + schedule.setjGh(rs.getString("j_gh"));
  89 + schedule.setjName(rs.getString("j_name"));
  90 + schedule.setSpId(rs.getLong("sp_id"));
  91 + return schedule;
  92 + }
  93 + });
  94 +
  95 + 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'";
  98 +
  99 + ttList =jdbcTemplate.query(sql,
  100 + new RowMapper<Long>(){
  101 + @Override
  102 + public Long mapRow(ResultSet rs, int rowNum) throws SQLException {
  103 + return rs.getLong("id");
  104 + }
  105 + });
  106 + }
  107 +
  108 + } catch (Exception e) {
  109 + // TODO Auto-generated catch block
  110 + e.printStackTrace();
  111 + }
  112 +
  113 + //分组计算 同时判断是否所选时刻信息
  114 + for(ScheduleRealInfo schedule : list){
  115 + if(schedule.getFcsj() == null)
  116 + continue;
  117 + String[] fcsj = schedule.getFcsj().split(":");
  118 + String[] zdsj = schedule.getZdsj().split(":");
  119 + schedule.setFcsjT((Long.valueOf(fcsj[0]) * 60) + Long.valueOf(fcsj[1]));
  120 + schedule.setZdsjT((Long.valueOf(zdsj[0]) * 60) + Long.valueOf(zdsj[1]));
  121 + if(schedule.getFcsjActual() != null){
  122 + String[] fcsj_ = schedule.getFcsjActual().split(":");
  123 + schedule.setFcsjActualTime((Long.valueOf(fcsj_[0]) * 60) + Long.valueOf(fcsj_[1]));
  124 + }
  125 + if(schedule.getZdsjActual() != null){
  126 + String[] zdsj_ = schedule.getZdsjActual().split(":");
  127 + schedule.setZdsjActualTime((Long.valueOf(zdsj_[0]) * 60) + Long.valueOf(zdsj_[1]));
  128 + }
  129 + if(schedule.getDfsj() != null){
  130 + String[] dfsj = schedule.getDfsj().split(":");
  131 + schedule.setDfsjT((Long.valueOf(dfsj[0]) * 60) + Long.valueOf(dfsj[1]));
  132 + }
  133 + DO:{
  134 + if(model.length() != 0){
  135 + for(Long tt : ttList){
  136 + if(tt == schedule.getSpId()){
  137 + resList.add(schedule);
  138 + break DO;
  139 + }
  140 + }
  141 + } else {
  142 + resList.add(schedule);
  143 + }
  144 + }
  145 + }
  146 +
  147 + list = new ArrayList<ScheduleRealInfo>();
  148 + List<Long> keyList = new ArrayList<Long>();
  149 + Map<Long, List<ScheduleRealInfo>> keyMap = new HashMap<Long, List<ScheduleRealInfo>>();
  150 + for(ScheduleRealInfo schedule : resList){
  151 + Long key = schedule.getFcsjT();
  152 + if(!keyMap.containsKey(key)){
  153 + keyMap.put(key, new ArrayList<ScheduleRealInfo>());
  154 + keyList.add(key);
  155 + }
  156 + keyMap.get(key).add(schedule);
  157 + }
  158 + Collections.sort(keyList);
  159 + for(Long key : keyList){
  160 + for(ScheduleRealInfo schedule : keyMap.get(key)){
  161 + list.add(schedule);
  162 + }
  163 + }
  164 +
  165 + return list;
  166 + }
  167 +
  168 + @Override
  169 + public List<Map<String, Object>> getDir(Map<String, Object> map) {
  170 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  171 + List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
  172 +
  173 + String line = map.get("line").toString();
  174 +
  175 + try {
  176 +
  177 + String sql = "select start_station_name, end_station_name from bsth_c_line where line_code = '"+line+"'";
  178 +
  179 + list =jdbcTemplate.query(sql,
  180 + new RowMapper<Map<String, Object>>(){
  181 + @Override
  182 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  183 + Map<String, Object> m = new HashMap<String, Object>();
  184 + m.put("startStation", rs.getString("start_station_name"));
  185 + m.put("endStation", rs.getString("end_station_name"));
  186 + return m;
  187 + }
  188 + });
  189 +
  190 + } catch (Exception e) {
  191 + // TODO Auto-generated catch block
  192 + e.printStackTrace();
  193 + }
  194 +
  195 + for(Map<String, Object> m : list){
  196 + Map<String, Object> tempMap1 = new HashMap<String, Object>();
  197 + Map<String, Object> tempMap2 = new HashMap<String, Object>();
  198 + tempMap1.put("name", m.get("startStation"));
  199 + tempMap2.put("name", m.get("endStation"));
  200 + resList.add(tempMap1);
  201 + resList.add(tempMap2);
  202 + }
  203 +
  204 + return resList;
  205 + }
  206 +
  207 + @Override
  208 + public List<Map<String, Object>> interval(Map<String, Object> map) {
  209 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  210 + Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>();
  211 +
  212 + String company = map.get("company").toString();
  213 + String subCompany = map.get("subCompany").toString();
  214 + String line = map.get("line").toString();
  215 + String startDate = map.get("startDate").toString();
  216 + String endDate = map.get("endDate").toString();
  217 + String model = map.get("model").toString();
  218 + String times = map.get("times").toString();
  219 + String type = map.get("type").toString();
  220 +
  221 + if(startDate.length() == 0){
  222 + startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
  223 + }
  224 + if(endDate.length() == 0){
  225 + endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
  226 + }
  227 + if(times.length() == 0){
  228 + times = "06:00-07:00";
  229 + }
  230 +
  231 + List<ScheduleRealInfo> list = this.getSchedule(company, subCompany, line, startDate, endDate, model, times);
  232 +
  233 + String[] date1 = startDate.split("-");
  234 + String[] date2 = endDate.split("-");
  235 + startDate = date1[0] + "年" + date1[1] + "月" + date1[2] + "日";
  236 + endDate = date2[0] + "年" + date2[1] + "月" + date2[2] + "日";
  237 +
  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]);
  241 +
  242 + //分组统计班次间隔
  243 + 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 + }
  251 + }
  252 + 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>>();
  260 + for(ScheduleRealInfo schedule : keyMap.get(key)){
  261 + String date = schedule.getScheduleDateStr();
  262 + if(!temp.containsKey(date))
  263 + temp.put(date, new ArrayList<ScheduleRealInfo>());
  264 + temp.get(date).add(schedule);
  265 + }
  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();
  284 + }
  285 + }
  286 + }
  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", "/");
  308 + }
  309 + if(tempMap.get("jhInterval") != null && !tempMap.get("jhInterval").toString().equals("0") && !tempMap.get("jhInterval").toString().equals("/"))
  310 + resList.add(tempMap);
  311 + }
  312 +
  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);
  325 + }
  326 + }
  327 +
  328 + return tempList;
  329 + }
  330 +
  331 + @Override
  332 + public Map<String, Object> timeAndSpeed(Map<String, Object> map) {
  333 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  334 + List<Map<String, Object>> dateList = new ArrayList<Map<String, Object>>();
  335 + Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>();
  336 + Map<String, Object> modelMap = new HashMap<String, Object>();
  337 +
  338 + String company = map.get("company").toString();
  339 + String subCompany = map.get("subCompany").toString();
  340 + String line = map.get("line").toString();
  341 + String startDate = map.get("startDate").toString();
  342 + String endDate = map.get("endDate").toString();
  343 + String model = map.get("model").toString();
  344 + String times = map.get("times").toString();
  345 + String type = map.get("type").toString();
  346 + String zdzName = map.get("upDown").toString();
  347 +
  348 + if(startDate.length() == 0){
  349 + startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
  350 + }
  351 + if(endDate.length() == 0){
  352 + endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
  353 + }
  354 + if(times.length() == 0){
  355 + times = "06:00-07:00";
  356 + }
  357 +
  358 + List<ScheduleRealInfo> list = this.getSchedule(company, subCompany, line, startDate, endDate, model, times);
  359 +
  360 + String[] date1 = startDate.split("-");
  361 + String[] date2 = endDate.split("-");
  362 + startDate = date1[0] + "年" + date1[1] + "月" + date1[2] + "日";
  363 + 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]);
  368 +
  369 + 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>());
  380 + }
  381 + keyMap.get(key).add(schedule);
  382 + }
  383 +
  384 + long yysjSum = 0;
  385 + double yysdSum = 0;
  386 + long yssjSum = 0;
  387 + double yssdSum = 0;
  388 + for(String key : keyMap.keySet()){
  389 + 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)
  399 + companyName = schedule.getGsName();
  400 + if(schedule.getFgsName() != null && subCompanyName.length() == 0)
  401 + 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++;
  419 + }
  420 + }
  421 + }
  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 + tempMap.put("company", companyName);
  432 + tempMap.put("subCompany", subCompanyName);
  433 +
  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));
  439 + } else {
  440 + tempMap.put("yysd", "/");
  441 + }
  442 +
  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));
  448 + } else {
  449 + tempMap.put("yssd", "/");
  450 + }
  451 +
  452 + dateList.add(tempMap);
  453 + }
  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 + 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();
  464 + if(!keyMap2.containsKey(key))
  465 + keyMap2.put(key, new ArrayList<Map<String, Object>>());
  466 + keyMap2.get(key).add(m);
  467 + }
  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);
  476 + }
  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);
  481 + }
  482 + temp.get(num).add(m);
  483 + }
  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);
  489 + }
  490 + }
  491 + }
  492 +
  493 + modelMap.put("dateList", resList);
  494 + return modelMap;
  495 + }
  496 +
  497 + @Override
  498 + public List<Map<String, Object>> lineTimeAnaliy(Map<String, Object> map) {
  499 + List<Map<String, Object>> list0 = new ArrayList<Map<String,Object>>();
  500 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  501 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
  502 + Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>();
  503 + Map<String, List<Map<String, Object>>> keyMap0 = new HashMap<String, List<Map<String, Object>>>();
  504 + Map<String, List<Map<String, Object>>> keyMap1 = new HashMap<String, List<Map<String, Object>>>();
  505 +
  506 + String company = map.get("company").toString();
  507 + String subCompany = map.get("subCompany").toString();
  508 + String line = map.get("line").toString();
  509 + String startDate = map.get("startDate").toString();
  510 + String endDate = map.get("endDate").toString();
  511 + String model = map.get("model").toString();
  512 + String times = map.get("times").toString();
  513 + String type = map.get("type").toString();
  514 + String qdzName = map.get("upDown").toString();
  515 +
  516 + if(startDate.length() == 0){
  517 + startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
  518 + }
  519 + if(endDate.length() == 0){
  520 + endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
  521 + }
  522 + if(times.length() == 0){
  523 + times = "06:00-07:00";
  524 + }
  525 +
  526 + list = getSchedule(company, subCompany, line, startDate, endDate, model, times);
  527 +
  528 + String[] date1 = startDate.split("-");
  529 + String[] date2 = endDate.split("-");
  530 + startDate = date1[0] + "年" + date1[1] + "月" + date1[2] + "日";
  531 + endDate = date2[0] + "年" + date2[1] + "月" + date2[2] + "日";
  532 +
  533 + String[] split = times.split("-");
  534 + int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]);
  535 + int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]);
  536 +
  537 +
  538 + for(ScheduleRealInfo schedule : list){
  539 + if(qdzName.length() != 0 && !qdzName.equals(schedule.getQdzName())){
  540 + continue;
  541 + }
  542 + Long fcsj = schedule.getFcsjT();
  543 + if(!(endTime!=0?fcsj>=startTime&&fcsj<endTime:fcsj>=startTime)){
  544 + continue;
  545 + }
  546 + String key = schedule.getScheduleDateStr() + "/" + schedule.getXlName() + "/" + schedule.getLpName() + "/" + schedule.getFcsj() + "/" + schedule.getQdzName();
  547 + if(!keyMap.containsKey(key))
  548 + keyMap.put(key, new ArrayList<ScheduleRealInfo>());
  549 + keyMap.get(key).add(schedule);
  550 + }
  551 + for(String key : keyMap.keySet()){
  552 + 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;
  573 + String companyName = "", subCompanyName = "";
  574 + for(ScheduleRealInfo schedule : keyMap.get(key)){
  575 + if(schedule.getGsName() != null && companyName.length() == 0)
  576 + companyName = schedule.getGsName();
  577 + if(schedule.getFgsName() != null && subCompanyName.length() == 0)
  578 + subCompanyName = schedule.getFgsName();
  579 + long tzsj = 0l;
  580 + long yssj = 0l;
  581 + jhbc++;
  582 + if(schedule.getDfsj() != null){
  583 + jhtz += schedule.getFcsjT() - schedule.getDfsjT();
  584 + }
  585 + jhys += schedule.getZdsjT() - schedule.getFcsjT();
  586 +
  587 + if(schedule.getFcsjActual() != null && schedule.getZdsjActual() != null){
  588 + sjbc++;
  589 + sjfc += schedule.getFcsjActualTime();
  590 + yssj += schedule.getZdsjActualTime() - schedule.getFcsjActualTime();
  591 + if(schedule.getFcsjActualTime() - schedule.getFcsjT() < 0){
  592 + wdfc1 += schedule.getFcsjT() - schedule.getFcsjActualTime();
  593 + kbc++;
  594 + } else if(schedule.getFcsjActualTime() - schedule.getFcsjT() > 0){
  595 + wdfc2 += schedule.getFcsjActualTime() - schedule.getFcsjT();
  596 + mbc++;
  597 + }
  598 +
  599 + if(schedule.getDfsj() != null){
  600 + sjdf += schedule.getDfsjT();
  601 + tzsj += schedule.getFcsjActualTime() - schedule.getDfsjT();
  602 + if(schedule.getDfsjT() - schedule.getFcsjT() < 0)
  603 + wddf1 += schedule.getFcsjT() - schedule.getDfsjT();
  604 + else
  605 + wddf2 += schedule.getDfsjT() - schedule.getFcsjT();
  606 + } else {
  607 + sjdf += schedule.getFcsjT();
  608 + tzsj += schedule.getFcsjActualTime() - schedule.getFcsjT();
  609 + }
  610 + }
  611 +
  612 + sjys += yssj;
  613 + if(yssj > yssjMax || yssjMax == 0l)
  614 + yssjMax = yssj;
  615 + if(yssj < yssjMin || yssjMin == 0l)
  616 + yssjMin = yssj;
  617 +
  618 + sjtz += tzsj;
  619 + if(tzsj > tzsjMax || tzsjMax == 0l)
  620 + tzsjMax = tzsj;
  621 + if(tzsj < tzsjMin || tzsjMin == 0l)
  622 + tzsjMin = tzsj;
  623 + }
  624 + String[] keys = key.split("/");
  625 + tempMap.put("date", keys[0]);
  626 + tempMap.put("line", keys[1]);
  627 + tempMap.put("lp", keys[2]);
  628 + tempMap.put("jhdf", keys[3]);
  629 + tempMap.put("jhfc", keys[3]);
  630 + tempMap.put("station", keys[4]);
  631 + tempMap.put("times", times);
  632 + tempMap.put("company", companyName);
  633 + tempMap.put("subCompany", subCompanyName);
  634 + if(startDate.equals(endDate))
  635 + tempMap.put("dates", startDate);
  636 + else
  637 + tempMap.put("dates", startDate + "--" + endDate);
  638 + tempMap.put("jhbc", jhbc);
  639 + tempMap.put("sjbc", sjbc);
  640 + if(sjbc != 0){
  641 + tempMap.put("sjdf", ((sjdf/sjbc)/60<10?"0"+(sjdf/sjbc)/60:(sjdf/sjbc)/60) + ":" + ((sjdf/sjbc)%60<10?"0"+(sjdf/sjbc)%60:(sjdf/sjbc)%60));
  642 + tempMap.put("wddf1", wddf1 / sjbc + "分");
  643 + tempMap.put("wddf2", wddf2 / sjbc + "分");
  644 + tempMap.put("sjfc", ((sjfc/sjbc)/60<10?"0"+(sjfc/sjbc)/60:(sjfc/sjbc)/60) + ":" + ((sjfc/sjbc)%60<10?"0"+(sjfc/sjbc)%60:(sjfc/sjbc)%60));
  645 + tempMap.put("wdfc1", wdfc1 / sjbc + "分");
  646 + tempMap.put("wdfc2", wdfc2 / sjbc + "分");
  647 +// tempMap.put("kbc", df.format((((double) kbc)/sjbc)*100)+"%");
  648 +// tempMap.put("mbc", df.format((((double) mbc)/sjbc)*100)+"%");
  649 + tempMap.put("pjys", sjys / sjbc + "分");
  650 + tempMap.put("pjtz", sjtz / sjbc + "分");
  651 + } else {
  652 + tempMap.put("sjdf", "/");
  653 + tempMap.put("wddf1", "0分");
  654 + tempMap.put("wddf2", "0分");
  655 + tempMap.put("sjfc", "/");
  656 + tempMap.put("wdfc1", "0分");
  657 + tempMap.put("wdfc2", "0分");
  658 +// tempMap.put("kbc", "0%");
  659 +// tempMap.put("mbc", "0%");
  660 + tempMap.put("pjys", "0分");
  661 + tempMap.put("pjtz", "0分");
  662 + }
  663 + tempMap.put("kbc", kbc);
  664 + tempMap.put("mbc", mbc);
  665 + tempMap.put("jhys", jhys);
  666 + tempMap.put("sjys", sjys);
  667 + tempMap.put("yssjMin", yssjMin);
  668 + tempMap.put("yssjMax", yssjMax);
  669 + tempMap.put("jhtz", jhtz);
  670 + tempMap.put("sjtz", sjtz);
  671 + tempMap.put("tzsjMax", tzsjMax);
  672 + tempMap.put("tzsjMin", tzsjMin);
  673 + list0.add(tempMap);
  674 + }
  675 +
  676 + Collections.sort(list0, new Comparator<Map<String, Object>>() {
  677 +
  678 + public int compare(Map<String, Object> o1, Map<String, Object> o2) {
  679 +
  680 + String[] split1 = o1.get("date").toString().split("-");
  681 + String[] split2 = o2.get("date").toString().split("-");
  682 + Long a = Long.valueOf(split1[0])*10000 + Long.valueOf(split1[1])*100 + Long.valueOf(split1[2]);
  683 + Long b = Long.valueOf(split2[0])*10000 + Long.valueOf(split2[1])*100 + Long.valueOf(split2[2]);
  684 +
  685 + // 升序
  686 + return a.compareTo(b);
  687 + }
  688 + });
  689 +
  690 + for(Map<String, Object> m : list0){
  691 + String key = m.get("line").toString() + "/" + m.get("lp").toString() + "/" + m.get("station").toString();
  692 + if(!keyMap0.containsKey(key))
  693 + keyMap0.put(key, new ArrayList<Map<String, Object>>());
  694 + keyMap0.get(key).add(m);
  695 + }
  696 + for(String key : keyMap0.keySet()){
  697 + Map<String, Object> tempMap = new HashMap<String, Object>();
  698 + int jhbc = 0;
  699 + int sjbc = 0;
  700 + int wddf1 = 0;
  701 + int wddf2 = 0;
  702 + int wdfc1 = 0;
  703 + int wdfc2 = 0;
  704 + int ys = 0;
  705 + int tz = 0;
  706 + String companyName = "", subCompanyName = "";
  707 + for(Map<String, Object> m : keyMap0.get(key)){
  708 + if(m.containsKey("company") && companyName.length() == 0)
  709 + companyName = m.get("company").toString();
  710 + if(m.containsKey("subCompany") && subCompanyName.length() == 0)
  711 + subCompanyName = m.get("subCompany").toString();
  712 + jhbc += Integer.valueOf(m.get("jhbc").toString());
  713 + sjbc += Integer.valueOf(m.get("sjbc").toString());
  714 + wddf1 += Integer.valueOf(m.get("wddf1").toString().substring(0, m.get("wddf1").toString().length() - 1));
  715 + wddf2 += Integer.valueOf(m.get("wddf2").toString().substring(0, m.get("wddf2").toString().length() - 1));
  716 + wdfc1 += Integer.valueOf(m.get("wdfc1").toString().substring(0, m.get("wdfc1").toString().length() - 1));
  717 + wdfc2 += Integer.valueOf(m.get("wdfc2").toString().substring(0, m.get("wdfc2").toString().length() - 1));
  718 + ys += Integer.valueOf(m.get("pjys").toString().substring(0, m.get("pjys").toString().length() - 1));
  719 + tz += Integer.valueOf(m.get("pjtz").toString().substring(0, m.get("pjtz").toString().length() - 1));
  720 + }
  721 + if(startDate.equals(endDate))
  722 + tempMap.put("dates", startDate);
  723 + else
  724 + tempMap.put("dates", startDate + "--" + endDate);
  725 + tempMap.put("company", companyName);
  726 + tempMap.put("subCompany", subCompanyName);
  727 + String[] keys = key.split("/");
  728 + tempMap.put("line", keys[0]);
  729 + tempMap.put("lp", keys[1]);
  730 + tempMap.put("station", keys[2]);
  731 + tempMap.put("times", times);
  732 + tempMap.put("jhbc", jhbc);
  733 + tempMap.put("sjbc", sjbc);
  734 + tempMap.put("wddf1", wddf1/keyMap0.get(key).size()+"分");
  735 + tempMap.put("wddf2", wddf2/keyMap0.get(key).size()+"分");
  736 + tempMap.put("wdfc1", wdfc1/keyMap0.get(key).size()+"分");
  737 + tempMap.put("wdfc2", wdfc2/keyMap0.get(key).size()+"分");
  738 + tempMap.put("pjys", ys/keyMap0.get(key).size()+"分");
  739 + tempMap.put("pjtz", tz/keyMap0.get(key).size()+"分");
  740 + tempMap.put("workList", keyMap0.get(key));
  741 +
  742 + String key1 = tempMap.get("line").toString();
  743 + if(!keyMap1.containsKey(key1))
  744 + keyMap1.put(key1, new ArrayList<Map<String, Object>>());
  745 + keyMap1.get(key1).add(tempMap);
  746 + }
  747 +
  748 + for(String key : keyMap1.keySet()){
  749 + Collections.sort(keyMap1.get(key), new Comparator<Map<String, Object>>() {
  750 +
  751 + public int compare(Map<String, Object> o1, Map<String, Object> o2) {
  752 + Integer a;
  753 + Integer b;
  754 + String lp1 = o1.get("lp").toString();
  755 + String lp2 = o2.get("lp").toString();
  756 + String str1 = "";
  757 + String str2 = "";
  758 + for(int i = 0; i < lp1.length(); i++){
  759 + str1 += (int)lp1.charAt(i);
  760 + }
  761 + for(int i = 0; i < lp2.length(); i++){
  762 + str2 += (int)lp2.charAt(i);
  763 + }
  764 +
  765 + a = Integer.valueOf(str1);
  766 + b = Integer.valueOf(str2);
  767 +
  768 + // 升序
  769 + return a.compareTo(b);
  770 + }
  771 + });
  772 +
  773 + resList.addAll(keyMap1.get(key));
  774 + }
  775 +
  776 +
  777 + return resList;
  778 + }
  779 +
  780 + @Override
  781 + public List<Map<String, Object>> lbStatuAnaly(Map<String, Object> map) {
  782 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  783 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
  784 + Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>();
  785 +
  786 + String company = map.get("company").toString();
  787 + String subCompany = map.get("subCompany").toString();
  788 + String line = map.get("line").toString();
  789 + String startDate = map.get("startDate").toString();
  790 + String endDate = map.get("endDate").toString();
  791 + String model = map.get("model").toString();
  792 + String times = map.get("times").toString();
  793 + String type = map.get("type").toString();
  794 +
  795 + if(startDate.length() == 0){
  796 + startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
  797 + }
  798 + if(endDate.length() == 0){
  799 + endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
  800 + }
  801 + if(times.length() == 0){
  802 + times = "06:00-07:00";
  803 + }
  804 +
  805 + list = getSchedule(company, subCompany, line, startDate, endDate, model, times);
  806 +
  807 + String[] date1 = startDate.split("-");
  808 + String[] date2 = endDate.split("-");
  809 + startDate = date1[0] + "年" + date1[1] + "月" + date1[2] + "日";
  810 + endDate = date2[0] + "年" + date2[1] + "月" + date2[2] + "日";
  811 +
  812 + String[] split = times.split("-");
  813 + int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]);
  814 + int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]);
  815 +
  816 + for(ScheduleRealInfo schedule : list){
  817 + Long fcsj = schedule.getFcsjT();
  818 + if(!(endTime!=0?fcsj>=startTime&&fcsj<endTime:fcsj>=startTime)){
  819 + continue;
  820 + }
  821 + String key = schedule.getXlName();
  822 + if(!keyMap.containsKey(key))
  823 + keyMap.put(key, new ArrayList<ScheduleRealInfo>());
  824 + keyMap.get(key).add(schedule);
  825 + }
  826 + for(String key : keyMap.keySet()){
  827 + Map<String, Object> tempMap = new HashMap<String, Object>();
  828 + int jhbc = 0;
  829 + int sjbc = 0;
  830 + int jhlc = 0;
  831 + int sjlc = 0;
  832 + int lzbc = 0, lzlc = 0, dmbc = 0, dmlc = 0,
  833 + gzbc = 0, gzlc = 0, jfbc = 0, jflc = 0,
  834 + zsbc = 0, zslc = 0, qrbc = 0, qrlc = 0,
  835 + qcbc = 0, qclc = 0, kxbc = 0, kxlc = 0,
  836 + qhbc = 0, qhlc = 0, wybc = 0, wylc = 0;
  837 + int qtbc = 0, qtlc = 0;
  838 + String companyName = "", subCompanyName = "";
  839 + for(ScheduleRealInfo schedule : keyMap.get(key)){
  840 + if(schedule.getGsName() != null && companyName.length() == 0)
  841 + companyName = schedule.getGsName();
  842 + if(schedule.getFgsName() != null && subCompanyName.length() == 0)
  843 + subCompanyName = schedule.getFgsName();
  844 + jhbc++;
  845 + if(schedule.getJhlc() != null)
  846 + jhlc += schedule.getJhlc();
  847 + if(schedule.getStatus() == 2){
  848 + sjbc++;
  849 + if(schedule.getJhlc() != null)
  850 + sjlc += schedule.getJhlc();
  851 + } else if(schedule.getStatus() == -1){
  852 + if(schedule.getRemarks() != null && schedule.getRemarks().indexOf("路阻") != -1){
  853 + lzbc++;
  854 + lzlc += schedule.getJhlc();
  855 + }else if(schedule.getRemarks() != null && schedule.getRemarks().indexOf("吊慢") != -1){
  856 + dmbc++;
  857 + dmlc += schedule.getJhlc();
  858 + }else if(schedule.getRemarks() != null && schedule.getRemarks().indexOf("故障") != -1){
  859 + gzbc++;
  860 + gzlc += schedule.getJhlc();
  861 + }else if(schedule.getRemarks() != null && schedule.getRemarks().indexOf("纠纷") != -1){
  862 + jfbc++;
  863 + jflc += schedule.getJhlc();
  864 + }else if(schedule.getRemarks() != null && schedule.getRemarks().indexOf("肇事") != -1){
  865 + zsbc++;
  866 + zslc += schedule.getJhlc();
  867 + }else if(schedule.getRemarks() != null && schedule.getRemarks().indexOf("缺人") != -1){
  868 + qrbc++;
  869 + qrlc += schedule.getJhlc();
  870 + }else if(schedule.getRemarks() != null && schedule.getRemarks().indexOf("缺车") != -1){
  871 + qcbc++;
  872 + qclc += schedule.getJhlc();
  873 + }else if(schedule.getRemarks() != null && schedule.getRemarks().indexOf("客稀") != -1){
  874 + kxbc++;
  875 + kxlc += schedule.getJhlc();
  876 + }else if(schedule.getRemarks() != null && schedule.getRemarks().indexOf("气候") != -1){
  877 + qhbc++;
  878 + qhlc += schedule.getJhlc();
  879 + }else if(schedule.getRemarks() != null && schedule.getRemarks().indexOf("外援") != -1){
  880 + wybc++;
  881 + wylc += schedule.getJhlc();
  882 + } else {
  883 + qtbc++;
  884 + qtlc += schedule.getJhlc();
  885 + }
  886 + }
  887 + }
  888 + if(startDate.equals(endDate))
  889 + tempMap.put("date", startDate);
  890 + else
  891 + tempMap.put("date", startDate + "--" + endDate);
  892 + tempMap.put("company", companyName);
  893 + tempMap.put("subCompany", subCompanyName);
  894 + tempMap.put("times", times);
  895 + tempMap.put("line", key);
  896 + tempMap.put("jhbc", jhbc);
  897 + tempMap.put("sjbc", sjbc);
  898 + tempMap.put("bcbfb", df.format(jhbc>0?(double)sjbc/jhbc*100:0)+"%");
  899 + tempMap.put("jhlc", jhlc);
  900 + tempMap.put("sjlc", sjlc);
  901 + tempMap.put("lcbfb", df.format(jhlc>0?(double)sjlc/jhlc*100:0)+"%");
  902 + tempMap.put("lzbc", lzbc);
  903 + tempMap.put("lzlc", lzlc);
  904 + tempMap.put("lzbfb", df.format(jhlc>0?(double)lzlc/jhlc*100:0)+"%");
  905 + tempMap.put("dmbc", dmbc);
  906 + tempMap.put("dmlc", dmlc);
  907 + tempMap.put("dmbfb", df.format(jhlc>0?(double)dmlc/jhlc*100:0)+"%");
  908 + tempMap.put("gzbc", gzbc);
  909 + tempMap.put("gzlc", gzlc);
  910 + tempMap.put("gzbfb", df.format(jhlc>0?(double)gzlc/jhlc*100:0)+"%");
  911 + tempMap.put("jfbc", jfbc);
  912 + tempMap.put("jflc", jflc);
  913 + tempMap.put("jfbfb", df.format(jhlc>0?(double)jflc/jhlc*100:0)+"%");
  914 + tempMap.put("zsbc", zsbc);
  915 + tempMap.put("zslc", zslc);
  916 + tempMap.put("zsbfb", df.format(jhlc>0?(double)zslc/jhlc*100:0)+"%");
  917 + tempMap.put("qrbc", qrbc);
  918 + tempMap.put("qrlc", qrlc);
  919 + tempMap.put("qrbfb", df.format(jhlc>0?(double)qrlc/jhlc*100:0)+"%");
  920 + tempMap.put("qcbc", qcbc);
  921 + tempMap.put("qclc", qclc);
  922 + tempMap.put("qcbfb", df.format(jhlc>0?(double)qclc/jhlc*100:0)+"%");
  923 + tempMap.put("kxbc", kxbc);
  924 + tempMap.put("kxlc", kxlc);
  925 + tempMap.put("kxbfb", df.format(jhlc>0?(double)kxlc/jhlc*100:0)+"%");
  926 + tempMap.put("qhbc", qhbc);
  927 + tempMap.put("qhlc", qhlc);
  928 + tempMap.put("qhbfb", df.format(jhlc>0?(double)qhlc/jhlc*100:0)+"%");
  929 + tempMap.put("wybc", wybc);
  930 + tempMap.put("wylc", wylc);
  931 + tempMap.put("wybfb", df.format(jhlc>0?(double)wylc/jhlc*100:0)+"%");
  932 + tempMap.put("qtbc", qtbc);
  933 + tempMap.put("qtlc", qtlc);
  934 + tempMap.put("qtbfb", df.format(jhlc>0?(double)qtlc/jhlc*100:0)+"%");
  935 +
  936 + resList.add(tempMap);
  937 + }
  938 +
  939 + return resList;
  940 + }
  941 +
  942 + @Override
  943 + public List<Map<String, Object>> correctStatis(Map<String, Object> map) {
  944 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  945 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
  946 + Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>();
  947 + Map<String, List<Map<String, Object>>> keyMap0 = new HashMap<String, List<Map<String, Object>>>();
  948 + Map<String, List<Map<String, Object>>> keyMap1 = new HashMap<String, List<Map<String, Object>>>();
  949 +
  950 + String company = map.get("company").toString();
  951 + String subCompany = map.get("subCompany").toString();
  952 + String line = map.get("line").toString();
  953 + String startDate = map.get("startDate").toString();
  954 + String endDate = map.get("endDate").toString();
  955 + String times = map.get("times").toString();
  956 + String type = map.get("type").toString();
  957 +
  958 + if(startDate.length() == 0){
  959 + startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
  960 + }
  961 + if(endDate.length() == 0){
  962 + endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
  963 + }
  964 + try {
  965 +
  966 + 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+"' and fcsj_actual is not null";
  967 + if(line.length() != 0){
  968 + sql += " and xl_bm = '"+line+"'";
  969 + }
  970 + if(times.length() != 0){
  971 + String[] split = times.split("-");
  972 + sql += " and fcsj >= '"+split[0]+"' and fcsj <= '"+split[1]+"'";
  973 + }
  974 + if(company.length() != 0){
  975 + sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'";
  976 + }
  977 + sql += " and bc_type = 'normal'";
  978 +
  979 + list =jdbcTemplate.query(sql,
  980 + new RowMapper<ScheduleRealInfo>(){
  981 + @Override
  982 + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
  983 + ScheduleRealInfo schedule = new ScheduleRealInfo();
  984 + schedule.setScheduleDateStr(rs.getString("schedule_date_Str"));
  985 + schedule.setXlName(rs.getString("xl_name"));
  986 + schedule.setLpName(rs.getString("lp_name"));
  987 + schedule.setBcType(rs.getString("bc_type"));
  988 + schedule.setBcs(rs.getInt("bcs"));
  989 + schedule.setBcsj(rs.getInt("bcsj"));
  990 + schedule.setJhlc(rs.getDouble("jhlc"));
  991 + schedule.setDfsj(rs.getString("dfsj"));
  992 + schedule.setFcsj(rs.getString("fcsj"));
  993 + schedule.setFcsjActual(rs.getString("fcsj_actual"));
  994 + schedule.setZdsj(rs.getString("zdsj"));
  995 + schedule.setZdsjActual(rs.getString("zdsj_actual"));
  996 + schedule.setQdzName(rs.getString("qdz_name"));
  997 + schedule.setZdzName(rs.getString("zdz_name"));
  998 + schedule.setXlDir(rs.getString("xl_dir"));
  999 + schedule.setStatus(rs.getInt("status"));
  1000 + schedule.setRemarks(rs.getString("remarks"));
  1001 + schedule.setGsName(rs.getString("gs_name"));
  1002 + schedule.setFgsName(rs.getString("fgs_name"));
  1003 + schedule.setDfAuto(rs.getBoolean("df_auto"));
  1004 + schedule.setOnline(rs.getBoolean("online"));
  1005 + schedule.setClZbh(rs.getString("cl_zbh"));
  1006 + schedule.setjGh(rs.getString("j_gh"));
  1007 + schedule.setjName(rs.getString("j_name"));
  1008 + schedule.setUpdateDate(rs.getDate("update_date"));
  1009 +
  1010 + return schedule;
  1011 + }
  1012 + });
  1013 + }catch (Exception e) {
  1014 + // TODO: handle exception
  1015 + e.printStackTrace();
  1016 + }
  1017 +
  1018 + String[] date1 = startDate.split("-");
  1019 + String[] date2 = endDate.split("-");
  1020 + startDate = date1[0] + "年" + date1[1] + "月" + date1[2] + "日";
  1021 + endDate = date2[0] + "年" + date2[1] + "月" + date2[2] + "日";
  1022 + String date = "";
  1023 + if(startDate.equals(endDate))
  1024 + date = startDate;
  1025 + else
  1026 + date = startDate + "--" + endDate;
  1027 +
  1028 + for(ScheduleRealInfo schedule : list){
  1029 + String key = schedule.getGsName() + "/" + schedule.getFgsName() + "/" + schedule.getXlName();
  1030 + if(!keyMap.containsKey(key))
  1031 + keyMap.put(key, new ArrayList<ScheduleRealInfo>());
  1032 + keyMap.get(key).add(schedule);
  1033 + }
  1034 + for(String key : keyMap.keySet()){
  1035 + Map<String, Object> tempMap = new HashMap<String, Object>();
  1036 + List<ScheduleRealInfo> tempList = new ArrayList<ScheduleRealInfo>();
  1037 + int sjbc = 0, sddf = 0, zddf = 0,
  1038 + dxtz = 0, lbtz = 0;
  1039 + for(ScheduleRealInfo schedule : keyMap.get(key)){
  1040 + if(schedule.getFcsjActual() != null){
  1041 + boolean flag = false;
  1042 + sjbc++;
  1043 + if(schedule.getDfsj() != null && !schedule.getDfsj().equals(schedule.getFcsj())){
  1044 + flag = true;
  1045 + schedule.setRemarks("待发调整");
  1046 + if(schedule.isDfAuto())
  1047 + zddf++;
  1048 + else
  1049 + sddf++;
  1050 + }else if(!schedule.isOnline()){
  1051 + flag = true;
  1052 + schedule.setRemarks("掉线调整");
  1053 + dxtz++;
  1054 + }else if(schedule.getStatus() == 2){
  1055 + flag = true;
  1056 + lbtz++;
  1057 + }
  1058 + if(flag)
  1059 + tempList.add(schedule);
  1060 + }
  1061 + }
  1062 + tempMap.put("date", date);
  1063 + String[] keys = key.split("/");
  1064 + tempMap.put("company", keys[0]);
  1065 + tempMap.put("subCompany", keys[1]);
  1066 + tempMap.put("line", keys[2]);
  1067 + tempMap.put("sjbc", sjbc);
  1068 + tempMap.put("sddf", sddf);
  1069 + tempMap.put("zddf", zddf);
  1070 + tempMap.put("dfhj", sddf + zddf);
  1071 + tempMap.put("dxtz", dxtz);
  1072 + tempMap.put("lbtz", lbtz);
  1073 + tempMap.put("correct", sddf + zddf + dxtz + lbtz);
  1074 + tempMap.put("dfbl", df.format((double)(sddf + zddf)/sjbc*100) + "%");
  1075 + tempMap.put("dxbl", df.format((double)(dxtz)/sjbc*100) + "%");
  1076 + tempMap.put("lbbl", df.format((double)(lbtz)/sjbc*100) + "%");
  1077 + tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%");
  1078 + tempMap.put("workList", tempList);
  1079 +
  1080 + String key0 = keys[0] + "/" + keys[1];
  1081 + if(!keyMap0.containsKey(key0))
  1082 + keyMap0.put(key0, new ArrayList<Map<String, Object>>());
  1083 + keyMap0.get(key0).add(tempMap);
  1084 + }
  1085 +
  1086 + for(String key : keyMap0.keySet()){
  1087 + Map<String, Object> tempMap = new HashMap<String, Object>();
  1088 + int sjbc = 0, sddf = 0, zddf = 0,
  1089 + dxtz = 0, lbtz = 0;
  1090 + for(Map<String, Object> m : keyMap0.get(key)){
  1091 + sjbc += (int)m.get("sjbc");
  1092 + sddf += (int)m.get("sddf");
  1093 + zddf += (int)m.get("zddf");
  1094 + dxtz += (int)m.get("dxtz");
  1095 + lbtz += (int)m.get("lbtz");
  1096 + }
  1097 + tempMap.put("date", date);
  1098 + String[] keys = key.split("/");
  1099 + tempMap.put("company", keys[0]);
  1100 + tempMap.put("subCompany", keys[1]);
  1101 + tempMap.put("lines", keyMap0.get(key).size());
  1102 + tempMap.put("sjbc", sjbc);
  1103 + tempMap.put("sddf", sddf);
  1104 + tempMap.put("zddf", zddf);
  1105 + tempMap.put("dfhj", sddf + zddf);
  1106 + tempMap.put("dxtz", dxtz);
  1107 + tempMap.put("lbtz", lbtz);
  1108 + tempMap.put("correct", sddf + zddf + dxtz + lbtz);
  1109 + tempMap.put("dfbl", df.format((double)(sddf + zddf)/sjbc*100) + "%");
  1110 + tempMap.put("dxbl", df.format((double)(dxtz)/sjbc*100) + "%");
  1111 + tempMap.put("lbbl", df.format((double)(lbtz)/sjbc*100) + "%");
  1112 + tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%");
  1113 + tempMap.put("workList", keyMap0.get(key));
  1114 +
  1115 + String key1 = keys[0];
  1116 + if(!keyMap1.containsKey(key1))
  1117 + keyMap1.put(key1, new ArrayList<Map<String, Object>>());
  1118 + keyMap1.get(key1).add(tempMap);
  1119 + }
  1120 +
  1121 + for(String key : keyMap1.keySet()){
  1122 + Map<String, Object> tempMap = new HashMap<String, Object>();
  1123 + int sjbc = 0, sddf = 0, zddf = 0,
  1124 + dxtz = 0, lbtz = 0, lines = 0;
  1125 + for(Map<String, Object> m : keyMap1.get(key)){
  1126 + sjbc += (int)m.get("sjbc");
  1127 + sddf += (int)m.get("sddf");
  1128 + zddf += (int)m.get("zddf");
  1129 + dxtz += (int)m.get("dxtz");
  1130 + lbtz += (int)m.get("lbtz");
  1131 + lines += (int)m.get("lines");
  1132 + }
  1133 + tempMap.put("date", date);
  1134 + tempMap.put("company", key);
  1135 + tempMap.put("lines", lines);
  1136 + tempMap.put("sjbc", sjbc);
  1137 + tempMap.put("sddf", sddf);
  1138 + tempMap.put("zddf", zddf);
  1139 + tempMap.put("dfhj", sddf + zddf);
  1140 + tempMap.put("dxtz", dxtz);
  1141 + tempMap.put("lbtz", lbtz);
  1142 + tempMap.put("correct", sddf + zddf + dxtz + lbtz);
  1143 + tempMap.put("dfbl", df.format((double)(sddf + zddf)/sjbc*100) + "%");
  1144 + tempMap.put("dxbl", df.format((double)(dxtz)/sjbc*100) + "%");
  1145 + tempMap.put("lbbl", df.format((double)(lbtz)/sjbc*100) + "%");
  1146 + tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%");
  1147 + tempMap.put("workList", keyMap1.get(key));
  1148 +
  1149 + resList.add(tempMap);
  1150 + }
  1151 +
  1152 + if(resList.size() != 0){
  1153 + Map<String, Object> tempMap = new HashMap<String, Object>();
  1154 + int sjbc = 0, sddf = 0, zddf = 0,
  1155 + dxtz = 0, lbtz = 0, lines = 0;
  1156 + for(Map<String, Object> m : resList){
  1157 + sjbc += (int)m.get("sjbc");
  1158 + sddf += (int)m.get("sddf");
  1159 + zddf += (int)m.get("zddf");
  1160 + dxtz += (int)m.get("dxtz");
  1161 + lbtz += (int)m.get("lbtz");
  1162 + lines += (int)m.get("lines");
  1163 + for(Map<String, Object> m0 : (List<Map<String, Object>>)m.get("workList")){
  1164 + Map<String, Object> temp = new HashMap<String, Object>();
  1165 + temp.put("date", "合计");
  1166 + temp.put("lines", m0.get("lines"));
  1167 + temp.put("sjbc", m0.get("sjbc"));
  1168 + temp.put("sddf", m0.get("sddf"));
  1169 + temp.put("zddf", m0.get("zddf"));
  1170 + temp.put("dfhj", m0.get("dfhj"));
  1171 + temp.put("dxtz", m0.get("dxtz"));
  1172 + temp.put("lbtz", m0.get("lbtz"));
  1173 + temp.put("correct", m0.get("correct"));
  1174 + temp.put("dfbl", m0.get("dfbl"));
  1175 + temp.put("dxbl", m0.get("dxbl"));
  1176 + temp.put("lbbl", m0.get("lbbl"));
  1177 + temp.put("correctbl", m0.get("correctbl"));
  1178 + ((List<Map<String, Object>>)m0.get("workList")).add(temp);
  1179 + }
  1180 + Map<String, Object> temp = new HashMap<String, Object>();
  1181 + temp.put("date", "合计");
  1182 + temp.put("lines", m.get("lines"));
  1183 + temp.put("sjbc", m.get("sjbc"));
  1184 + temp.put("sddf", m.get("sddf"));
  1185 + temp.put("zddf", m.get("zddf"));
  1186 + temp.put("dfhj", m.get("dfhj"));
  1187 + temp.put("dxtz", m.get("dxtz"));
  1188 + temp.put("lbtz", m.get("lbtz"));
  1189 + temp.put("correct", m.get("correct"));
  1190 + temp.put("dfbl", m.get("dfbl"));
  1191 + temp.put("dxbl", m.get("dxbl"));
  1192 + temp.put("lbbl", m.get("lbbl"));
  1193 + temp.put("correctbl", m.get("correctbl"));
  1194 + ((List<Map<String, Object>>)m.get("workList")).add(temp);
  1195 + }
  1196 + tempMap.put("date", "合计");
  1197 + tempMap.put("lines", lines);
  1198 + tempMap.put("sjbc", sjbc);
  1199 + tempMap.put("sddf", sddf);
  1200 + tempMap.put("zddf", zddf);
  1201 + tempMap.put("dfhj", sddf + zddf);
  1202 + tempMap.put("dxtz", dxtz);
  1203 + tempMap.put("lbtz", lbtz);
  1204 + tempMap.put("correct", sddf + zddf + dxtz + lbtz);
  1205 + tempMap.put("dfbl", df.format((double)(sddf + zddf)/sjbc*100) + "%");
  1206 + tempMap.put("dxbl", df.format((double)(dxtz)/sjbc*100) + "%");
  1207 + tempMap.put("lbbl", df.format((double)(lbtz)/sjbc*100) + "%");
  1208 + tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%");
  1209 + resList.add(tempMap);
  1210 + }
  1211 +
  1212 + return resList;
  1213 + }
  1214 +
  1215 +
  1216 +
  1217 +}
... ...
src/main/java/com/bsth/service/oil/impl/CwjyServiceImpl.java
1 1 package com.bsth.service.oil.impl;
2 2  
  3 +import java.sql.ResultSet;
  4 +import java.sql.SQLException;
3 5 import java.text.ParseException;
4 6 import java.text.SimpleDateFormat;
5 7 import java.util.ArrayList;
  8 +import java.util.Arrays;
6 9 import java.util.HashMap;
7 10 import java.util.List;
8 11 import java.util.Map;
9 12  
10 13 import org.springframework.beans.factory.annotation.Autowired;
  14 +import org.springframework.jdbc.core.JdbcTemplate;
  15 +import org.springframework.jdbc.core.RowMapper;
11 16 import org.springframework.stereotype.Service;
12 17  
13 18 import com.bsth.common.ResponseCode;
... ... @@ -28,17 +33,103 @@ public class CwjyServiceImpl extends BaseServiceImpl&lt;Cwjy,Integer&gt; implements Cw
28 33 @Autowired
29 34 YlxxbRepository ylxxbRepository;
30 35  
  36 + @Autowired
  37 + JdbcTemplate jdbcTemplate;
  38 +
31 39 @SuppressWarnings("unchecked")
32 40 public PageObject<Ylxxb> Pagequery(Map<String, Object> map) {
33   - // TODO Auto-generated method stub
  41 + int page=Integer.parseInt(map.get("page").toString());
34 42 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
35   - List<Ylxxb> yList=new ArrayList<Ylxxb>();
  43 +
36 44 String rq=map.get("rq").toString();
37 45 String nbbm="";
38   - if(map.get("nbbm")!=null){
39   - nbbm=map.get("nbbm").toString();
  46 + if(map.get("nbbh")!=null){
  47 + nbbm=map.get("nbbh").toString();
  48 + }
  49 +
  50 + Object gsdmIn=map.get("gsdm_in");
  51 + Object fgsdmIn=map.get("fgsdm_in");
  52 + String addSql="";
  53 + String gsdmLike="";
  54 + String fgsdmLike="";
  55 +
  56 + //选择了公司
  57 + if(gsdmIn==null){
  58 + gsdmLike=map.get("gsdm_like").toString();
  59 + addSql += " and a.gsdm = '"+gsdmLike+ "' ";
  60 +
  61 + //选择了分公司
  62 + if(fgsdmIn==null){
  63 + fgsdmLike=map.get("fgsdm_like").toString();;
  64 + addSql += " and a.fgsdm = '"+fgsdmLike+ "' ";
  65 + }else{
  66 + String fgsdmIns[]= fgsdmIn.toString().split(",");
  67 + addSql +=" and a.fgsdm in (";
  68 + for(int i=0;i<fgsdmIns.length;i++){
  69 + addSql +="'"+fgsdmIns[i]+"'";
  70 + if(i<fgsdmIns.length-1){
  71 + addSql +=",";
  72 + }
  73 + }
  74 + addSql +=")";
  75 + }
  76 + }else{
  77 + //没有选择公司 (分公司也没有选择)
  78 + String gsdmIns[]=gsdmIn.toString().split(",");
  79 + addSql += " and a.gsdm in (";
  80 + for(int i=0;i<gsdmIns.length;i++){
  81 + addSql +="'" +gsdmIns[i]+"'";
  82 + if(i<gsdmIns.length-1){
  83 + addSql+=",";
  84 + }
  85 + }
  86 + addSql +=")";
  87 + String fgsdmIns[]= fgsdmIn.toString().split(",");
  88 + addSql +=" and a.fgsdm in (";
  89 + for(int i=0;i<fgsdmIns.length;i++){
  90 + addSql +="'"+fgsdmIns[i]+"'";
  91 + if(i<fgsdmIns.length-1){
  92 + addSql +=",";
  93 + }
  94 + }
  95 + addSql +=")";
  96 +
  97 +
40 98 }
41   - List<Object[]> list=repository.obtainCwjycl(rq,nbbm);
  99 + String countSql="SELECT ifnull(count(*),0) as countTs FROM bsth_c_cwjy a "+
  100 + " left join ( select * from bsth_c_ylxxb b where to_days(b.yyrq)=to_days('"+rq+"') and jylx=1) b " +
  101 + " on a.nbbm=b.nbbm left join (select nbbm,group_concat(jsy) as jsy "
  102 + + "from bsth_c_ylb where to_days(rq)= to_days('"+rq+"' ) group by nbbm "+
  103 + " ) c on a.nbbm=c.nbbm where a.nbbm like '%"+nbbm+"%' " +addSql ;
  104 + int listsize=jdbcTemplate.queryForObject(countSql, Integer.class);
  105 + // TODO Auto-generated method stub
  106 + String sql="SELECT a.gsdm as gsdm,a.fgsdm as fgsdm,a.nbbm as nbbm,b.jsy as jsy,b.jzl as jzl ,b.stationid as stationid,"
  107 + + "b.nylx as nylx,b.yj as yj,b.bz as bz,c.jsy as ldgh FROM bsth_c_cwjy a "+
  108 + " left join ( select * from bsth_c_ylxxb b where to_days(b.yyrq)=to_days('"+rq+"') and jylx=1) b " +
  109 + " on a.nbbm=b.nbbm left join (select nbbm,group_concat(jsy) as jsy "
  110 + + "from bsth_c_ylb where to_days(rq)= to_days('"+rq+"' ) group by nbbm "+
  111 + " ) c on a.nbbm=c.nbbm where a.nbbm like '%"+nbbm+"%' " +addSql+ " limit "+page*10+","+10;
  112 +
  113 +
  114 + List<Ylxxb> yList= jdbcTemplate.query(sql,
  115 + new RowMapper<Ylxxb>(){
  116 + @Override
  117 + public Ylxxb mapRow(ResultSet rs, int rowNum) throws SQLException {
  118 + Ylxxb t=new Ylxxb();
  119 + t.setGsdm(rs.getString("gsdm"));
  120 + t.setFgsdm(rs.getString("fgsdm"));
  121 + t.setNbbm(rs.getString("nbbm"));
  122 + t.setJsy(rs.getString("jsy"));
  123 + t.setJzl(rs.getDouble("jzl"));
  124 + t.setStationid(rs.getString("stationid"));
  125 + t.setNylx(rs.getInt("nylx"));
  126 + t.setYj(rs.getDouble("yj"));
  127 + t.setBz(rs.getString("bz"));
  128 + t.setLdgh(rs.getString("ldgh"));
  129 + return t;
  130 + }
  131 + });
  132 + /*List<Object[]> list=repository.obtainCwjycl(rq,nbbm);
42 133 for (int i = 0; i < list.size(); i++) {
43 134 Ylxxb y=new Ylxxb();
44 135 y.setGsdm(list.get(i)[0]==null?"":list.get(i)[0].toString());
... ... @@ -57,8 +148,8 @@ public class CwjyServiceImpl extends BaseServiceImpl&lt;Cwjy,Integer&gt; implements Cw
57 148 e.printStackTrace();
58 149 }
59 150 yList.add(y);
60   - }
61   - PageHelper pageHelper = new PageHelper(yList.size(), map);
  151 + }*/
  152 + PageHelper pageHelper = new PageHelper(listsize, map);
62 153 pageHelper.getMap();
63 154 PageObject<Ylxxb> pageObject=pageHelper.getPageObject();
64 155 pageObject.setDataList(yList);
... ...
src/main/java/com/bsth/service/oil/impl/YlxxbServiceImpl.java
... ... @@ -34,6 +34,7 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
34 34  
35 35 @Override
36 36 public PageObject<Ylxxb> Pagequery(Map<String, Object> map) {
  37 +
37 38 String rq=map.get("yyrq").toString();
38 39 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
39 40 try {
... ... @@ -51,6 +52,15 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
51 52 // TODO Auto-generated catch block
52 53 e.printStackTrace();
53 54 }
  55 + /*if(map.get("gsdm_in")!=null){
  56 + map.put("ssgsdm_in", map.get("gsdm_in"));
  57 + map.remove("gsdm_in");
  58 +
  59 + }else{
  60 + map.put("ssgsdm_like", map.get("gsdm_like"));
  61 + map.remove("gsdm_like");
  62 + }*/
  63 +
54 64 //根具条件查询指定日期Ylb的数据
55 65 List<Ylb> ylbIterator=(List<Ylb>) ylbRepository.findAll(new CustomerSpecs<Ylb>(map));
56 66 List<Ylxxb> list=new ArrayList<Ylxxb>();
... ...
src/main/java/com/bsth/service/realcontrol/RealMapService.java
... ... @@ -9,4 +9,6 @@ public interface RealMapService {
9 9 Map<String, Object> stationSpatialData(String idx);
10 10  
11 11 Map<String,Object> carParkSpatialData();
  12 +
  13 + Map<String,Object> findRouteByLine(String lineCode);
12 14 }
... ...
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
1 1 package com.bsth.service.realcontrol;
2 2  
3   -import java.util.Collection;
4   -import java.util.List;
5   -import java.util.Map;
6   -
7   -import org.springframework.stereotype.Service;
8   -
9 3 import com.bsth.controller.realcontrol.dto.ChangePersonCar;
10 4 import com.bsth.controller.realcontrol.dto.DfsjChange;
11 5 import com.bsth.entity.realcontrol.ScheduleRealInfo;
12 6 import com.bsth.service.BaseService;
  7 +import org.springframework.stereotype.Service;
  8 +
  9 +import java.util.Collection;
  10 +import java.util.List;
  11 +import java.util.Map;
13 12  
14 13 @Service
15 14 public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, Long>{
... ... @@ -98,7 +97,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
98 97  
99 98 List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code);
100 99  
101   - List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date);
  100 + List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String type);
102 101  
103 102 Map<String, Object> removeChildTask(Long taskId);
104 103  
... ...
src/main/java/com/bsth/service/realcontrol/dto/SectionRouteCoords.java 0 → 100644
  1 +package com.bsth.service.realcontrol.dto;
  2 +
  3 +/**
  4 + * 线调地图 路段路由DTO
  5 + * Created by panzhao on 2016/12/1.
  6 + */
  7 +public class SectionRouteCoords {
  8 +
  9 + private int id;
  10 +
  11 + private String lineCode;
  12 +
  13 + private String sectionCode;
  14 +
  15 + private String sectionrouteCode;
  16 +
  17 + private int directions;
  18 +
  19 + private String sectionName;
  20 +
  21 + private String gsectionVector;
  22 +
  23 + private Float sectionDistance;
  24 +
  25 + private Float sectionTime;
  26 +
  27 + public int getId() {
  28 + return id;
  29 + }
  30 +
  31 + public void setId(int id) {
  32 + this.id = id;
  33 + }
  34 +
  35 + public String getLineCode() {
  36 + return lineCode;
  37 + }
  38 +
  39 + public void setLineCode(String lineCode) {
  40 + this.lineCode = lineCode;
  41 + }
  42 +
  43 + public String getSectionCode() {
  44 + return sectionCode;
  45 + }
  46 +
  47 + public void setSectionCode(String sectionCode) {
  48 + this.sectionCode = sectionCode;
  49 + }
  50 +
  51 + public String getSectionrouteCode() {
  52 + return sectionrouteCode;
  53 + }
  54 +
  55 + public void setSectionrouteCode(String sectionrouteCode) {
  56 + this.sectionrouteCode = sectionrouteCode;
  57 + }
  58 +
  59 + public int getDirections() {
  60 + return directions;
  61 + }
  62 +
  63 + public void setDirections(int directions) {
  64 + this.directions = directions;
  65 + }
  66 +
  67 + public String getSectionName() {
  68 + return sectionName;
  69 + }
  70 +
  71 + public void setSectionName(String sectionName) {
  72 + this.sectionName = sectionName;
  73 + }
  74 +
  75 + public String getGsectionVector() {
  76 + return gsectionVector;
  77 + }
  78 +
  79 + public void setGsectionVector(String gsectionVector) {
  80 + this.gsectionVector = gsectionVector;
  81 + }
  82 +
  83 + public Float getSectionDistance() {
  84 + return sectionDistance;
  85 + }
  86 +
  87 + public void setSectionDistance(Float sectionDistance) {
  88 + this.sectionDistance = sectionDistance;
  89 + }
  90 +
  91 + public Float getSectionTime() {
  92 + return sectionTime;
  93 + }
  94 +
  95 + public void setSectionTime(Float sectionTime) {
  96 + this.sectionTime = sectionTime;
  97 + }
  98 +}
... ...
src/main/java/com/bsth/service/realcontrol/impl/RealMapServiceImpl.java
... ... @@ -4,6 +4,8 @@ import com.bsth.common.ResponseCode;
4 4 import com.bsth.controller.realcontrol.dto.StationSpatialData;
5 5 import com.bsth.entity.CarPark;
6 6 import com.bsth.service.realcontrol.RealMapService;
  7 +import com.bsth.service.realcontrol.dto.SectionRouteCoords;
  8 +import com.bsth.util.TransGPS;
7 9 import com.google.common.base.Splitter;
8 10 import org.slf4j.Logger;
9 11 import org.slf4j.LoggerFactory;
... ... @@ -12,9 +14,7 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper;
12 14 import org.springframework.jdbc.core.JdbcTemplate;
13 15 import org.springframework.stereotype.Service;
14 16  
15   -import java.util.HashMap;
16   -import java.util.List;
17   -import java.util.Map;
  17 +import java.util.*;
18 18  
19 19 /**
20 20 * Created by panzhao on 2016/11/23.
... ... @@ -36,13 +36,13 @@ public class RealMapServiceImpl implements RealMapService {
36 36 //拼接in语句
37 37 String inStr = "";
38 38 for (String code : idArray) {
39   - inStr += (",'" + code+"'");
  39 + inStr += (",'" + code + "'");
40 40 }
41 41 inStr = " (" + inStr.substring(1) + ")";
42 42  
43   - String sql = "select r.LINE_CODE,r.STATION_NAME,r.STATION_CODE,r.STATION_MARK,r.DIRECTIONS,r.DISTANCES,r.TO_TIME, r.VERSIONS,s.G_LONX,s.G_LATY,s.RADIUS,s.SHAPES_TYPE,ST_AsText(s.G_POLYGON_GRID) as G_POLYGON_GRID, r.STATION_ROUTE_CODE from bsth_c_stationroute r inner join bsth_c_station s on r.station=s.id where r.line_code in "+inStr+" and r.destroy=0";
  43 + String sql = "select r.LINE_CODE,r.STATION_NAME,r.STATION_CODE,r.STATION_MARK,r.DIRECTIONS,r.DISTANCES,r.TO_TIME, r.VERSIONS,s.G_LONX,s.G_LATY,s.RADIUS,s.SHAPES_TYPE,ST_AsText(s.G_POLYGON_GRID) as G_POLYGON_GRID, r.STATION_ROUTE_CODE from bsth_c_stationroute r inner join bsth_c_station s on r.station=s.id where r.line_code in " + inStr + " and r.destroy=0";
44 44  
45   - List<StationSpatialData> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(StationSpatialData.class));
  45 + List<StationSpatialData> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(StationSpatialData.class));
46 46 rs.put("status", ResponseCode.SUCCESS);
47 47 rs.put("list", list);
48 48 } catch (Exception e) {
... ... @@ -61,7 +61,7 @@ public class RealMapServiceImpl implements RealMapService {
61 61 try {
62 62 String sql = "select ID, AREA,PARK_CODE,PARK_NAME,ST_AsText(G_PARK_POINT) as G_PARK_POINT,G_CENTER_POINT,RADIUS,SHAPES_TYPE from bsth_c_car_park WHERE destroy=0 and shapes_type='d'";
63 63  
64   - List<CarPark> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(CarPark.class));
  64 + List<CarPark> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(CarPark.class));
65 65 rs.put("status", ResponseCode.SUCCESS);
66 66 rs.put("list", list);
67 67 } catch (Exception e) {
... ... @@ -71,4 +71,99 @@ public class RealMapServiceImpl implements RealMapService {
71 71 }
72 72 return rs;
73 73 }
  74 +
  75 + @Override
  76 + public Map<String, Object> findRouteByLine(String lineCode) {
  77 + Map<String, Object> rs = new HashMap<>();
  78 + String sql = "SELECT r.ID,r.LINE_CODE,r.SECTION_CODE,r.SECTIONROUTE_CODE,r.DIRECTIONS,s.SECTION_NAME,ST_AsText(s.GSECTION_VECTOR) GSECTION_VECTOR,s.SECTION_DISTANCE,s.SECTION_TIME FROM bsth_c_sectionroute r INNER JOIN bsth_c_section s on r.section_code=s.section_code WHERE r.line_code=? and r.destroy=0 order by sectionroute_code";
  79 + List<SectionRouteCoords> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(SectionRouteCoords.class), lineCode);
  80 +
  81 + //排序
  82 + Collections.sort(list, new Comparator<SectionRouteCoords>() {
  83 + @Override
  84 + public int compare(SectionRouteCoords o1, SectionRouteCoords o2) {
  85 + return Integer.parseInt(o1.getSectionrouteCode()) - Integer.parseInt(o2.getSectionrouteCode());
  86 + }
  87 + });
  88 +
  89 + List<String> upList = new ArrayList<>(),
  90 + downList = new ArrayList<>();
  91 +
  92 + String vectorStr = "";
  93 + for (SectionRouteCoords sr : list) {
  94 + vectorStr = sr.getGsectionVector();
  95 + vectorStr = vectorStr.substring(11, vectorStr.length() - 2);
  96 +
  97 + if (sr.getDirections() == 0)
  98 + upList.add(vectorStr);
  99 + else
  100 + downList.add(vectorStr);
  101 + }
  102 +
  103 + rs.put("up", upList);
  104 + rs.put("down", downList);
  105 + rs.put("up_bd", multiWgsToBd(upList));
  106 + rs.put("down_bd", multiWgsToBd(downList));
  107 + rs.put("up_gcj", multiWgsToGcj(upList));
  108 + rs.put("down_gcj", multiWgsToGcj(downList));
  109 +
  110 + rs.put("lineId", lineCode);
  111 + return rs;
  112 + }
  113 +
  114 + /**
  115 + * wgs 坐标数组转 百度
  116 + * @param list
  117 + * @return
  118 + */
  119 + private List<String> multiWgsToBd(List<String> list) {
  120 + List<String> bdList = new ArrayList<>();
  121 +
  122 + StringBuilder itemStr;
  123 + String[] subArr, cds;
  124 + TransGPS.Location location;
  125 + for(String item : list){
  126 + subArr = item.split(",");
  127 +
  128 + itemStr = new StringBuilder();
  129 + for(String coord : subArr){
  130 + cds = coord.split(" ");
  131 + //城建转经纬度
  132 + //Map<String, Double> map = JWDUtil.ConvertSHToJW(Double.parseDouble(cds[0]), Double.parseDouble(cds[1]));
  133 +
  134 +
  135 + location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(TransGPS.LocationMake(Double.parseDouble(cds[0]), Double.parseDouble(cds[1]))));
  136 + itemStr.append(location.getLng() + " " + location.getLat() + ",");
  137 + }
  138 +
  139 + bdList.add(itemStr.substring(0, itemStr.length() - 1));
  140 + }
  141 + return bdList;
  142 + }
  143 +
  144 + /**
  145 + * wgs 坐标数组转 Gcj
  146 + * @param list
  147 + * @return
  148 + */
  149 + private List<String> multiWgsToGcj(List<String> list) {
  150 + List<String> gcjList = new ArrayList<>();
  151 +
  152 + StringBuilder itemStr;
  153 + String[] subArr, cds;
  154 + TransGPS.Location location;
  155 + for(String item : list){
  156 + subArr = item.split(",");
  157 +
  158 + itemStr = new StringBuilder();
  159 + for(String coord : subArr){
  160 + cds = coord.split(" ");
  161 + location = TransGPS.transformFromWGSToGCJ(TransGPS.LocationMake(Double.parseDouble(cds[0]), Double.parseDouble(cds[1])));
  162 + itemStr.append(location.getLng() + " " + location.getLat() + ",");
  163 + }
  164 +
  165 + gcjList.add(itemStr.substring(0, itemStr.length() - 1));
  166 + }
  167 + return gcjList;
  168 + }
74 169 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -33,7 +33,6 @@ import com.bsth.service.SectionRouteService;
33 33 import com.bsth.service.impl.BaseServiceImpl;
34 34 import com.bsth.service.realcontrol.ScheduleRealInfoService;
35 35 import com.bsth.util.*;
36   -import com.bsth.util.TransGPS.Location;
37 36 import com.bsth.websocket.handler.SendUtils;
38 37 import com.google.common.base.Splitter;
39 38 import com.google.common.collect.ArrayListMultimap;
... ... @@ -991,7 +990,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
991 990 return "";
992 991  
993 992 String gcjStr = "";
994   - Location location;
  993 + TransGPS.Location location;
995 994 for(String crd : array){
996 995 subArray = crd.split(" ");
997 996 if(subArray.length != 2)
... ... @@ -1209,8 +1208,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1209 1208  
1210 1209 @Override
1211 1210 public List<ScheduleRealInfo> queryListWaybill(String jName, String clZbh,
1212   - String lpName,String date) {
1213   - return scheduleRealInfoRepository.queryListWaybill2(jName,clZbh,lpName,date);
  1211 + String lpName,String date,String type) {
  1212 + if(type.equals("qp")){
  1213 + return scheduleRealInfoRepository.queryListWaybill2(jName,clZbh,lpName,date);
  1214 + }else{
  1215 + return scheduleRealInfoRepository.queryListWaybill(jName,clZbh,lpName,date);
  1216 + }
1214 1217 }
1215 1218  
1216 1219 @Override
... ...
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -502,9 +502,9 @@ public class ReportServiceImpl implements ReportService{
502 502 String lx1="";
503 503 for (int x = 0; x < lists.size(); x++) {
504 504 if(lists.get(x).get("lx").equals("lx0")){
505   - lx0=lists.get(x).get("fcsj").toString();
  505 + lx0=lists.get(x).get("fcsj")==null?"0:0":lists.get(x).get("fcsj").toString();
506 506 }else{
507   - lx1=lists.get(x).get("fcsj").toString();
  507 + lx1=lists.get(x).get("fcsj")==null?"0:0":lists.get(x).get("fcsj").toString();
508 508 }
509 509 }
510 510  
... ...
src/main/java/com/bsth/service/schedule/PeopleCarPlanService.java
... ... @@ -5,15 +5,15 @@ import java.util.Map;
5 5  
6 6 public interface PeopleCarPlanService {
7 7  
8   - List<Map<String, Object>> queryPeopleCar(String line, String date, String type);
  8 + List<Map<String, Object>> queryPeopleCar(Map<String, Object> map);
9 9  
10   - List<Map<String, Object>> workDaily(String line, String date, String type);
  10 + List<Map<String, Object>> workDaily(Map<String, Object> map);
11 11  
12   - Map<String, Object> scheduleAnaly(String page, String line, String startDate, String endDate, String model, String type);
  12 + Map<String, Object> scheduleAnaly(Map<String, Object> map);
13 13  
14   - List<Map<String, Object>> getModel(String line, String startDate, String endDate);
  14 + List<Map<String, Object>> getModel(Map<String, Object> map);
15 15  
16   - List<Map<String, Object>> firstAndLastBus(String line, String date, String type);
  16 + List<Map<String, Object>> firstAndLastBus(Map<String, Object> map);
17 17  
18   - List<Map<String, Object>> commandState(String line, String date, String code);
  18 + List<Map<String, Object>> commandState(Map<String, Object> map);
19 19 }
... ...