Commit da0d597f1c4c8530f4749431fe03d93b5b40b4d6

Authored by 王通
1 parent 9460dd02

1.master_base

Too many changes to show.

To preserve performance only 2 of 9 files are displayed.

src/main/java/com/bsth/CXFConfig.java
... ... @@ -10,13 +10,9 @@ import com.bsth.server_rs.base_info.person.PersonRestService;
10 10 import com.bsth.server_rs.base_info.section.LD_RoadSpeedRestService;
11 11 import com.bsth.server_rs.base_info.section.LD_SectionRestService;
12 12 import com.bsth.server_rs.base_info.station.StationRestService;
13   -import com.bsth.server_rs.bigdata.BigdataService;
14   -import com.bsth.server_rs.bigdata.BigscreenService;
15 13 import com.bsth.server_rs.departure.DepartureRestService;
16 14 import com.bsth.server_rs.destroy.DestroyDetailRestService;
17 15 import com.bsth.server_rs.directive.DirectiveRestService;
18   -import com.bsth.server_rs.dks.DksRestService;
19   -import com.bsth.server_rs.electric.ElectricService;
20 16 import com.bsth.server_rs.exception.AesExceptionMapper;
21 17 import com.bsth.server_rs.gps.GpsRestService;
22 18 import com.bsth.server_rs.logs.RealLogRestService;
... ... @@ -118,12 +114,6 @@ public class CXFConfig {
118 114 @Autowired
119 115 LD_RoadSpeedRestService ld_roadSpeedRestService;
120 116 @Autowired
121   - ElectricService electricService;
122   - @Autowired
123   - BigdataService bigdataService;
124   - @Autowired
125   - BigscreenService bigscreenService;
126   - @Autowired
127 117 StaffViewRealService staffViewRealService;
128 118 @Autowired
129 119 RateService rateService;
... ... @@ -134,8 +124,6 @@ public class CXFConfig {
134 124 @Autowired
135 125 private DepartureRestService departureRestService;
136 126 @Autowired
137   - private DksRestService dksRestService;
138   - @Autowired
139 127 private WhiteIpRestService whiteIpRestService;
140 128 @Autowired
141 129 private ManHoursRestService manHoursRestService;
... ... @@ -160,15 +148,11 @@ public class CXFConfig {
160 148 realLogRestService,
161 149 directiveRestService,
162 150 ld_roadSpeedRestService,
163   - electricService,
164 151 staffViewRealService,
165   - bigdataService,
166   - bigscreenService,
167 152 rateService,
168 153 destroyDetailRestService,
169 154 carparkRestService,
170 155 departureRestService,
171   - dksRestService,
172 156 whiteIpRestService,
173 157 manHoursRestService,
174 158 ioCarparkRestService));
... ...
src/main/java/com/bsth/server_rs/bigdata/BigdataService.java deleted 100644 → 0
1   -package com.bsth.server_rs.bigdata;
2   -
3   -import java.math.BigDecimal;
4   -import java.math.RoundingMode;
5   -import java.sql.ResultSet;
6   -import java.sql.SQLException;
7   -import java.text.DecimalFormat;
8   -import java.text.ParseException;
9   -import java.text.SimpleDateFormat;
10   -import java.util.ArrayList;
11   -import java.util.Calendar;
12   -import java.util.Collections;
13   -import java.util.Comparator;
14   -import java.util.Date;
15   -import java.util.HashMap;
16   -import java.util.HashSet;
17   -import java.util.List;
18   -import java.util.Map;
19   -import java.util.Set;
20   -
21   -import javax.ws.rs.GET;
22   -import javax.ws.rs.Path;
23   -import javax.ws.rs.PathParam;
24   -import javax.ws.rs.Produces;
25   -import javax.ws.rs.core.MediaType;
26   -
27   -import org.slf4j.Logger;
28   -import org.slf4j.LoggerFactory;
29   -import org.springframework.beans.factory.annotation.Autowired;
30   -import org.springframework.jdbc.core.JdbcTemplate;
31   -import org.springframework.jdbc.core.RowMapper;
32   -import org.springframework.stereotype.Component;
33   -
34   -import com.alibaba.fastjson.JSON;
35   -import com.alibaba.fastjson.JSONObject;
36   -import com.bsth.common.BusinessCodeData;
37   -import com.bsth.entity.CalcInvestigateMonth;
38   -import com.bsth.entity.ChildTaskPlan;
39   -import com.bsth.entity.DestroySituation;
40   -import com.bsth.entity.ElecInfo;
41   -import com.bsth.entity.OilInfo;
42   -import com.bsth.entity.ScheduleRealInfo;
43   -import com.bsth.repository.CalcInvestigateMonthRepository;
44   -import com.bsth.repository.DestroySituationRepository;
45   -import com.bsth.repository.ElecInfoRepository;
46   -import com.bsth.repository.OilInfoRepository;
47   -import com.bsth.repository.ScheduleRealInfoRepository;
48   -import com.bsth.server_rs.base_info.car.buffer.CarBufferData;
49   -import com.bsth.util.Arith;
50   -
51   -@Component
52   -@Path("/bigdata")
53   -@Produces({MediaType.APPLICATION_JSON})
54   -public class BigdataService {
55   - Logger logger = LoggerFactory.getLogger(this.getClass());
56   -
57   - @Autowired
58   - JdbcTemplate jdbcTemplate;
59   -
60   - @Autowired
61   - private DestroySituationRepository destroySituationRepository;
62   -
63   - @Autowired
64   - private ScheduleRealInfoRepository scheduleRealInfoRepository;
65   -
66   - @Autowired
67   - private OilInfoRepository oilInfoRepository;
68   -
69   - @Autowired
70   - private ElecInfoRepository elecInfoRepository;
71   -
72   - @Autowired
73   - private CalcInvestigateMonthRepository calcInvestigateMonthRepository;
74   -
75   -
76   - DecimalFormat df = new DecimalFormat("0.00");
77   -
78   - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
79   -
80   - /*
81   - * 线路接口开始
82   - */
83   -
84   - private static String getNature(String natureCode){
85   - String natureName="";
86   - if("lj".equals(natureCode)){
87   - natureName="路救";
88   - }else if("bc".equals(natureCode)){
89   - natureName="备车";
90   - }else if("dbc".equals(natureCode)){
91   - natureName="定班车";
92   - }else if("yxl".equals(natureCode)){
93   - natureName="夜宵路";
94   - }else if("cgxl".equals(natureCode)){
95   - natureName="常规线路";
96   - }else if("gjxl".equals(natureCode)){
97   - natureName="过江线路";
98   - }else if("csbs".equals(natureCode)){
99   - natureName="穿梭巴士";
100   - }else if("tyxl".equals(natureCode)){
101   - natureName="特约线路";
102   - }else if("cctxl".equals(natureCode)){
103   - natureName="村村通线路";
104   - }else if("qt".equals(natureCode)){
105   - natureName="其他";
106   - }else {
107   - natureName="";
108   - }
109   - return natureName;
110   - }
111   -
112   - private static String getGs(String gs){
113   - String name="";
114   - if("05".equals(gs)){
115   - name="杨高公司";
116   - }else if("22".equals(gs)){
117   - name="金高公司";
118   - }else if("26".equals(gs)){
119   - name="南汇公司";
120   - }else if("55".equals(gs)){
121   - name="上南公司";
122   - }else{
123   - name="";
124   - }
125   - return name;
126   - }
127   -
128   - private static String getState(String carState){
129   - if(carState.equals("1")){
130   - return "在册未在用";
131   - }else if(carState.equals("2")){
132   - return "在册在用";
133   - }else if(carState.equals("3")){
134   - return "报废审核中";
135   - }else if(carState.equals("4")){
136   - return "报废待更新";
137   - }else if(carState.equals("5")){
138   - return "报废已更新";
139   - }else{
140   - return "";
141   - }
142   - }
143   - public Map<String, Long> getEndtime(String date){
144   - Map<String, Long> map=new HashMap<String,Long>();
145   - String sql="select xl,endtime from bsth_c_calc_count "
146   - + " where date='"+date+"' ";
147   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
148   - new RowMapper<Map<String, Object>>(){
149   - @Override
150   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
151   - Map<String, Object> m=new HashMap<String, Object>();
152   - m.put("line", rs.getString("xl"));
153   - m.put("endtime", rs.getString("endtime"));
154   - return m;
155   - }
156   - });
157   - for (int i = 0; i < list.size(); i++) {
158   - map.put(list.get(i).get("line").toString(),
159   - Long.parseLong(list.get(i).get("endtime").toString()));
160   - }
161   - return map;
162   - }
163   - @GET
164   - @Path("/line/all")
165   - public List<Map<String, Object>> findLineAll(){
166   - String sql="SELECT b.start_opt,a.company,a.line_code,a.name,a.level,"
167   - + " a.shanghai_linecode, a.nature from "
168   - + " bsth_c_line a left join bsth_c_line_config b "
169   - + " on a.id=b.line where "
170   - + " a.shanghai_linecode is not null and a.shanghai_linecode !='' and a.destroy=0 "
171   - + " and a.remove=0 ";
172   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
173   - new RowMapper<Map<String, Object>>(){
174   - @Override
175   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
176   - Map<String, Object> m=new HashMap<String,Object>();
177   - m.put("state", rs.getString("start_opt"));
178   - m.put("company", rs.getString("company"));
179   - m.put("companyName", getGs(rs.getString("company")));
180   - m.put("lineCode",rs.getString("line_code"));
181   - m.put("name", rs.getString("name"));
182   - m.put("level", rs.getString("level"));
183   - m.put("shanghaiLinecode", rs.getString("shanghai_linecode"));
184   - m.put("nature", getNature(rs.getString("nature")));
185   - return m;
186   - }
187   - });
188   - Date d=new Date();
189   - SimpleDateFormat hm=new SimpleDateFormat("HH:mm");
190   - SimpleDateFormat ymd=new SimpleDateFormat("yyyy-MM-dd");
191   -
192   - String qqrq=ymd.format(d);
193   - String qqsj=hm.format(d);
194   - String qqsjs[]=qqsj.split(":");
195   - Date nDate=new Date();
196   - Calendar calendar = Calendar.getInstance();
197   - calendar.setTime(nDate);
198   - calendar.add(Calendar.DAY_OF_MONTH, -1);
199   - Date dBefore = calendar.getTime();
200   - String qqrqbefore =ymd.format(dBefore);
201   - int qqsjtime=Integer.parseInt(qqsjs[0])*60+Integer.parseInt(qqsjs[1]);
202   - Map<String, Long> endMap1=getEndtime(qqrqbefore);
203   - Map<String, Long> endMap2=getEndtime(qqrq);
204   -
205   - for (int i = 0; i < list.size(); i++) {
206   - Map<String, Object> m=list.get(i);
207   - int fcsjtime=0;
208   - if(m.get("state")!=null){
209   - String start_opt[]=m.get("state").toString().split(":");
210   - fcsjtime=Integer.parseInt(start_opt[0])*60+Integer.parseInt(start_opt[1]);
211   - }
212   - //请求时间小于翻班时间 营运日期当做请求日期的前一天。
213   - long maxtime=d.getTime();
214   - String yyzt="";
215   - if(qqsjtime<fcsjtime){
216   - if(endMap1.get(m.get("lineCode").toString())!=null){
217   - if(endMap1.get(m.get("lineCode").toString())>=maxtime){
218   - yyzt="营运";
219   - }else{
220   - yyzt="未营运";
221   - }
222   - }else{
223   - yyzt="未营运";
224   - }
225   - }else{
226   - if(endMap2.get(m.get("lineCode").toString())!=null){
227   - if(endMap2.get(m.get("lineCode").toString())>=maxtime){
228   - yyzt="营运";
229   - }else{
230   - yyzt="未营运";
231   - }
232   - }else{
233   - yyzt="未营运";
234   - }
235   - }
236   - m.put("state", yyzt);
237   - }
238   - return list;
239   - }
240   -
241   -
242   - @GET
243   - @Path("/line/company/{companyId}")
244   - public List<Map<String, Object>> findLineByCompany(@PathParam("companyId") String companyId) {
245   - String sql="SELECT b.start_opt,a.company,a.line_code,a.name,a.level,"
246   - + " a.shanghai_linecode, a.nature from "
247   - + " bsth_c_line a left join bsth_c_line_config b "
248   - + " on a.id=b.line where "
249   - + " a.shanghai_linecode is not null and a.shanghai_linecode !='' and a.destroy=0 "
250   - + " and a.remove=0 and a.company = '"+companyId+"'";
251   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
252   - new RowMapper<Map<String, Object>>(){
253   - @Override
254   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
255   - Map<String, Object> m=new HashMap<String,Object>();
256   - m.put("state", rs.getString("start_opt"));
257   - m.put("company", rs.getString("company"));
258   - m.put("companyName", getGs(rs.getString("company")));
259   - m.put("lineCode",rs.getString("line_code"));
260   - m.put("name", rs.getString("name"));
261   - m.put("level", rs.getString("level"));
262   - m.put("shanghaiLinecode", rs.getString("shanghai_linecode"));
263   - m.put("nature", getNature(rs.getString("nature")));
264   - return m;
265   - }
266   - });
267   - Date d=new Date();
268   - SimpleDateFormat hm=new SimpleDateFormat("HH:mm");
269   - SimpleDateFormat ymd=new SimpleDateFormat("yyyy-MM-dd");
270   -
271   - String qqrq=ymd.format(d);
272   - String qqsj=hm.format(d);
273   - String qqsjs[]=qqsj.split(":");
274   - Date nDate=new Date();
275   - Calendar calendar = Calendar.getInstance();
276   - calendar.setTime(nDate);
277   - calendar.add(Calendar.DAY_OF_MONTH, -1);
278   - Date dBefore = calendar.getTime();
279   - String qqrqbefore =ymd.format(dBefore);
280   - int qqsjtime=Integer.parseInt(qqsjs[0])*60+Integer.parseInt(qqsjs[1]);
281   - Map<String, Long> endMap1=getEndtime(qqrqbefore);
282   - Map<String, Long> endMap2=getEndtime(qqrq);
283   -
284   - for (int i = 0; i < list.size(); i++) {
285   - Map<String, Object> m=list.get(i);
286   - int fcsjtime=0;
287   - if(m.get("state")!=null){
288   - String start_opt[]=m.get("state").toString().split(":");
289   - fcsjtime=Integer.parseInt(start_opt[0])*60+Integer.parseInt(start_opt[1]);
290   - }
291   - //请求时间小于翻班时间 营运日期当做请求日期的前一天。
292   - long maxtime=d.getTime();
293   - String yyzt="";
294   - if(qqsjtime<fcsjtime){
295   - if(endMap1.get(m.get("lineCode").toString())!=null){
296   - if(endMap1.get(m.get("lineCode").toString())>=maxtime){
297   - yyzt="营运";
298   - }else{
299   - yyzt="未营运";
300   - }
301   - }else{
302   - yyzt="未营运";
303   - }
304   - }else{
305   - if(endMap2.get(m.get("lineCode").toString())!=null){
306   - if(endMap2.get(m.get("lineCode").toString())>=maxtime){
307   - yyzt="营运";
308   - }else{
309   - yyzt="未营运";
310   - }
311   - }else{
312   - yyzt="未营运";
313   - }
314   - }
315   - m.put("state", yyzt);
316   - }
317   - return list;
318   - }
319   -
320   - @GET
321   - @Path("/line/{lineCode}")
322   - public List<Map<String, Object>> findLineByCode(@PathParam("lineCode") String lineCode) {
323   - String sql="SELECT b.start_opt,a.company,a.line_code,a.name,a.level,"
324   - + " a.shanghai_linecode, a.nature from "
325   - + " bsth_c_line a left join bsth_c_line_config b "
326   - + " on a.id=b.line where "
327   - + " a.shanghai_linecode is not null and a.shanghai_linecode !='' and a.destroy=0 "
328   - + " and a.remove=0 and a.line_code = '"+lineCode+"'";
329   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
330   - new RowMapper<Map<String, Object>>(){
331   - @Override
332   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
333   - Map<String, Object> m=new HashMap<String,Object>();
334   - m.put("state", rs.getString("start_opt"));
335   - m.put("company", rs.getString("company"));
336   - m.put("companyName", getGs(rs.getString("company")));
337   - m.put("lineCode",rs.getString("line_code"));
338   - m.put("name", rs.getString("name"));
339   - m.put("level", rs.getString("level"));
340   - m.put("shanghaiLinecode", rs.getString("shanghai_linecode"));
341   - m.put("nature", getNature(rs.getString("nature")));
342   - return m;
343   - }
344   - });
345   - Date d=new Date();
346   - SimpleDateFormat hm=new SimpleDateFormat("HH:mm");
347   - SimpleDateFormat ymd=new SimpleDateFormat("yyyy-MM-dd");
348   -
349   - String qqrq=ymd.format(d);
350   - String qqsj=hm.format(d);
351   - String qqsjs[]=qqsj.split(":");
352   - Date nDate=new Date();
353   - Calendar calendar = Calendar.getInstance();
354   - calendar.setTime(nDate);
355   - calendar.add(Calendar.DAY_OF_MONTH, -1);
356   - Date dBefore = calendar.getTime();
357   - String qqrqbefore =ymd.format(dBefore);
358   - int qqsjtime=Integer.parseInt(qqsjs[0])*60+Integer.parseInt(qqsjs[1]);
359   - Map<String, Long> endMap1=getEndtime(qqrqbefore);
360   - Map<String, Long> endMap2=getEndtime(qqrq);
361   -
362   - for (int i = 0; i < list.size(); i++) {
363   - Map<String, Object> m=list.get(i);
364   - int fcsjtime=0;
365   - if(m.get("state")!=null){
366   - String start_opt[]=m.get("state").toString().split(":");
367   - fcsjtime=Integer.parseInt(start_opt[0])*60+Integer.parseInt(start_opt[1]);
368   - }
369   - //请求时间小于翻班时间 营运日期当做请求日期的前一天。
370   - long maxtime=d.getTime();
371   - String yyzt="";
372   - if(qqsjtime<fcsjtime){
373   - if(endMap1.get(m.get("lineCode").toString())!=null){
374   - if(endMap1.get(m.get("lineCode").toString())>=maxtime){
375   - yyzt="营运";
376   - }else{
377   - yyzt="未营运";
378   - }
379   - }else{
380   - yyzt="未营运";
381   - }
382   - }else{
383   - if(endMap2.get(m.get("lineCode").toString())!=null){
384   - if(endMap2.get(m.get("lineCode").toString())>=maxtime){
385   - yyzt="营运";
386   - }else{
387   - yyzt="未营运";
388   - }
389   - }else{
390   - yyzt="未营运";
391   - }
392   - }
393   - m.put("state", yyzt);
394   - }
395   - return list;
396   - }
397   -
398   - @GET
399   - @Path("/line/level/{level}")
400   - public List<Map<String, Object>> findLineByLevle(@PathParam("level") String level) {
401   - String sql="SELECT b.start_opt,a.company,a.line_code,a.name,a.level,"
402   - + " a.shanghai_linecode, a.nature from "
403   - + " bsth_c_line a left join bsth_c_line_config b "
404   - + " on a.id=b.line where "
405   - + " a.shanghai_linecode is not null and a.shanghai_linecode !='' and a.destroy=0 "
406   - + " and a.remove=0 and a.level = '"+level+"'";
407   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
408   - new RowMapper<Map<String, Object>>(){
409   - @Override
410   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
411   - Map<String, Object> m=new HashMap<String,Object>();
412   - m.put("state", rs.getString("start_opt"));
413   - m.put("company", rs.getString("company"));
414   - m.put("companyName", getGs(rs.getString("company")));
415   - m.put("lineCode",rs.getString("line_code"));
416   - m.put("name", rs.getString("name"));
417   - m.put("level", rs.getString("level"));
418   - m.put("shanghaiLinecode", rs.getString("shanghai_linecode"));
419   - m.put("nature", getNature(rs.getString("nature")));
420   - return m;
421   - }
422   - });
423   - Date d=new Date();
424   - SimpleDateFormat hm=new SimpleDateFormat("HH:mm");
425   - SimpleDateFormat ymd=new SimpleDateFormat("yyyy-MM-dd");
426   -
427   - String qqrq=ymd.format(d);
428   - String qqsj=hm.format(d);
429   - String qqsjs[]=qqsj.split(":");
430   - Date nDate=new Date();
431   - Calendar calendar = Calendar.getInstance();
432   - calendar.setTime(nDate);
433   - calendar.add(Calendar.DAY_OF_MONTH, -1);
434   - Date dBefore = calendar.getTime();
435   - String qqrqbefore =ymd.format(dBefore);
436   - int qqsjtime=Integer.parseInt(qqsjs[0])*60+Integer.parseInt(qqsjs[1]);
437   - Map<String, Long> endMap1=getEndtime(qqrqbefore);
438   - Map<String, Long> endMap2=getEndtime(qqrq);
439   -
440   - for (int i = 0; i < list.size(); i++) {
441   - Map<String, Object> m=list.get(i);
442   - int fcsjtime=0;
443   - if(m.get("state")!=null){
444   - String start_opt[]=m.get("state").toString().split(":");
445   - fcsjtime=Integer.parseInt(start_opt[0])*60+Integer.parseInt(start_opt[1]);
446   - }
447   - //请求时间小于翻班时间 营运日期当做请求日期的前一天。
448   - long maxtime=d.getTime();
449   - String yyzt="";
450   - if(qqsjtime<fcsjtime){
451   - if(endMap1.get(m.get("lineCode").toString())!=null){
452   - if(endMap1.get(m.get("lineCode").toString())>=maxtime){
453   - yyzt="营运";
454   - }else{
455   - yyzt="未营运";
456   - }
457   - }else{
458   - yyzt="未营运";
459   - }
460   - }else{
461   - if(endMap2.get(m.get("lineCode").toString())!=null){
462   - if(endMap2.get(m.get("lineCode").toString())>=maxtime){
463   - yyzt="营运";
464   - }else{
465   - yyzt="未营运";
466   - }
467   - }else{
468   - yyzt="未营运";
469   - }
470   - }
471   - m.put("state", yyzt);
472   - }
473   - return list;
474   - }
475   - /*
476   - * 线路接口结束
477   - */
478   -
479   -
480   - /*
481   - * 线路配车接口开始
482   - */
483   - @GET
484   - @Path("/lineCar/{type}/date/{date}")
485   - public List<Map<String, Object>> findLineCarByDate(@PathParam("type") String type,@PathParam("date") String date) {
486   - String sql="";
487   - if(type.equals("all")){
488   - sql="select t.date,t.gsdm,t.xl,t.xl_name,t.jhccz as jhcc,t.sjcc"
489   - + " from bsth_c_calc_count t where t.date='"+date+"'";
490   - }
491   - if(type.equals("actual")){
492   - sql="select t.date,t.gsdm,t.xl,t.xl_name,t.jhcc as jhcc,t.sjcc"
493   - + " from bsth_c_calc_count t where t.date='"+date+"'";
494   - }
495   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
496   - new RowMapper<Map<String, Object>>(){
497   - @Override
498   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
499   - Map<String, Object> m=new HashMap<String,Object>();
500   - m.put("date", rs.getString("date"));
501   - m.put("company", rs.getString("gsdm"));
502   - m.put("companyName", getGs(rs.getString("gsdm")));
503   - m.put("lineCode",rs.getString("xl"));
504   - m.put("lineName", rs.getString("xl_name"));
505   - m.put("jhcc", rs.getString("jhcc"));
506   - m.put("sjcc", rs.getString("sjcc"));
507   - return m;
508   - }
509   - });
510   -
511   - return list;
512   - }
513   -
514   -
515   - @GET
516   - @Path("/lineCar/{type}/date/{date}/line/{line}")
517   - public List<Map<String, Object>> findLineCarByDateLine(@PathParam("type") String type,@PathParam("date") String date,
518   - @PathParam("line") String line) {
519   - String sql="";
520   - if(type.equals("all")){
521   - sql="select t.gsdm,t.xl,t.xl_name,t.jhccz as jhcc,t.sjcc"
522   - + " from bsth_c_calc_count t where t.date='"+date+"'"
523   - + " and xl ='"+line+"'";
524   - }
525   - if(type.equals("actual")){
526   - sql="select t.gsdm,t.xl,t.xl_name,t.jhcc as jhcc,t.sjcc"
527   - + " from bsth_c_calc_count t where t.date='"+date+"'"
528   - + " and xl ='"+line+"'";
529   -
530   - }
531   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
532   - new RowMapper<Map<String, Object>>(){
533   - @Override
534   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
535   - Map<String, Object> m=new HashMap<String,Object>();
536   - m.put("company", rs.getString("gsdm"));
537   - m.put("companyName", getGs(rs.getString("gsdm")));
538   - m.put("lineCode",rs.getString("xl"));
539   - m.put("lineName", rs.getString("xl_name"));
540   - m.put("jhcc", rs.getString("jhcc"));
541   - m.put("sjcc", rs.getString("sjcc"));
542   - return m;
543   - }
544   - });
545   -
546   - return list;
547   - }
548   -
549   - /*
550   - * 线路配车接口结束
551   - */
552   -
553   - /*
554   - * 线路配人接口开始
555   - */
556   - @GET
557   - @Path("/linePerson/{type}/date/{date}")
558   - public List<Map<String, Object>> findLinePersonByDate(@PathParam("type") String type,@PathParam("date") String date) {
559   - String sql="";
560   - if(type.equals("all")){
561   - sql="select t.date,t.gsdm,t.xl,t.xl_name,t.jhprz as jhpr,t.sjpr"
562   - + " from bsth_c_calc_count t where t.date='"+date+"'";
563   - }
564   - if(type.equals("actual")){
565   - sql="select t.date,t.gsdm,t.xl,t.xl_name,t.jhprss as jhpr,t.sjpr"
566   - + " from bsth_c_calc_count t where t.date='"+date+"'";
567   - }
568   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
569   - new RowMapper<Map<String, Object>>(){
570   - @Override
571   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
572   - Map<String, Object> m=new HashMap<String,Object>();
573   - m.put("date", rs.getString("date"));
574   - m.put("company", rs.getString("gsdm"));
575   - m.put("companyName", getGs(rs.getString("gsdm")));
576   - m.put("lineCode",rs.getString("xl"));
577   - m.put("lineName", rs.getString("xl_name"));
578   - String jhpr=rs.getString("jhpr");
579   - m.put("jhjsy", jhpr.split("/")[0]);
580   - m.put("jhspy", jhpr.split("/")[1]);
581   - String sjpr= rs.getString("sjpr");
582   - m.put("sjjsy", sjpr.split("/")[0]);
583   - m.put("sjspy", sjpr.split("/")[1]);
584   - return m;
585   - }
586   - });
587   -
588   - return list;
589   - }
590   -
591   -
592   - @GET
593   - @Path("/linePerson/{type}/date/{date}/line/{line}")
594   - public List<Map<String, Object>> findLinePersonByDateLine(@PathParam("type") String type,@PathParam("date") String date,
595   - @PathParam("line") String line) {
596   - String sql="";
597   - if(type.equals("all")){
598   - sql="select t.date,t.gsdm,t.xl,t.xl_name,t.jhprz as jhpr,t.sjpr"
599   - + " from bsth_c_calc_count t where t.date='"+date+"'"
600   - + " and xl ='"+line+"'";
601   - }
602   - if(type.equals("actual")){
603   - sql="select t.date,t.gsdm,t.xl,t.xl_name,t.jhprss as jhpr,t.sjpr"
604   - + " from bsth_c_calc_count t where t.date='"+date+"'"
605   - + " and xl ='"+line+"'";
606   - }
607   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
608   - new RowMapper<Map<String, Object>>(){
609   - @Override
610   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
611   - Map<String, Object> m=new HashMap<String,Object>();
612   - m.put("date", rs.getString("date"));
613   - m.put("company", rs.getString("gsdm"));
614   - m.put("companyName", getGs(rs.getString("gsdm")));
615   - m.put("lineCode",rs.getString("xl"));
616   - m.put("lineName", rs.getString("xl_name"));
617   - String jhpr=rs.getString("jhpr");
618   - m.put("jhjsy", jhpr.split("/")[0]);
619   - m.put("jhspy", jhpr.split("/")[1]);
620   - String sjpr= rs.getString("sjpr");
621   - m.put("sjjsy", sjpr.split("/")[0]);
622   - m.put("sjspy", sjpr.split("/")[1]);
623   - return m;
624   - }
625   - });
626   -
627   - return list;
628   - }
629   -
630   -
631   -
632   -
633   - /*
634   - * 线路配人接口结束
635   - */
636   -
637   -
638   - /*
639   - * 线路班次接口开始
640   - */
641   - @GET
642   - @Path("/lineBc/{type}/date/{date}")
643   - public List<Map<String, Object>> findLineBcByDate(@PathParam("type") String type,
644   - @PathParam("date") String date) {
645   - String sql="";
646   - if(type.equals("all")){
647   - sql="select t.gsdm,t.xl,t.xl_name,t.jhbcz as jhbc,t.jhzgfbcz as jhzgfbc,"
648   - + " t.jhwgfbcz as jhwgfbc,t.sjbc,t.sjzgfbc,t.sjwgfbc from bsth_c_calc_count t"
649   - + " where t.date='"+date+"'";
650   - }
651   - if(type.equals("actual")){
652   - sql="select t.gsdm,t.xl,t.xl_name,t.jhbc as jhbc,t.jhzgfbcss as jhzgfbc,"
653   - + " t.jhwgfbcss as jhwgfbc,t.sjbc,t.sjzgfbc,t.sjwgfbc from bsth_c_calc_count t"
654   - + " where t.date='"+date+"'";
655   - }
656   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
657   - new RowMapper<Map<String, Object>>(){
658   - @Override
659   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
660   - Map<String, Object> m=new HashMap<String,Object>();
661   - m.put("company", rs.getString("gsdm"));
662   - m.put("companyName", getGs(rs.getString("gsdm")));
663   - m.put("lineCode",rs.getString("xl"));
664   - m.put("lineName", rs.getString("xl_name"));
665   - m.put("jhbc", rs.getString("jhbc"));
666   - m.put("jhzgfbc", rs.getString("jhzgfbc"));
667   - m.put("jhwgfbc", rs.getString("jhwgfbc"));
668   - m.put("sjbc", rs.getString("sjbc"));
669   - m.put("sjzgfbc", rs.getString("sjzgfbc"));
670   - m.put("sjwgfbc", rs.getString("sjwgfbc"));
671   - return m;
672   - }
673   - });
674   - return list;
675   - }
676   -
677   -
678   - @GET
679   - @Path("/lineBc/{type}/date/{date}/line/{line}")
680   - public List<Map<String, Object>> findLineBcByDateLine(@PathParam("type") String type,
681   - @PathParam("date") String date,@PathParam("line") String line) {
682   - String sql="";
683   - if(type.equals("all")){
684   - sql="select t.gsdm,t.xl,t.xl_name,t.jhbcz as jhbc,t.jhzgfbcz as jhzgfbc,"
685   - + " t.jhwgfbcz as jhwgfbc,t.sjbc,t.sjzgfbc,t.sjwgfbc from bsth_c_calc_count t "
686   - + " where t.date='"+date+"' and xl='"+line+"'";
687   - }
688   - if(type.equals("actual")){
689   - sql="select t.gsdm,t.xl,t.xl_name,t.jhbc as jhbc,t.jhzgfbcss as jhzgfbc,"
690   - + " t.jhwgfbcss as jhwgfbc,t.sjbc,t.sjzgfbc,t.sjwgfbc from bsth_c_calc_count t"
691   - + " where t.date='"+date+"' and xl='"+line+"'";
692   - }
693   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
694   - new RowMapper<Map<String, Object>>(){
695   - @Override
696   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
697   - Map<String, Object> m=new HashMap<String,Object>();
698   - m.put("company", rs.getString("gsdm"));
699   - m.put("companyName", getGs(rs.getString("gsdm")));
700   - m.put("lineCode",rs.getString("xl"));
701   - m.put("lineName", rs.getString("xl_name"));
702   - m.put("jhbc", rs.getString("jhbc"));
703   - m.put("jhzgfbc", rs.getString("jhzgfbc"));
704   - m.put("jhwgfbc", rs.getString("jhwgfbc"));
705   - m.put("sjbc", rs.getString("sjbc"));
706   - m.put("sjzgfbc", rs.getString("sjzgfbc"));
707   - m.put("sjwgfbc", rs.getString("sjwgfbc"));
708   - return m;
709   - }
710   - });
711   - return list;
712   - }
713   -
714   - /*
715   - * 线路班次接口结束
716   - */
717   -
718   - /*
719   - * 线路里程接口开始
720   - */
721   -
722   - @GET
723   - @Path("/lineLc/{type}/date/{date}")
724   - public List<Map<String, Object>> findLineLcByDate(@PathParam("type") String type,
725   - @PathParam("date") String date) {
726   - String sql="";
727   - if(type.equals("all")){
728   - sql="select t.gsdm,t.xl,t.xl_name,t.jhzglz as jhzlc,t.jhyylcz as jhyylc,"
729   - + " t.jhkslcz as jhkslc,t.sjzgl as sjzlc,t.sjyylc,t.sjkslc from bsth_c_calc_count t"
730   - + " where t.date='"+date+"'";
731   - }
732   - if(type.equals("actual")){
733   - sql="select t.gsdm,t.xl,t.xl_name,t.jhzgl as jhzlc,t.jhyylc as jhyylc,"
734   - + " t.jhkslc as jhkslc,t.sjzgl as sjzlc,t.sjyylc,t.sjkslc from bsth_c_calc_count t"
735   - + " where t.date='"+date+"'";
736   - }
737   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
738   - new RowMapper<Map<String, Object>>(){
739   - @Override
740   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
741   - Map<String, Object> m=new HashMap<String,Object>();
742   - m.put("company", rs.getString("gsdm"));
743   - m.put("companyName", getGs(rs.getString("gsdm")));
744   - m.put("lineCode",rs.getString("xl"));
745   - m.put("lineName", rs.getString("xl_name"));
746   - m.put("jhzlc", rs.getString("jhzlc"));
747   - m.put("jhyylc", rs.getString("jhyylc"));
748   - m.put("jhkslc", rs.getString("jhkslc"));
749   - m.put("sjzlc", rs.getString("sjzlc"));
750   - m.put("sjyylc", rs.getString("sjyylc"));
751   - m.put("sjkslc", rs.getString("sjkslc"));
752   - if(Double.parseDouble(rs.getString("jhzlc"))>0){
753   - double zlczxl=Double.parseDouble(rs.getString("sjzlc"))/Double.parseDouble(rs.getString("jhzlc"));
754   - m.put("zlczxl",df.format(zlczxl*100)+"%");
755   - }else{
756   - m.put("zlczxl","0.00%");
757   -
758   - }
759   - if(Double.parseDouble(rs.getString("jhyylc"))>0){
760   - double yylczxl=Double.parseDouble(rs.getString("sjyylc"))/Double.parseDouble(rs.getString("jhyylc"));
761   - m.put("yylczxl",df.format(yylczxl*100)+"%");
762   - }else{
763   - m.put("yylczxl","0.00%");
764   - }
765   - return m;
766   - }
767   - });
768   - return list;
769   - }
770   -
771   -
772   - @GET
773   - @Path("/lineLc/{type}/date/{date}/line/{line}")
774   - public List<Map<String, Object>> findLineLcByDateLine(@PathParam("type") String type,
775   - @PathParam("date") String date,@PathParam("line") String line) {
776   - String sql="";
777   - if(type.equals("all")){
778   - sql="select t.gsdm,t.xl,t.xl_name,t.jhzglz as jhzlc,t.jhyylcz as jhyylc,"
779   - + " t.jhkslcz as jhkslc,t.sjzgl as sjzlc,t.sjyylc,t.sjkslc from bsth_c_calc_count t"
780   - + " where t.date='"+date+"' and xl ='"+line+"'";
781   - }
782   - if(type.equals("actual")){
783   - sql="select t.gsdm,t.xl,t.xl_name,t.jhzgl as jhzlc,t.jhyylc as jhyylc,"
784   - + " t.jhkslc as jhkslc,t.sjzgl as sjzlc,t.sjyylc,t.sjkslc from bsth_c_calc_count t"
785   - + " where t.date='"+date+"' and xl ='"+line+"'";
786   - }
787   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
788   - new RowMapper<Map<String, Object>>(){
789   - @Override
790   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
791   - Map<String, Object> m=new HashMap<String,Object>();
792   - m.put("company", rs.getString("gsdm"));
793   - m.put("companyName", getGs(rs.getString("gsdm")));
794   - m.put("lineCode",rs.getString("xl"));
795   - m.put("lineName", rs.getString("xl_name"));
796   - m.put("jhzlc", rs.getString("jhzlc"));
797   - m.put("jhyylc", rs.getString("jhyylc"));
798   - m.put("jhkslc", rs.getString("jhkslc"));
799   - m.put("sjzlc", rs.getString("sjzlc"));
800   - m.put("sjyylc", rs.getString("sjyylc"));
801   - m.put("sjkslc", rs.getString("sjkslc"));
802   - if(Double.parseDouble(rs.getString("jhzlc"))>0){
803   - double zlczxl=Double.parseDouble(rs.getString("sjzlc"))/Double.parseDouble(rs.getString("jhzlc"));
804   - m.put("zlczxl",df.format(zlczxl*100)+"%");
805   - }else{
806   - m.put("zlczxl","0.00%");
807   -
808   - }
809   - if(Double.parseDouble(rs.getString("jhyylc"))>0){
810   - double yylczxl=Double.parseDouble(rs.getString("sjyylc"))/Double.parseDouble(rs.getString("jhyylc"));
811   - m.put("yylczxl",df.format(yylczxl*100)+"%");
812   - }else{
813   - m.put("yylczxl","0.00%");
814   - }
815   - return m;
816   - }
817   - });
818   - return list;
819   - }
820   - /*
821   - * 线路里程接口结束
822   - */
823   -
824   -
825   - /*
826   - * 班次执行率连续三天不满93%推送
827   - */
828   - @GET
829   - @Path("/abnormal/executionRate/date/{date}")
830   - public List<Map<String, Object>> executionRate(@PathParam("date") String date) {
831   - String sql="select gs_name,show_date,xl_bm,xl_name from bsth_c_calc_push t"
832   - + " where t.date='"+date+"' and push_type in ('1','3')";
833   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
834   - new RowMapper<Map<String, Object>>(){
835   - @Override
836   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
837   - Map<String, Object> m=new HashMap<String,Object>();
838   - m.put("companyName", rs.getString("gs_name"));
839   - m.put("lineCode",rs.getString("xl_bm"));
840   - m.put("lineName", rs.getString("xl_name"));
841   - m.put("showDate", rs.getString("show_date"));
842   - return m;
843   - }
844   - });
845   - return list;
846   - }
847   - /*
848   - * 首末班发车连续三天不准点
849   - */
850   - @GET
851   - @Path("/abnormal/firstAndLast/date/{date}")
852   - public List<Map<String, Object>> firstAndLast(@PathParam("date") String date) {
853   - String sql="select gs_name,show_date,xl_bm,xl_name from bsth_c_calc_push t"
854   - + " where t.date='"+date+"' and push_type in ('2','3')";
855   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
856   - new RowMapper<Map<String, Object>>(){
857   - @Override
858   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
859   - Map<String, Object> m=new HashMap<String,Object>();
860   - m.put("companyName", rs.getString("gs_name"));
861   - m.put("lineCode",rs.getString("xl_bm"));
862   - m.put("lineName", rs.getString("xl_name"));
863   - m.put("showDate", rs.getString("show_date"));
864   - return m;
865   - }
866   - });
867   - return list;
868   - }
869   -
870   - /*
871   - * 车辆数据接口开始
872   - */
873   -
874   - @GET
875   - @Path("/car/all")
876   - public List<Map<String, Object>> findCar() {
877   - String carStr= GetHttpInterface.getHttpInterface("http://58.247.254.118:8076/cars/getAllCarsInterface");
878   - //车辆库资料资料
879   - List<Map<String, Object>> clkList=(List<Map<String, Object>>) JSONObject.parse(carStr);
880   - //调度系统车辆资料
881   - String carSql="select equipment_code, inside_code,supplier_name from bsth_c_cars";
882   - List<Map<String, Object>> ddkList=jdbcTemplate.query(carSql,
883   - new RowMapper<Map<String, Object>>(){
884   - @Override
885   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
886   - Map<String, Object> m=new HashMap<String,Object>();
887   - m.put("equipment_code", rs.getString("equipment_code"));
888   - m.put("insideCode", rs.getString("inside_code"));
889   - m.put("supplier_name",rs.getString("supplier_name"));
890   - return m;
891   - }
892   - });
893   - for (int i = 0; i < clkList.size(); i++) {
894   - Map<String, Object> m1=clkList.get(i);
895   - String carCode=m1.get("car_code").toString();
896   - m1.put("state_name", getState(m1.get("car_state")==null?"":m1.get("car_state").toString()));
897   - for (int j = 0; j < ddkList.size(); j++) {
898   - Map<String, Object> m2=ddkList.get(j);
899   - String insideCode=m2.get("insideCode").toString();
900   - if(carCode.equals(insideCode)){
901   - m1.put("equipment_code", m2.get("equipment_code"));
902   - m1.put("supplier_name", m2.get("supplier_name"));
903   - }
904   -
905   - }
906   - }
907   - return clkList;
908   - }
909   -
910   -
911   - @GET
912   - @Path("/car/company/{companyId}")
913   - public List<Map<String, Object>> findCarByCompany(@PathParam("companyId") String companyId) {
914   - String carStr= GetHttpInterface.
915   - getHttpInterface("http://58.247.254.118:8076/cars/getAllCarsInterface?company="+companyId);
916   - //车辆库资料资料
917   - List<Map<String, Object>> clkList=(List<Map<String, Object>>) JSONObject.parse(carStr);
918   - //调度系统车辆资料
919   - String carSql="select equipment_code, inside_code,supplier_name from bsth_c_cars where business_code='"+companyId+"'";
920   - List<Map<String, Object>> ddkList=jdbcTemplate.query(carSql,
921   - new RowMapper<Map<String, Object>>(){
922   - @Override
923   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
924   - Map<String, Object> m=new HashMap<String,Object>();
925   - m.put("equipment_code", rs.getString("equipment_code"));
926   - m.put("insideCode", rs.getString("inside_code"));
927   - m.put("supplier_name",rs.getString("supplier_name"));
928   - return m;
929   - }
930   - });
931   - for (int i = 0; i < clkList.size(); i++) {
932   - Map<String, Object> m1=clkList.get(i);
933   - String carCode=m1.get("car_code").toString();
934   - m1.put("state_name", getState(m1.get("car_state")==null?"":m1.get("car_state").toString()));
935   - for (int j = 0; j < ddkList.size(); j++) {
936   - Map<String, Object> m2=ddkList.get(j);
937   - String insideCode=m2.get("insideCode").toString();
938   - if(carCode.equals(insideCode)){
939   - m1.put("equipment_code", m2.get("equipment_code"));
940   - m1.put("supplier_name", m2.get("supplier_name"));
941   - }
942   -
943   - }
944   - }
945   - return clkList;
946   - }
947   -
948   - @GET
949   - @Path("/car/code/{carCode}")
950   - public List<Map<String, Object>> findCarByCode(@PathParam("carCode") String carCode) {
951   - String carStr= GetHttpInterface.
952   - getHttpInterface("http://58.247.254.118:8076/cars/getAllCarsInterface?car_code="+carCode);
953   - //车辆库资料资料
954   - List<Map<String, Object>> clkList=(List<Map<String, Object>>) JSONObject.parse(carStr);
955   - //调度系统车辆资料
956   - String carSql="select equipment_code, inside_code,supplier_name from bsth_c_cars where inside_code='"+carCode+"'";
957   - List<Map<String, Object>> ddkList=jdbcTemplate.query(carSql,
958   - new RowMapper<Map<String, Object>>(){
959   - @Override
960   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
961   - Map<String, Object> m=new HashMap<String,Object>();
962   - m.put("equipment_code", rs.getString("equipment_code"));
963   - m.put("insideCode", rs.getString("inside_code"));
964   - m.put("supplier_name",rs.getString("supplier_name"));
965   - return m;
966   - }
967   - });
968   -
969   - for (int i = 0; i < clkList.size(); i++) {
970   - Map<String, Object> m1=clkList.get(i);
971   - String code=m1.get("car_code").toString().trim();
972   - m1.put("state_name", getState(m1.get("car_state")==null?"":m1.get("car_state").toString()));
973   - for (int j = 0; j < ddkList.size(); j++) {
974   - Map<String, Object> m2=ddkList.get(j);
975   - String insideCode=m2.get("insideCode").toString().trim();
976   - if(code.equals(insideCode)){
977   - m1.put("equipment_code", m2.get("equipment_code"));
978   - m1.put("supplier_name", m2.get("supplier_name"));
979   - }
980   -
981   - }
982   - }
983   - return clkList;
984   - }
985   - /*
986   - * 车辆数据接口结束
987   - */
988   -
989   - /*
990   - * 事故数据接口开始
991   - */
992   - @GET
993   - @Path("/accident/startTime/{startTime}/endTime/{endTime}")
994   - public List<Map<String, Object>> findAccident(@PathParam("startTime") String startTime,
995   - @PathParam("endTime") String endTime) {
996   - String accidentAll= GetHttpInterface.getHttpInterface("http://180.168.57.114:9019/pdsafe/LineSms/getAccidentSubmitAll.do?"
997   - + "submitDateBegin="+startTime+"&submitDateEnd="+endTime);
998   - List<Map<String, Object>> list=(List<Map<String, Object>>) JSONObject.parse(accidentAll);
999   - return list;
1000   - }
1001   -
1002   -
1003   - /*
1004   - * 事故数据接口结束
1005   - */
1006   -
1007   - /*
1008   - *安全驾驶接口开始
1009   - */
1010   - @GET
1011   - @Path("/safedriving/starDate/{starDate}/endDate/{endDate}")
1012   - public List<Map<String, Object>> findSafedriving(@PathParam("starDate") String starDate,
1013   - @PathParam("endDate") String endDate) {
1014   - String accidentAll= GetHttpInterface.getHttpInterface("http://211.95.61.66:9006/safedriving/safedrivingInterface?StarTime="+starDate+"&EndTime="+endDate);
1015   - List<Map<String, Object>> list=(List<Map<String, Object>>) JSONObject.parse(accidentAll);
1016   - return list;
1017   - }
1018   - @GET
1019   - @Path("/safedriving/starDate/{starDate}/endDate/{endDate}/line/{line}")
1020   - public List<Map<String, Object>> findSafedrivingByLine(@PathParam("starDate") String starDate,
1021   - @PathParam("endDate") String endDate,@PathParam("line") String line) {
1022   - String accidentAll= GetHttpInterface.getHttpInterface("http://211.95.61.66:9006/safedriving/safedrivingInterface?StarTime="+starDate+"&EndTime="+endDate
1023   - +"&LineId="+line);
1024   - List<Map<String, Object>> list=(List<Map<String, Object>>) JSONObject.parse(accidentAll);
1025   - return list;
1026   - }
1027   - /*
1028   - *安全驾驶接口结束
1029   - */
1030   -
1031   -
1032   - /**
1033   - * 闵行线路班次里程
1034   - *
1035   - *
1036   - *
1037   - */
1038   -
1039   - @GET
1040   - @Path("/findByAll/starDate/{starDate}/endDate/{endDate}/line/{line}")
1041   - public List<Map<String, Object>> findMinhang(@PathParam("starDate") String starDate,
1042   - @PathParam("endDate") String endDate,@PathParam("line") String line) {
1043   - String sql="select xl,xl_name,date,jhszfcs,sjszfczds,jhbc,sjbc,jhcc,sjcc,"
1044   - + " jhyylc,sjyylc,jhkslc,sjkslc,jhssgfbcs,sjgfbcs,jhssdgbcs,"
1045   - + " sjdgbcs from bsth_c_calc_count "
1046   - + " where date>='"+starDate+"' and date<= '"+endDate+"'";
1047   - if(!line.equals("all")){
1048   - sql +=" and xl='"+line+"'";
1049   - }
1050   -
1051   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
1052   - new RowMapper<Map<String, Object>>(){
1053   - @Override
1054   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
1055   - Map<String, Object> m=new HashMap<String,Object>();
1056   - m.put("lineCode",rs.getString("xl"));
1057   - m.put("lineName", rs.getString("xl_name"));
1058   - m.put("date", rs.getString("date"));
1059   - m.put("jhszfcs", rs.getString("jhszfcs"));
1060   - m.put("sjszfczds", rs.getString("sjszfczds"));
1061   - m.put("jhbc", rs.getString("jhbc"));
1062   - m.put("sjbc", rs.getString("sjbc"));
1063   - m.put("jhcc", rs.getString("jhcc"));
1064   - m.put("sjcc", rs.getString("sjcc"));
1065   - m.put("jhyylc", rs.getString("jhyylc"));
1066   - m.put("sjyylc", rs.getString("sjyylc"));
1067   - m.put("jhkslc", rs.getString("jhkslc"));
1068   - m.put("sjkslc", rs.getString("sjkslc"));
1069   - m.put("jhgfbcs", rs.getString("jhssgfbcs"));
1070   - m.put("sjgfbcs", rs.getString("sjgfbcs"));
1071   - m.put("jhdgbcs", rs.getString("jhssdgbcs"));
1072   - m.put("sjdgbcs", rs.getString("sjdgbcs"));
1073   - return m;
1074   - }
1075   - });
1076   - return list;
1077   - }
1078   -
1079   - /**
1080   - * 赵冲需要的数据接口
1081   - *
1082   - */
1083   - @GET
1084   - @Path("/findByCompany/{company}/date/{date}")
1085   - public List<Map<String, Object>> findByCompany(@PathParam("company") String company,
1086   - @PathParam("date") String date) {
1087   - String sql="select t.company as gs_code,t.date,SUM(t.jhcczgf) as jhccs ,SUM(t.sjcczgf) as ccs,AVG(ccl) as ccl"
1088   - + " ,SUM(t.sjzgl*1000)/1000 as sum_mileage ,SUM(jcgl*1000)/1000 as airpor_mileage "
1089   - + " from (select a.line_code,b.date,a.company,b.jhcczgf,b.sjcczgf,"
1090   - + " round(if(ifnull(b.sjcczgf/b.jhcczgf,0)>1,1,ifnull(b.sjcczgf/b.jhcczgf,0)),3) as ccl,c.sjzgl ,"
1091   - + " ifnull(d.sjzgl,0) as jcgl from bsth_c_line a LEFT JOIN "
1092   - + " (SELECT * from bsth_c_calc_sheet where date='"+date+"') b on a.line_code=b.xl"
1093   - + " left join (select * from bsth_c_calc_count where date='"+date+"') c on a.line_code=c.xl "
1094   - + " left join (select * from bsth_c_calc_count where date='"+date+"' "
1095   - + " and xl_name like '%机场%') d on a.line_code=d.xl "
1096   - + " where a.nature in ('yxl','cgxl','gjxl','csbs','cctxl')) t "
1097   - + " where t.date is not null ";
1098   - if(!company.equals("all")){
1099   - sql +=" and t.company='"+company+"'";
1100   - }
1101   - sql +=" group by t.company,t.date";
1102   -
1103   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
1104   - new RowMapper<Map<String, Object>>(){
1105   - @Override
1106   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
1107   - Map<String, Object> m=new HashMap<String,Object>();
1108   - m.put("gs_name", getGs(rs.getString("gs_code")));
1109   - m.put("gs_code",rs.getString("gs_code"));
1110   - m.put("date", rs.getString("date"));
1111   - m.put("jhccs", rs.getString("jhccs"));
1112   - m.put("ccs", rs.getString("ccs"));
1113   - m.put("ccl", rs.getString("ccl"));
1114   - m.put("sum_mileage", rs.getString("sum_mileage"));
1115   - m.put("airpor_mileage", rs.getString("airpor_mileage"));
1116   - return m;
1117   - }
1118   - });
1119   - return list;
1120   - }
1121   - @GET
1122   - @Path("/findTarget/gs/{gs}/fgs/{fgs}/date/{date}")
1123   - public List<Map<String, Object>> findTarget(@PathParam("gs") String gs,@PathParam("fgs") String fgs,
1124   - @PathParam("date") String date) {
1125   - SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
1126   - String d=sdf.format(new Date());
1127   - String sql="";
1128   - if(gs.equals("all")){
1129   - sql ="select x.gsdm,'' as fgsdm,x.smb_zdl,x.zgf_ccl,y.yylc_zxl,y.szfc_zdl,y.bc_zxl from ("
1130   - + " select b.gsdm,round(avg(if(ifnull(b.sjcczgf/b.jhcczgf,0)>1,1,ifnull(b.sjcczgf/b.jhcczgf,0))),3)* 100 as zgf_ccl,"
1131   - + " round(avg(ifnull(b.smbfczdl,0)),3) as smb_zdl from "
1132   - + " bsth_c_calc_sheet b where b.date like '%"+date+"%' and b.date<'"+d+"' "
1133   - + " and b.xl in(select a.line_code from bsth_c_line a where "
1134   - + " a.nature in ('yxl','cgxl','gjxl','csbs','cctxl') ) group by b.gsdm ) x "
1135   - + " left join (select c.gsdm,round(avg(if(CONVERT(c.yylczxl,DECIMAL(9,2))>100,100,c.yylczxl)),3) as yylc_zxl,"
1136   - + " round(avg(if(CONVERT(c.szfczdl,DECIMAL(9,2))>100,100,c.szfczdl)),3) as szfc_zdl,"
1137   - + " round(avg(if(CONVERT(c.bczxl,DECIMAL(9,2))>100,100,c.bczxl)),3) as bc_zxl "
1138   - + " from bsth_c_calc_count c where c.date like '%"+date+"%' and c.date<'"+d+"' and "
1139   - + " c.xl in(select a.line_code from bsth_c_line a where a.nature in ('yxl','cgxl','gjxl','csbs','cctxl') ) "
1140   - + " group by c.gsdm ) y on x.gsdm=y.gsdm where 1=1 ";
1141   -
1142   - }else{
1143   - sql ="select x.gsdm,x.fgsdm,x.smb_zdl,x.zgf_ccl,y.yylc_zxl,y.szfc_zdl,y.bc_zxl from ("
1144   - + " select b.gsdm,b.fgsdm,round(avg(if(ifnull(b.sjcczgf/b.jhcczgf,0)>1,1,ifnull(b.sjcczgf/b.jhcczgf,0))),3) * 100 as zgf_ccl,"
1145   - + " round(avg(ifnull(b.smbfczdl,0)),3) as smb_zdl from "
1146   - + " bsth_c_calc_sheet b where b.date like '%"+date+"%' and b.date<'"+d+"' "
1147   - + " and b.xl in(select a.line_code from bsth_c_line a where "
1148   - + " a.nature in ('yxl','cgxl','gjxl','csbs','cctxl') ) group by b.gsdm,b.fgsdm ) x "
1149   - + " left join (select c.gsdm,c.fgsdm,round(avg(if(CONVERT(c.yylczxl,DECIMAL(9,2))>100,100,c.yylczxl)),3) as yylc_zxl,"
1150   - + " round(avg(if(CONVERT(c.szfczdl,DECIMAL(9,2))>100,100,c.szfczdl)),3) as szfc_zdl,"
1151   - + " round(avg(if(CONVERT(c.bczxl,DECIMAL(9,2))>100,100,c.bczxl)),3) as bc_zxl "
1152   - + " from bsth_c_calc_count c where c.date like '%"+date+"%' and c.date <'"+d+"' and "
1153   - + " c.xl in(select a.line_code from bsth_c_line a where a.nature in ('yxl','cgxl','gjxl','csbs','cctxl') ) "
1154   - + " group by c.gsdm,c.fgsdm ) y on x.gsdm=y.gsdm and x.fgsdm=y.fgsdm where 1=1 ";
1155   -
1156   - }
1157   - if(!gs.equals("all")){
1158   - sql += " and x.gsdm='"+gs+"'";
1159   - }
1160   -
1161   - if(!fgs.equals("all")){
1162   - sql += " and x.fgsdm='"+fgs+"'";
1163   - }
1164   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
1165   - new RowMapper<Map<String, Object>>(){
1166   - @Override
1167   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
1168   - Map<String, Object> m=new HashMap<String,Object>();
1169   - m.put("gsdm", getGs(rs.getString("gsdm")));
1170   - m.put("fgsdm",rs.getString("fgsdm"));
1171   - m.put("smb_zdl", rs.getString("smb_zdl"));
1172   - m.put("zgf_ccl", rs.getString("zgf_ccl"));
1173   - m.put("yylc_zxl", rs.getString("yylc_zxl"));
1174   - m.put("szfc_zdl", rs.getString("szfc_zdl"));
1175   - m.put("bc_zxl", rs.getString("bc_zxl"));
1176   - return m;
1177   - }
1178   - });
1179   - return list;
1180   - }
1181   -
1182   -
1183   - /**
1184   - *公司内部使用数据
1185   - *
1186   - *班次里程基础数据接口
1187   - */
1188   - @GET
1189   - @Path("/basicData/starDate/{starDate}/endDate/{endDate}/line/{line}")
1190   - public List<Map<String, Object>> basicData(@PathParam("starDate") String starDate,
1191   - @PathParam("endDate") String endDate,@PathParam("line") String line) {
1192   - String sql="select gsdm,fgsdm,xl,xl_name,date,jhbc,sjbc,"
1193   - + " jhyylc,sjyylc,jhkslc,sjkslc,jhgfbcsz,sjgfbcs,jhdgbcsz,"
1194   - + " sjdgbcs from bsth_c_calc_count "
1195   - + " where date>='"+starDate+"' and date<= '"+endDate+"'";
1196   - if(!line.equals("all")){
1197   - sql +=" and xl='"+line+"'";
1198   - }
1199   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
1200   - new RowMapper<Map<String, Object>>(){
1201   - @Override
1202   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
1203   - Map<String, Object> m=new HashMap<String,Object>();
1204   - m.put("gsdm",rs.getString("gsdm"));
1205   - m.put("fgsdm",rs.getString("fgsdm"));
1206   - m.put("lineCode",rs.getString("xl"));
1207   - m.put("lineName", rs.getString("xl_name"));
1208   - m.put("date", rs.getString("date"));
1209   - m.put("jhbc", rs.getString("jhbc"));
1210   - m.put("sjbc", rs.getString("sjbc"));
1211   - m.put("jhyylc", rs.getString("jhyylc"));
1212   - m.put("sjyylc", rs.getString("sjyylc"));
1213   - m.put("jhkslc", rs.getString("jhkslc"));
1214   - m.put("sjkslc", rs.getString("sjkslc"));
1215   - m.put("jhgfbcs", rs.getString("jhgfbcsz"));
1216   - m.put("sjgfbcs", rs.getString("sjgfbcs"));
1217   - m.put("jhdgbcs", rs.getString("jhdgbcsz"));
1218   - m.put("sjdgbcs", rs.getString("sjdgbcs"));
1219   - return m;
1220   - }
1221   - });
1222   - return list;
1223   - }
1224   -
1225   - @GET
1226   - @Path("/targetData/starDate/{starDate}/endDate/{endDate}/line/{line}")
1227   - public List<Map<String, Object>> targetData(@PathParam("starDate") String starDate,
1228   - @PathParam("endDate") String endDate,@PathParam("line") String line) {
1229   - String sql="select gsdm,fgsdm,date,xl,xl_name,szfczdl,smbfczdl,"
1230   - + " round(if(ifnull(sjcczgf/jhcczgf,0)>1,1,ifnull(sjcczgf/jhcczgf,0)),3) * 100 as zgfccl , "
1231   - + " round(if(ifnull(sjcc/jhcc,0)>1,1,ifnull(sjcc/jhcc,0)),3) * 100 as ccl from bsth_c_calc_sheet "
1232   - + " where date>='"+starDate+"' and date<= '"+endDate+"'";
1233   - if(!line.equals("all")){
1234   - sql +=" and xl='"+line+"'";
1235   - }
1236   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
1237   - new RowMapper<Map<String, Object>>(){
1238   - @Override
1239   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
1240   - Map<String, Object> m=new HashMap<String,Object>();
1241   - m.put("gsdm",rs.getString("gsdm"));
1242   - m.put("fgsdm",rs.getString("fgsdm"));
1243   - m.put("lineCode",rs.getString("xl"));
1244   - m.put("lineName", rs.getString("xl_name"));
1245   - m.put("date", rs.getString("date"));
1246   - m.put("szfczdl", rs.getString("szfczdl"));
1247   - m.put("smbfczdl", rs.getString("smbfczdl"));
1248   - m.put("zgfccl", rs.getString("zgfccl"));
1249   - m.put("ccl", rs.getString("ccl"));
1250   - return m;
1251   - }
1252   - });
1253   - return list;
1254   - }
1255   -
1256   - @GET
1257   - @Path("/departureTime/starDate/{starDate}/endDate/{endDate}/line/{line}")
1258   - public List<Map<String, Object>> departureTime(@PathParam("starDate") String starDate,
1259   - @PathParam("endDate") String endDate,@PathParam("line") String line) {
1260   - String sql="select xl,xl_name,date,jhbc,bczxl,jhbcz,sjbc,jhcc,sjcc,ccl,jhccz,"
1261   - + " jhyylc,sjyylc,jhyylcz,jhkslc,sjkslc,jhkslcz,"
1262   - + " jhssgfbcs,sjgfbcs,jhgfbcsz,jhssdgbcs,sjdgbcs,jhdgbcsz,"
1263   - + " jhsmbcs,sjsmbczds,smbczdl,jhsmbcsz,sjsmbczdsz,smbczdlz,"
1264   - + " jhszfcs,sjszfczds,szfczdl,"
1265   - + " create_date from bsth_c_calc_count "
1266   - + " where date>='"+starDate+"' and date<= '"+endDate+"'";
1267   - if(!line.equals("all")){
1268   - sql +=" and xl='"+line+"'";
1269   - }
1270   -
1271   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
1272   - new RowMapper<Map<String, Object>>(){
1273   - @Override
1274   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
1275   - Map<String, Object> m=new HashMap<String,Object>();
1276   - m.put("lineCode",rs.getString("xl"));
1277   - m.put("lineName", rs.getString("xl_name"));
1278   - m.put("date", rs.getString("date"));
1279   -
1280   - m.put("jhbc", rs.getString("jhbc"));
1281   - m.put("sjbc", rs.getString("sjbc"));
1282   - m.put("bczxl", rs.getString("bczxl"));
1283   - m.put("jhbcz", rs.getString("jhbcz"));
1284   -
1285   - m.put("jhcc", rs.getString("jhcc"));
1286   - m.put("sjcc", rs.getString("sjcc"));
1287   - m.put("ccl", rs.getString("ccl"));
1288   - m.put("jhccz", rs.getString("jhccz"));
1289   -
1290   - m.put("jhyylc", rs.getString("jhyylc"));
1291   - m.put("sjyylc", rs.getString("sjyylc"));
1292   - m.put("jhyylcz", rs.getString("jhyylcz"));
1293   - m.put("jhkslc", rs.getString("jhkslc"));
1294   - m.put("sjkslc", rs.getString("sjkslc"));
1295   - m.put("jhkslcz", rs.getString("jhkslcz"));
1296   -
1297   - m.put("jhgfbcs", rs.getString("jhssgfbcs"));
1298   - m.put("sjgfbcs", rs.getString("sjgfbcs"));
1299   - m.put("jhgfbcsz", rs.getString("jhgfbcsz"));
1300   - m.put("jhdgbcs", rs.getString("jhssdgbcs"));
1301   - m.put("sjdgbcs", rs.getString("sjdgbcs"));
1302   - m.put("jhdgbcsz", rs.getString("jhdgbcsz"));
1303   -
1304   - m.put("jhsmbcs", rs.getString("jhsmbcs"));
1305   - m.put("sjsmbczds", rs.getString("sjsmbczds"));
1306   - m.put("smbczdl", rs.getString("smbczdl"));
1307   - m.put("jhsmbcsz", rs.getString("jhsmbcsz"));
1308   - m.put("sjsmbczdsz", rs.getString("sjsmbczdsz"));
1309   - m.put("smbczdlz", rs.getString("smbczdlz"));
1310   -
1311   - m.put("jhszfcs", rs.getString("jhszfcs"));
1312   - m.put("sjszfczds", rs.getString("sjszfczds"));
1313   - m.put("szfczdl", rs.getString("szfczdl"));
1314   -
1315   - Date date = new Date();
1316   - date.setTime(rs.getTimestamp("create_date").getTime());
1317   - m.put("createDate", sdf.format(date));
1318   - return m;
1319   - }
1320   - });
1321   - return list;
1322   - }
1323   -
1324   - /**
1325   - * 给安全系统的接口,实际排班中的肇事烂班班次(用作事故登记)
1326   - * @param starDate
1327   - * @param endDate
1328   - * @return
1329   - * @throws ParseException
1330   - */
1331   - @GET
1332   - @Path("/getScheduleAccident/startDate/{startDate}/endDate/{endDate}")
1333   - public List<Map<String, Object>> getScheduleAccident(@PathParam("startDate") String startDate,
1334   - @PathParam("endDate") String endDate) throws ParseException {
1335   - String sql="select gs_bm,fgs_bm,real_exec_date,fcsj,fcsj_actual,xl_name,j_gh,j_name,cl_zbh,car_plate,remarks "
1336   - + " from bsth_c_s_sp_info_real r left join bsth_c_cars c on r.cl_zbh = c.inside_code "
1337   - + " where schedule_date_str >= ? and schedule_date_str <= ? "
1338   - + " and ((adjust_exps like '%肇事%' and status = '-1') "
1339   - + " or (schedule_date_str < '2021-09-13' and (remarks = '肇事' "
1340   - + " or remarks like '%;肇事%' or remarks like '%肇事;%' or remarks like '%肇事,%')) "
1341   - + " or (schedule_date_str >= '2021-09-13' and (remarks like '%<肇事>%' "
1342   - + " or remarks like '%&lt;肇事&gt;%'))) "
1343   - + " order by real_exec_date, schedule_date_str, fcsj";
1344   -
1345   - List<Map<String, Object>> list=(List<Map<String, Object>>) jdbcTemplate.query(sql,
1346   - new Object[] {startDate, endDate},
1347   - new RowMapper<Map<String, Object>>(){
1348   - @Override
1349   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
1350   - Map<String, Object> m=new HashMap<String,Object>();
1351   - m.put("gs_bm",rs.getString("gs_bm"));
1352   - m.put("fgs_bm",rs.getString("fgs_bm"));
1353   - m.put("real_exec_date",rs.getString("real_exec_date"));
1354   - m.put("fcsj", rs.getString("fcsj"));
1355   - m.put("fcsj_actual", rs.getString("fcsj_actual"));
1356   - m.put("xl_name", rs.getString("xl_name"));
1357   - m.put("j_gh", rs.getString("j_gh"));
1358   - m.put("j_name", rs.getString("j_name"));
1359   - m.put("cl_zbh", rs.getString("cl_zbh"));
1360   - m.put("car_plate", rs.getString("car_plate"));
1361   - m.put("remarks", rs.getString("remarks"));
1362   - return m;
1363   - }
1364   - });
1365   -
1366   - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
1367   - Date d1 = sdf.parse(startDate);
1368   - Date d2 = sdf.parse(endDate);
1369   - while(d1.getTime() <= d2.getTime()){
1370   - String rq = sdf.format(d1);
1371   - List<DestroySituation> destroys = destroySituationRepository.findByDateAndReason(rq, "肇事");
1372   - for(DestroySituation ds : destroys){
1373   - ScheduleRealInfo s = scheduleRealInfoRepository.findOne(Long.parseLong(ds.getIdsStr().split(",")[0]));
1374   - Map<String, Object> m = new HashMap<String, Object>();
1375   - m.put("gs_bm", ds.getGsBm());
1376   - m.put("fgs_bm", ds.getFgsBm());
1377   - m.put("real_exec_date", rq);
1378   - m.put("fcsj", s==null?"00:00":(s.getFcsj()!=null&&s.getFcsj().trim().length()>0?s.getFcsj():""));
1379   - m.put("fcsj_actual", s==null?"00:00":(s.getFcsjActual()!=null&&s.getFcsjActual().trim().length()>0?s.getFcsjActual():""));
1380   - m.put("xl_name", ds.getLineName());
1381   - m.put("j_gh", ds.getjGh());
1382   - m.put("j_name", s==null?"":(s.getjName()!=null&&s.getjName().trim().length()>0?s.getjName():""));
1383   - m.put("cl_zbh", ds.getNbbm());
1384   - m.put("car_plate", CarBufferData.findOne(ds.getNbbm()).getCarPlate());
1385   - m.put("remarks", (s==null?"":(s.getQdzName()+"->"+s.getZdzName()+";"))+ds.getRemark());
1386   - list.add(m);
1387   - }
1388   -
1389   - d1.setTime(d1.getTime() + 1l*1000*60*60*24);
1390   - }
1391   -
1392   - Collections.sort(list, new Comparator<Map<String, Object>>() {
1393   - @Override
1394   - public int compare(Map<String, Object> c1, Map<String, Object> c2) {
1395   -// int i1 = Integer.valueOf(c1.get("count").toString());
1396   -// int i2 = Integer.valueOf(c2.get("count").toString());
1397   - String str1 = c1.get("real_exec_date").toString() + (c1.get("fcsj").toString().length()>0?c1.get("fcsj").toString():"00:00");
1398   - String str2 = c2.get("real_exec_date").toString() + (c2.get("fcsj").toString().length()>0?c2.get("fcsj").toString():"00:00");
1399   - Long long1 = Long.valueOf(str1.replaceAll(" ", "").replaceAll("-", "").replaceAll(":", ""));
1400   - Long long2 = Long.valueOf(str2.replaceAll(" ", "").replaceAll("-", "").replaceAll(":", ""));
1401   -
1402   - long diff = long1 - long2;
1403   - if (diff > 0) {
1404   - return 1;
1405   - }else if (diff < 0) {
1406   - return -1;
1407   - }
1408   - return 0; //相等为0
1409   - }
1410   - });
1411   -
1412   - return list;
1413   - }
1414   -
1415   - /**
1416   - * 给机务(徐铉、郑鑫)按车辆统计营运公里
1417   - * @param starDate
1418   - * @param endDate
1419   - * @return
1420   - * @throws ParseException
1421   - */
1422   - @GET
1423   - @Path("/mileageByVehicle/startDate/{startDate}/endDate/{endDate}")
1424   - public List<Map<String, Object>> mileageByVehicle(@PathParam("startDate") String starDate,
1425   - @PathParam("endDate") String endDate) throws ParseException {
1426   - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
1427   -
1428   - String yyxlSql="SELECT line_code from bsth_c_line "
1429   - + " where nature in ('yxl','cgxl','gjxl','csbs','cctxl')";
1430   - List<Map<String, Object>> yyxlList=jdbcTemplate.query(yyxlSql,
1431   - new RowMapper<Map<String, Object>>(){
1432   - @Override
1433   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
1434   - Map<String, Object> m=new HashMap<String,Object>();
1435   - m.put("lineCode", rs.getString("line_code"));
1436   - return m;
1437   - }
1438   - });
1439   - Set<String> yyLine = new HashSet<String>();
1440   - for(Map<String, Object> t : yyxlList){
1441   - if(t.get("lineCode") != null){
1442   - yyLine.add(t.get("lineCode").toString());
1443   - }
1444   - }
1445   -
1446   - BigscreenService bigscreenService = new BigscreenService();
1447   - List<ScheduleRealInfo> dataList = scheduleRealInfoRepository.findScheduleByDates(starDate, endDate);
1448   - Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>();
1449   - List<String> keyList = new ArrayList<String>();
1450   -
1451   - for(ScheduleRealInfo s : dataList){
1452   - if(s.getXlBm() != null && yyLine.contains(s.getXlBm())){//营运线路
1453   - String dateStr = s.getScheduleDateStr();
1454   - String gsBm = s.getGsBm();
1455   - String fgsBm = s.getFgsBm();
1456   - String xlName = s.getXlName();
1457   - String cl = s.getClZbh();
1458   - String key = dateStr + "/" + gsBm + "/" + fgsBm + "/" + xlName + "/" + cl;
1459   - if(!(keyMap.containsKey(key))){
1460   - keyMap.put(key, new ArrayList<ScheduleRealInfo>());
1461   - keyList.add(key);
1462   - }
1463   - keyMap.get(key).add(s);
1464   - }
1465   - }
1466   -
1467   - for(String key : keyList){
1468   - List<ScheduleRealInfo> list = keyMap.get(key);
1469   - List<ScheduleRealInfo> listSche = new ArrayList<ScheduleRealInfo>();//全部班次
1470   - List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>();//已执行班次
1471   - for(ScheduleRealInfo s : list){
1472   - listSche.add(s);
1473   - Set<ChildTaskPlan> cts = s.getcTasks();
1474   - if (cts != null && cts.size() > 0) {
1475   - list_s.add(s);
1476   - } else {
1477   - if (s.getZdsjActual() != null && s.getFcsjActual() != null) {
1478   - list_s.add(s);
1479   - }
1480   - }
1481   - }
1482   -
1483   - double sjgl = bigscreenService.culateSjgl(list_s);//实际营运公里(不含临加)
1484   - double sjljgl = bigscreenService.culateLjgl(listSche);//实际临加公里
1485   - double sjyygl = Arith.add(sjgl, sjljgl);//实际营运公里
1486   - double sjjccgl = bigscreenService.culateJccgl(list_s);
1487   - double sjksgl = bigscreenService.culateKsgl(list_s);
1488   - double zksgl = Arith.add(sjjccgl, sjksgl);//实际空驶总公里
1489   -
1490   - Map<String, Object> m = new HashMap<String, Object>();
1491   - String[] split = key.split("/");
1492   - m.put("date", split[0]);
1493   - m.put("companyCode", split[1]);
1494   - m.put("brancheCompanyCode", split[2]);
1495   - m.put("lineName", split[3]);
1496   - m.put("car", split[4]);
1497   - m.put("businessMileage", sjyygl);
1498   - m.put("emptyMileage", zksgl);
1499   - resList.add(m);
1500   - }
1501   -
1502   - return resList;
1503   - }
1504   -
1505   - //全部挂牌线路
1506   - @GET
1507   - @Path("/findLinePlate/all")
1508   - public List<Map<String, Object>> findLinePlate() {
1509   - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
1510   - String gpLineSql = "select * from bsth_c_line_plate";
1511   - List<Map<String, Object>> gpLineList=jdbcTemplate.query(gpLineSql,
1512   - new RowMapper<Map<String, Object>>(){
1513   - @Override
1514   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
1515   - Map<String, Object> m=new HashMap<String,Object>();
1516   - m.put("lineName", rs.getString("line_name"));
1517   - m.put("lineCode", rs.getString("line_code"));
1518   - return m;
1519   - }
1520   - });
1521   -
1522   - for(Map<String, Object> t : gpLineList){
1523   - if(t.get("lineCode") == null || t.get("lineCode").toString().trim().length() == 0){
1524   - t.put("lineCode", "");
1525   - }
1526   - resList.add(t);
1527   - }
1528   - return resList;
1529   - }
1530   -
1531   - //人车班次里程预统计查询
1532   - @GET
1533   - @Path("/findWaybill/startDate/{startDate}/endDate/{endDate}")
1534   - public List<Map<String, Object>> findWaybill(@PathParam("startDate") String startDate,
1535   - @PathParam("endDate") String endDate) {
1536   - String sql = "select * from calc_waybill where rq_str >= ? and rq_str <= ?";
1537   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
1538   - new Object[] {startDate, endDate},
1539   - new RowMapper<Map<String, Object>>(){
1540   - @Override
1541   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
1542   - Map<String, Object> m=new HashMap<String,Object>();
1543   - m.put("gsdm", rs.getString("gsdm"));
1544   - m.put("gsname", rs.getString("gsname"));
1545   - m.put("fgsdm", rs.getString("fgsdm"));
1546   - m.put("fgsname", rs.getString("fgsname"));
1547   - m.put("rqStr", rs.getString("rq_str"));
1548   - m.put("xl", rs.getString("xl"));
1549   - m.put("xlName", rs.getString("xl_name"));
1550   - m.put("cl", rs.getString("cl"));
1551   - m.put("lp", rs.getString("lp"));
1552   - m.put("jGh", rs.getString("j_gh"));
1553   - m.put("jName", rs.getString("j_name"));
1554   - m.put("sGh", rs.getString("s_gh"));
1555   - m.put("sName", rs.getString("s_name"));
1556   - m.put("jhyybc", rs.getInt("jhyybc"));
1557   - m.put("jhyybczgf", rs.getInt("jhyybczgf"));
1558   - m.put("jhyybcwgf", rs.getInt("jhyybcwgf"));
1559   - m.put("jhfyybc", rs.getInt("jhfyybc"));
1560   - m.put("jhyylc", rs.getDouble("jhyylc"));
1561   - m.put("jhfyylc", rs.getDouble("jhfyylc"));
1562   - m.put("sjyybc", rs.getInt("sjyybc"));
1563   - m.put("sjyybczgf", rs.getInt("sjyybczgf"));
1564   - m.put("sjyybcwgf", rs.getInt("sjyybcwgf"));
1565   - m.put("sjfyybc", rs.getInt("sjfyybc"));
1566   - m.put("sjyylc", rs.getDouble("sjyylc"));
1567   - m.put("sjfyylc", rs.getDouble("sjfyylc"));
1568   - m.put("ljbc", rs.getInt("ljbc"));
1569   - m.put("ljbczgf", rs.getInt("ljbczgf"));
1570   - m.put("ljbcwgf", rs.getInt("ljbcwgf"));
1571   - m.put("ljyylc", rs.getDouble("ljyylc"));
1572   - m.put("ljfyylc", rs.getDouble("ljfyylc"));
1573   - m.put("lbbc", rs.getInt("lbbc"));
1574   - m.put("lblc", rs.getDouble("lblc"));
1575   - m.put("lblcLz", rs.getDouble("lblc_lz"));
1576   - m.put("lblcDm", rs.getDouble("lblc_dm"));
1577   - m.put("lblcGz", rs.getDouble("lblc_gz"));
1578   - m.put("lblcJf", rs.getDouble("lblc_jf"));
1579   - m.put("lblcZs", rs.getDouble("lblc_zs"));
1580   - m.put("lblcQr", rs.getDouble("lblc_qr"));
1581   - m.put("lblcQc", rs.getDouble("lblc_qc"));
1582   - m.put("lblcKx", rs.getDouble("lblc_kx"));
1583   - m.put("lblcQh", rs.getDouble("lblc_qh"));
1584   - m.put("lblcYw", rs.getDouble("lblc_yw"));
1585   - m.put("lblcQt", rs.getDouble("lblc_qt"));
1586   - m.put("fzbc", rs.getInt("fzbc"));
1587   - m.put("fzbczgf", rs.getInt("fzbczgf"));
1588   - m.put("fzbcwgf", rs.getInt("fzbcwgf"));
1589   - m.put("dtbc", rs.getInt("dtbc"));
1590   - m.put("dtbczgf", rs.getInt("dtbczgf"));
1591   - m.put("dtbcwgf", rs.getInt("dtbcwgf"));
1592   - return m;
1593   - }
1594   - });
1595   -
1596   - return list;
1597   - }
1598   -
1599   - //人车里程预统计查询(预计給上电科)
1600   - @GET
1601   - @Path("/findKilometre/startDate/{startDate}/endDate/{endDate}")
1602   - public List<Map<String, Object>> findKilometre(@PathParam("startDate") String startDate,
1603   - @PathParam("endDate") String endDate) {
1604   - String sql = "select * from calc_waybill where rq_str >= ? and rq_str <= ?";
1605   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
1606   - new Object[] {startDate, endDate},
1607   - new RowMapper<Map<String, Object>>(){
1608   - @Override
1609   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
1610   - Map<String, Object> m=new HashMap<String,Object>();
1611   - m.put("gsdm", rs.getString("gsdm"));
1612   - m.put("gsname", rs.getString("gsname"));
1613   - m.put("fgsdm", rs.getString("fgsdm"));
1614   - m.put("fgsname", rs.getString("fgsname"));
1615   - m.put("rqStr", rs.getString("rq_str"));
1616   - m.put("xl", rs.getString("xl"));
1617   - m.put("xlName", rs.getString("xl_name"));
1618   - m.put("cl", rs.getString("cl"));
1619   - m.put("lp", rs.getString("lp"));
1620   - m.put("jGh", rs.getString("j_gh"));
1621   - m.put("jName", rs.getString("j_name"));
1622   - m.put("sGh", rs.getString("s_gh"));
1623   - m.put("sName", rs.getString("s_name"));
1624   - m.put("jhyylc", rs.getDouble("jhyylc"));
1625   - m.put("jhfyylc", rs.getDouble("jhfyylc"));
1626   - m.put("sjyylc", rs.getDouble("sjyylc"));
1627   - m.put("sjfyylc", rs.getDouble("sjfyylc"));
1628   - m.put("ljyylc", rs.getDouble("ljyylc"));
1629   - m.put("ljfyylc", rs.getDouble("ljfyylc"));
1630   - return m;
1631   - }
1632   - });
1633   -
1634   - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
1635   - for(Map<String, Object> m : list){
1636   - Map<String, Object> resMap = new HashMap<String, Object>();
1637   - BigDecimal jhyylc = new BigDecimal(m.get("jhyylc")!=null?m.get("jhyylc").toString():"0");
1638   - BigDecimal jhfyylc = new BigDecimal(m.get("jhfyylc")!=null?m.get("jhfyylc").toString():"0");
1639   - BigDecimal sjyylc = new BigDecimal(m.get("sjyylc")!=null?m.get("sjyylc").toString():"0");
1640   - BigDecimal sjfyylc = new BigDecimal(m.get("sjfyylc")!=null?m.get("sjfyylc").toString():"0");
1641   - BigDecimal ljyylc = new BigDecimal(m.get("ljyylc")!=null?m.get("ljyylc").toString():"0");
1642   - BigDecimal ljfyylc = new BigDecimal(m.get("ljfyylc")!=null?m.get("ljfyylc").toString():"0");
1643   - resMap.put("planAll", jhyylc.add(jhfyylc));
1644   - resMap.put("realAll", sjyylc.add(sjfyylc).add(ljyylc).add(ljfyylc));
1645   - resMap.put("planService", jhyylc);
1646   - resMap.put("planNonService", jhfyylc);
1647   - resMap.put("RealService", sjyylc.add(ljyylc));
1648   - resMap.put("RealNonService", sjfyylc.add(ljfyylc));
1649   - resMap.put("companyCode", m.get("gsdm"));
1650   - resMap.put("companyName", m.get("gsname"));
1651   - resMap.put("branchCompanyCode", m.get("fgsdm"));
1652   - resMap.put("branchCompanyName", m.get("fgsname"));
1653   - resMap.put("date", m.get("rqStr"));
1654   - resMap.put("lineCode", m.get("xl"));
1655   - resMap.put("lineName", m.get("xlName"));
1656   - resMap.put("car", m.get("cl"));
1657   - resMap.put("guideboard", m.get("lp"));
1658   - resMap.put("driverCode", m.get("jGh"));
1659   - resMap.put("driverName", m.get("jName"));
1660   - resMap.put("conductorCode", m.get("sGh"));
1661   - resMap.put("conductorName", m.get("sName"));
1662   - resList.add(resMap);
1663   - }
1664   -
1665   - return resList;
1666   - }
1667   -
1668   - //单日每车油耗电耗
1669   - @GET
1670   - @Path("/findCarEnergySupplement/{date}")
1671   - public Map<String, Object> findWaybill(@PathParam("date") String date) {
1672   - Map<String, Object> resMap = new HashMap<String, Object>();
1673   -
1674   - date = date + " 00:00:00";
1675   -
1676   - String ylbSql = "select nbbm, sum(yh) yh from bsth_c_ylb where rq = str_to_date(?, '%Y-%m-%d') group by nbbm";
1677   - List<Map<String, Object>> ylbList=jdbcTemplate.query(ylbSql,
1678   - new Object[] {date},
1679   - new RowMapper<Map<String, Object>>(){
1680   - @Override
1681   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
1682   - Map<String, Object> m=new HashMap<String,Object>();
1683   - m.put("car", rs.getString("nbbm"));
1684   - m.put("liters", new BigDecimal(rs.getDouble("yh")).setScale(2, RoundingMode.HALF_UP));
1685   - return m;
1686   - }
1687   - });
1688   -
1689   - String dlbSql = "select nbbm, sum(hd) hd from bsth_c_dlb where rq = str_to_date(?, '%Y-%m-%d') group by nbbm";
1690   - List<Map<String, Object>> dlbList=jdbcTemplate.query(dlbSql,
1691   - new Object[] {date},
1692   - new RowMapper<Map<String, Object>>(){
1693   - @Override
1694   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
1695   - Map<String, Object> m=new HashMap<String,Object>();
1696   - m.put("car", rs.getString("nbbm"));
1697   - m.put("degrees", new BigDecimal(rs.getDouble("hd")).setScale(2, RoundingMode.HALF_UP));
1698   - return m;
1699   - }
1700   - });
1701   -
1702   - resMap.put("oilList", ylbList);
1703   - resMap.put("electricList", dlbList);
1704   - return resMap;
1705   - }
1706   -
1707   - /**
1708   - * 给安全系统,按驾驶员统计公里
1709   - * @param starDate
1710   - * @param endDate
1711   - * @return
1712   - * @throws ParseException
1713   - */
1714   - @GET
1715   - @Path("/mileageByDriver/startDate/{startDate}/endDate/{endDate}")
1716   - public List<Map<String, Object>> mileageByDriver(@PathParam("startDate") String starDate,
1717   - @PathParam("endDate") String endDate) throws ParseException {
1718   - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
1719   - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
1720   - Date date1 = sdf.parse(starDate);
1721   - Date date2 = sdf.parse(endDate);
1722   -
1723   - String yyxlSql="SELECT gsdm, gsname, fgsdm, fgsname, rq_str, xl_name, j_gh, j_name,"
1724   - + " sjyylc, sjfyylc, ljyylc, ljfyylc"
1725   - + " from calc_waybill"
1726   - + " where rq between ? and ?";
1727   - List<Map<String, Object>> calcList=jdbcTemplate.query(yyxlSql, new Object[]{date1, date2},
1728   - new RowMapper<Map<String, Object>>(){
1729   - @Override
1730   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
1731   - Map<String, Object> m=new HashMap<String,Object>();
1732   - m.put("gsdm", rs.getString("gsdm"));
1733   - m.put("gsname", rs.getString("gsname"));
1734   - m.put("fgsdm", rs.getString("fgsdm"));
1735   - m.put("fgsname", rs.getString("fgsname"));
1736   - m.put("rq_str", rs.getString("rq_str"));
1737   - m.put("xl_name", rs.getString("xl_name"));
1738   - m.put("j_gh", rs.getString("j_gh"));
1739   - m.put("j_name", rs.getString("j_name"));
1740   - m.put("sjyylc", rs.getString("sjyylc"));
1741   - m.put("sjfyylc", rs.getString("sjfyylc"));
1742   - m.put("ljyylc", rs.getString("ljyylc"));
1743   - m.put("ljfyylc", rs.getString("ljfyylc"));
1744   - return m;
1745   - }
1746   - });
1747   -
1748   - Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>();
1749   - for(Map<String, Object> m : calcList){
1750   - String rqStr = m.get("rq_str").toString();
1751   - String gsdm = m.get("gsdm").toString();
1752   - String fgsdm = m.get("fgsdm").toString();
1753   - String gh = m.get("j_gh").toString();
1754   - String name = m.get("j_name").toString();
1755   - String key = rqStr + "/" + gsdm + "/" + fgsdm + "/" + gh + "/" + name;
1756   - if(!keyMap.containsKey(key)){
1757   - Map<String, Object> temp = new HashMap<String, Object>();
1758   - temp.put("date", rqStr);
1759   - temp.put("company", gsdm);
1760   - temp.put("brancheCompany", fgsdm);
1761   - temp.put("gh", gh);
1762   - temp.put("name", name);
1763   - temp.put("mileage", "0");
1764   - keyMap.put(key, temp);
1765   - }
1766   - Map<String, Object> temp = keyMap.get(key);
1767   - BigDecimal mileage = new BigDecimal(temp.get("mileage").toString());
1768   - BigDecimal sjyylc = new BigDecimal(m.get("sjyylc").toString());
1769   - BigDecimal sjfyylc = new BigDecimal(m.get("sjfyylc").toString());
1770   - BigDecimal ljyylc = new BigDecimal(m.get("ljyylc").toString());
1771   - BigDecimal ljfyylc = new BigDecimal(m.get("ljfyylc").toString());
1772   - temp.put("mileage", mileage.add(sjyylc).add(sjfyylc).add(ljyylc).add(ljfyylc));
1773   - }
1774   -
1775   - for(String key : keyMap.keySet()){
1776   - Map<String, Object> m = keyMap.get(key);
1777   - resList.add(m);
1778   - }
1779   -
1780   - return resList;
1781   - }
1782   -
1783   - /**
1784   - * 车辆的班次里程与油电耗(给郑鑫)
1785   - * @param date
1786   - * @return
1787   - * @throws ParseException
1788   - */
1789   - @GET
1790   - @Path("/scheduleAndMileage/date/{date}")
1791   - public List<Map<String, Object>> scheduleAndMileage(@PathParam("date") String date) throws ParseException {
1792   - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
1793   - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
1794   - Date rq = sdf.parse(date);
1795   -
1796   - String xlSql="SELECT line_code, name, nature, ifnull(warrant_car, '') warrant_car"
1797   - + " from bsth_c_line where name is not null and name != ''";
1798   - List<Map<String, Object>> xlList=jdbcTemplate.query(xlSql,
1799   - new RowMapper<Map<String, Object>>(){
1800   - @Override
1801   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
1802   - Map<String, Object> m=new HashMap<String,Object>();
1803   - m.put("lineCode", rs.getString("line_code"));
1804   - m.put("lineName", rs.getString("name"));
1805   - m.put("nature", rs.getString("nature"));
1806   - m.put("warrantCar", rs.getString("warrant_car"));
1807   - return m;
1808   - }
1809   - });
1810   - Set<String> yyLine = new HashSet<String>();
1811   - Map<String, Object> allLineMap = new HashMap<String, Object>();
1812   - Map<String, String> warrantCarMap = new HashMap<String, String>();
1813   - for(Map<String, Object> t : xlList){
1814   - if(t.get("lineCode") != null){
1815   - allLineMap.put(t.get("lineCode").toString(), t.get("lineName").toString());
1816   - warrantCarMap.put(t.get("lineCode").toString(), t.get("warrantCar").toString());
1817   - String nature = t.get("nature")!=null?t.get("nature").toString():"";
1818   - if("yxl".equals(nature) || "cgxl".equals(nature) || "gjxl".equals(nature)
1819   - || "csbs".equals(nature) || "cctxl".equals(nature)){
1820   - yyLine.add(t.get("lineCode").toString());
1821   - }
1822   - }
1823   - }
1824   -
1825   - String sql="SELECT gsdm, gsname, fgsdm, fgsname, rq_str, xl, xl_name, cl,"
1826   - + " jhyybc, jhfyybc, sjyybc, sjfyybc, ljbc, jhyylc, jhfyylc,"
1827   - + " sjyylc, sjfyylc, ljyylc, ljfyylc"
1828   - + " from calc_waybill"
1829   - + " where rq = ? ";
1830   - List<Map<String, Object>> calcList=jdbcTemplate.query(sql, new Object[]{rq},
1831   - new RowMapper<Map<String, Object>>(){
1832   - @Override
1833   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
1834   - Map<String, Object> m=new HashMap<String,Object>();
1835   - m.put("gsdm", rs.getString("gsdm"));
1836   - m.put("gsname", rs.getString("gsname"));
1837   - m.put("fgsdm", rs.getString("fgsdm"));
1838   - m.put("fgsname", rs.getString("fgsname"));
1839   - m.put("rq_str", rs.getString("rq_str"));
1840   - m.put("xl", rs.getString("xl"));
1841   - m.put("xl_name", rs.getString("xl_name"));
1842   - m.put("cl", rs.getString("cl"));
1843   - m.put("jhyybc", rs.getString("jhyybc"));
1844   - m.put("jhfyybc", rs.getString("jhfyybc"));
1845   - m.put("sjyybc", rs.getString("sjyybc"));
1846   - m.put("sjfyybc", rs.getString("sjfyybc"));
1847   - m.put("ljbc", rs.getString("ljbc"));
1848   - m.put("jhyylc", rs.getString("jhyylc"));
1849   - m.put("jhfyylc", rs.getString("jhfyylc"));
1850   - m.put("sjyylc", rs.getString("sjyylc"));
1851   - m.put("sjfyylc", rs.getString("sjfyylc"));
1852   - m.put("ljyylc", rs.getString("ljyylc"));
1853   - m.put("ljfyylc", rs.getString("ljfyylc"));
1854   - return m;
1855   - }
1856   - });
1857   -
1858   - String cclSql = "select date,gsdm,fgsdm,xl,xl_name,jhcc,sjcc,ccl,jhbc,sjbc,bczxl from bsth_c_calc_count "
1859   - + " where date = ? ";
1860   -
1861   - List<Map<String, Object>> cclList=jdbcTemplate.query(cclSql, new Object[]{date},
1862   - new RowMapper<Map<String, Object>>(){
1863   - @Override
1864   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
1865   - Map<String, Object> m=new HashMap<String,Object>();
1866   - m.put("date", rs.getString("date"));
1867   - m.put("gsdm", rs.getString("gsdm"));
1868   - m.put("fgsdm", rs.getString("fgsdm"));
1869   - m.put("xl", rs.getString("xl"));
1870   - m.put("xlName", rs.getString("xl_name"));
1871   - m.put("jhcc", rs.getString("jhcc"));
1872   - m.put("sjcc", rs.getString("sjcc"));
1873   - m.put("ccl", rs.getString("ccl"));
1874   - m.put("jhbc", rs.getString("jhbc"));
1875   - m.put("sjbc", rs.getString("sjbc"));
1876   - m.put("bczxl", rs.getString("bczxl"));
1877   - return m;
1878   - }
1879   - });
1880   - Map<String, Map<String, Object>> xlMap = new HashMap<String, Map<String, Object>>();
1881   - Map<String, List> carsMap = new HashMap<String, List>();
1882   - for(Map<String, Object> m : cclList){
1883   - String rqStr = m.get("date").toString();
1884   - String gsdm = m.get("gsdm").toString();
1885   - String fgsdm = m.get("fgsdm").toString();
1886   - String xl = m.get("xl").toString();
1887   - String key = rqStr + "/" + gsdm + "/" + fgsdm + "/" + xl;
1888   - m.put("gsName", BusinessCodeData.code2Name.get(gsdm));
1889   - m.put("fgsName", BusinessCodeData.code2Name.get(gsdm + "_" + fgsdm));
1890   -// m.put("cars", new ArrayList());
1891   - xlMap.put(key, m);
1892   - carsMap.put(key, new ArrayList());
1893   - }
1894   -
1895   - List<OilInfo> OilInfoList = oilInfoRepository.findByDate(rq);
1896   - List<ElecInfo> ElecInfoList = elecInfoRepository.findByDate(rq);
1897   -
1898   - Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>();
1899   - for(Map<String, Object> m : calcList){
1900   - String rqStr = m.get("rq_str").toString();
1901   - String gsdm = m.get("gsdm").toString();
1902   - String fgsdm = m.get("fgsdm").toString();
1903   - String xl = m.get("xl").toString();
1904   - String cl = m.get("cl").toString();
1905   - String key = rqStr + "/" + gsdm + "/" + fgsdm + "/" + xl + "/" + cl;
1906   - if(!keyMap.containsKey(key)){
1907   - Map<String, Object> m1 = new HashMap<String, Object>();
1908   - m1.put("oil", 0);
1909   - m1.put("elec", 0);
1910   - keyMap.put(key, m1);
1911   - }
1912   - Map<String, Object> m1 = keyMap.get(key);
1913   - m1.put("date", rqStr);
1914   - m1.put("gsdm", gsdm);
1915   - m1.put("gsName", m.get("gsname")!=null?m.get("gsname").toString():"");
1916   - m1.put("fgsdm", fgsdm);
1917   - m1.put("fgsName", m.get("fgsname")!=null?m.get("fgsname").toString():"");
1918   - m1.put("xl", xl);
1919   - m1.put("xlName", m.get("xl_name")!=null?m.get("xl_name").toString():"");
1920   - m1.put("cl", cl);
1921   - m1.put("jhbc", new BigDecimal(m1.get("jhbc")!=null?m1.get("jhbc").toString():"0").add(
1922   - new BigDecimal(m.get("jhyybc")!=null?m.get("jhyybc").toString():"0")).add(
1923   - new BigDecimal(m.get("jhfyybc")!=null?m.get("jhfyybc").toString():"0")));
1924   - m1.put("sjbc", new BigDecimal(m1.get("sjbc")!=null?m1.get("sjbc").toString():"0").add( //实际班次+临加班次=总实际班次
1925   - new BigDecimal(m.get("sjyybc")!=null?m.get("sjyybc").toString():"0")).add(
1926   - new BigDecimal(m.get("sjfyybc")!=null?m.get("sjfyybc").toString():"0")).add(
1927   - new BigDecimal(m.get("ljbc")!=null?m.get("ljbc").toString():"0")));
1928   - m1.put("jhyygl", new BigDecimal(m1.get("jhyygl")!=null?m1.get("jhyygl").toString():"0").add(
1929   - new BigDecimal(m.get("jhyylc")!=null?m.get("jhyylc").toString():"0")));
1930   - m1.put("jhksgl", new BigDecimal(m1.get("jhksgl")!=null?m1.get("jhksgl").toString():"0").add(
1931   - new BigDecimal(m.get("jhfyylc")!=null?m.get("jhfyylc").toString():"0")));
1932   - m1.put("sjyygl", new BigDecimal(m1.get("sjyygl")!=null?m1.get("sjyygl").toString():"0").add(
1933   - new BigDecimal(m.get("sjyylc")!=null?m.get("sjyylc").toString():"0")).add(
1934   - new BigDecimal(m.get("ljyylc")!=null?m.get("ljyylc").toString():"0")));
1935   - m1.put("sjksgl", new BigDecimal(m1.get("sjksgl")!=null?m1.get("sjksgl").toString():"0").add(
1936   - new BigDecimal(m.get("sjfyylc")!=null?m.get("sjfyylc").toString():"0")).add(
1937   - new BigDecimal(m.get("ljfyylc")!=null?m.get("ljfyylc").toString():"0")));
1938   - }
1939   -
1940   - for(OilInfo oil : OilInfoList){
1941   - if(oil.getXlbm() == null || oil.getXlbm().trim().length() == 0){
1942   - continue;
1943   - }
1944   - String rqStr = sdf.format(oil.getRq());
1945   - String gsdm = oil.getSsgsdm();
1946   - String fgsdm = oil.getFgsdm();
1947   - String xl = oil.getXlbm();
1948   - String cl = oil.getNbbm();
1949   - String key = rqStr + "/" + gsdm + "/" + fgsdm + "/" + xl + "/" + cl;
1950   - if(!keyMap.containsKey(key)){
1951   - Map<String, Object> m1 = new HashMap<String, Object>();
1952   - m1.put("jhbc", 0);
1953   - m1.put("sjbc", 0);
1954   - m1.put("jhyygl", 0);
1955   - m1.put("jhksgl", 0);
1956   - m1.put("sjyygl", 0);
1957   - m1.put("sjksgl", 0);
1958   - m1.put("oil", 0);
1959   - m1.put("elec", 0);
1960   - keyMap.put(key, m1);
1961   - }
1962   - Map<String, Object> m1 = keyMap.get(key);
1963   - m1.put("date", rqStr);
1964   - m1.put("gsdm", gsdm);
1965   - m1.put("fgsdm", fgsdm);
1966   - m1.put("xl", xl);
1967   - m1.put("cl", cl);
1968   - m1.put("oil", new BigDecimal(m1.get("oil")!=null?m1.get("oil").toString():"0").add(
1969   - new BigDecimal(oil.getYh()!=null?oil.getYh().toString():"0")));
1970   - }
1971   -
1972   - for(ElecInfo elec : ElecInfoList){
1973   - if(elec.getXlbm() == null || elec.getXlbm().trim().length() == 0){
1974   - continue;
1975   - }
1976   - String rqStr = sdf.format(elec.getRq());
1977   - String gsdm = elec.getSsgsdm();
1978   - String fgsdm = elec.getFgsdm();
1979   - String xl = elec.getXlbm();
1980   - String cl = elec.getNbbm();
1981   - String key = rqStr + "/" + gsdm + "/" + fgsdm + "/" + xl + "/" + cl;
1982   - if(!keyMap.containsKey(key)){
1983   - Map<String, Object> m1 = new HashMap<String, Object>();
1984   - m1.put("jhbc", 0);
1985   - m1.put("sjbc", 0);
1986   - m1.put("jhyygl", 0);
1987   - m1.put("jhksgl", 0);
1988   - m1.put("sjyygl", 0);
1989   - m1.put("sjksgl", 0);
1990   - m1.put("oil", 0);
1991   - m1.put("elec", 0);
1992   - keyMap.put(key, m1);
1993   - }
1994   - Map<String, Object> m1 = keyMap.get(key);
1995   - m1.put("date", rqStr);
1996   - m1.put("gsdm", gsdm);
1997   - m1.put("fgsdm", fgsdm);
1998   - m1.put("xl", xl);
1999   - m1.put("cl", cl);
2000   - m1.put("elec", new BigDecimal(m1.get("elec")!=null?m1.get("elec").toString():"0").add(
2001   - new BigDecimal(elec.getHd()!=null?elec.getHd().toString():"0")));
2002   - }
2003   -
2004   - for(String key : keyMap.keySet()){
2005   - Map<String, Object> m = keyMap.get(key);
2006   - if(!m.containsKey("gsName") || m.get("gsName").toString().trim().length() == 0){
2007   - m.put("gsName", BusinessCodeData.code2Name.get(m.get("gsdm").toString()));
2008   - }
2009   - if(!m.containsKey("fgsName") || m.get("fgsName").toString().trim().length() == 0){
2010   - m.put("fgsName", BusinessCodeData.code2Name.get(m.get("gsdm").toString() + "_"
2011   - + m.get("fgsdm").toString()));
2012   - }
2013   - if(!m.containsKey("xlName") || m.get("xlName").toString().trim().length() == 0){
2014   - if(!allLineMap.containsKey(m.get("xl").toString())){
2015   - continue;
2016   - }
2017   - m.put("xlName", allLineMap.get(m.get("xl").toString()));
2018   - }
2019   -// if(new BigDecimal(m.get("jhyygl").toString()).compareTo(new BigDecimal("0")) == 1){
2020   -// m.put("jhcc", 1);
2021   -// } else {
2022   -// m.put("jhcc", 0);
2023   -// }
2024   -// if(new BigDecimal(m.get("sjyygl").toString()).compareTo(new BigDecimal("0")) == 1){
2025   -// m.put("sjcc", 1);
2026   -// } else {
2027   -// m.put("sjcc", 0);
2028   -// }
2029   - m.put("jhzgl", new BigDecimal(m.get("jhyygl").toString()).add(new BigDecimal(m.get("jhksgl").toString())));
2030   - m.put("sjzgl", new BigDecimal(m.get("sjyygl").toString()).add(new BigDecimal(m.get("sjksgl").toString())));
2031   -
2032   - String rqStr = m.get("date").toString();
2033   - String gsdm = m.get("gsdm").toString();
2034   - String fgsdm = m.get("fgsdm").toString();
2035   - String xl = m.get("xl").toString();
2036   - String xlKey = rqStr + "/" + gsdm + "/" + fgsdm + "/" + xl;
2037   - if(!carsMap.containsKey(xlKey)){
2038   - Map<String, Object> temp = new HashMap<String, Object>();
2039   - temp.put("date", rqStr);
2040   - temp.put("gsdm", gsdm);
2041   - temp.put("fgsdm", fgsdm);
2042   - temp.put("xl", xl);
2043   - temp.put("gsName", m.get("gsName").toString());
2044   - temp.put("fgsName", m.get("fgsName").toString());
2045   - temp.put("xlName", m.get("xlName").toString());
2046   - temp.put("jhcc", 0);
2047   - temp.put("sjcc", 0);
2048   - temp.put("ccl", 0);
2049   - temp.put("jhbc", 0);
2050   - temp.put("sjbc", 0);
2051   - temp.put("bczxl", 0);
2052   - xlMap.put(xlKey, temp);
2053   - carsMap.put(xlKey, new ArrayList());
2054   - }
2055   - carsMap.get(xlKey).add(m);
2056   - }
2057   -
2058   - for(String key : xlMap.keySet()){
2059   - Map<String, Object> m = xlMap.get(key);
2060   - m.put("cars", carsMap.get(key));
2061   - String xl = m.get("xl").toString();
2062   - if(!yyLine.contains(xl)){
2063   - continue;
2064   - }
2065   - if(warrantCarMap.containsKey(xl)){
2066   - m.put("warrantCar", warrantCarMap.get(xl));
2067   - } else {
2068   - m.put("warrantCar", "");
2069   - }
2070   - resList.add(m);
2071   - }
2072   -
2073   - return resList;
2074   - }
2075   -
2076   - /**
2077   - * 浦东公交线路调查表(给郑鑫)
2078   - * @param date
2079   - * @return
2080   - * @throws ParseException
2081   - */
2082   - @GET
2083   - @Path("/calcInvestigateMonth/month/{month}/{gs}/{fgs}/{line}")
2084   - public List<JSONObject> calcInvestigateMonth(@PathParam("month") String month,
2085   - @PathParam("gs") String gs, @PathParam("fgs") String fgs,
2086   - @PathParam("line") String line) throws ParseException {
2087   - List<JSONObject> resList = new ArrayList<JSONObject>();
2088   -
2089   - String xlSql="SELECT line_code, name, nature from bsth_c_line";
2090   - List<Map<String, Object>> xlList=jdbcTemplate.query(xlSql,
2091   - new RowMapper<Map<String, Object>>(){
2092   - @Override
2093   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
2094   - Map<String, Object> m=new HashMap<String,Object>();
2095   - m.put("lineCode", rs.getString("line_code"));
2096   - m.put("lineName", rs.getString("name"));
2097   - m.put("nature", rs.getString("nature"));
2098   - return m;
2099   - }
2100   - });
2101   - Set<String> yyLine = new HashSet<String>();
2102   - for(Map<String, Object> t : xlList){
2103   - if(t.get("lineCode") != null){
2104   - String nature = t.get("nature")!=null?t.get("nature").toString():"";
2105   - if("yxl".equals(nature) || "cgxl".equals(nature) || "gjxl".equals(nature)
2106   - || "csbs".equals(nature) || "cctxl".equals(nature)){
2107   - yyLine.add(t.get("lineCode").toString());
2108   - }
2109   - }
2110   - }
2111   -
2112   - if(gs == null || gs.trim().length() == 0){ //公司编码别传空值,就让传all代表全部
2113   - gs = "xxxx";
2114   - }
2115   - if("all".equals(gs.trim())){
2116   - gs = "";
2117   - }
2118   - if(fgs == null || fgs.trim().length() == 0){ //分公司编码别传空值,就让传all代表全部
2119   - fgs = "xxxx";
2120   - }
2121   - if("all".equals(fgs.trim())){
2122   - fgs = "";
2123   - }
2124   -
2125   - List<CalcInvestigateMonth> list = new ArrayList<CalcInvestigateMonth>();
2126   - if(line != null && !"all".equals(line.trim())){
2127   - list = calcInvestigateMonthRepository.findByMonthAndLine(month, line);
2128   - } else if(gs != null && gs.length() > 0){
2129   - list = calcInvestigateMonthRepository.findByMonth(month, gs, fgs);
2130   - } else {
2131   - list = calcInvestigateMonthRepository.findByMonth(month);
2132   - }
2133   -
2134   - for(CalcInvestigateMonth c : list){
2135   - if(yyLine.contains(c.getXl())){
2136   - JSONObject jsonObject = (JSONObject)JSON.toJSON(c);
2137   - jsonObject.put("gsName", BusinessCodeData.code2Name.get(jsonObject.get("gsbm").toString()));
2138   - jsonObject.put("fgsName", BusinessCodeData.code2Name.get(jsonObject.get("gsbm").toString()
2139   - + "_" + jsonObject.get("fgsbm").toString()));
2140   - resList.add(jsonObject);
2141   - }
2142   - }
2143   -
2144   - return resList;
2145   - }
2146   -
2147   -}