Commit 2561719c51d039b01fcceb7bbbd758a7e8957546

Authored by 王通
2 parents c4f54d82 0c40ca83

Merge branch 'pudong' into minhang

Showing 33 changed files with 2382 additions and 476 deletions

Too many changes to show.

To preserve performance only 33 of 110 files are displayed.

src/main/java/com/bsth/controller/calc/CalcWaybillController.java
@@ -147,7 +147,11 @@ public class CalcWaybillController extends BaseController<CalcWaybill, Integer> @@ -147,7 +147,11 @@ public class CalcWaybillController extends BaseController<CalcWaybill, Integer>
147 if(map.get("type")!=null){ 147 if(map.get("type")!=null){
148 type=map.get("type").toString().trim(); 148 type=map.get("type").toString().trim();
149 } 149 }
150 - return calcWaybillService.calcStatisticsDaily(gsdm,fgsdm,line,date,date2,xlName,type); 150 + String nature="0";
  151 + if(map.get("nature")!=null){
  152 + nature=map.get("nature").toString();
  153 + }
  154 + return calcWaybillService.calcStatisticsDaily(gsdm,fgsdm,line,date,date2,xlName,type,nature);
151 } 155 }
152 156
153 @RequestMapping(value="/calcStatisticsDaily2") 157 @RequestMapping(value="/calcStatisticsDaily2")
@@ -180,7 +184,11 @@ public class CalcWaybillController extends BaseController<CalcWaybill, Integer> @@ -180,7 +184,11 @@ public class CalcWaybillController extends BaseController<CalcWaybill, Integer>
180 if(map.get("type")!=null){ 184 if(map.get("type")!=null){
181 type=map.get("type").toString().trim(); 185 type=map.get("type").toString().trim();
182 } 186 }
183 - return calcWaybillService.calcStatisticsDaily2(gsdm,fgsdm,line,date,date2,xlName,type); 187 + String nature="0";
  188 + if(map.get("nature")!=null){
  189 + nature=map.get("nature").toString();
  190 + }
  191 + return calcWaybillService.calcStatisticsDaily2(gsdm,fgsdm,line,date,date2,xlName,type,nature);
184 } 192 }
185 193
186 @RequestMapping(value="/generateLineMileage") 194 @RequestMapping(value="/generateLineMileage")
src/main/java/com/bsth/controller/forms/ExportController.java
@@ -469,12 +469,13 @@ public class ExportController { @@ -469,12 +469,13 @@ public class ExportController {
469 for (Operationservice l : operationservice) { 469 for (Operationservice l : operationservice) {
470 Map<String, Object> m = new HashMap<String, Object>(); 470 Map<String, Object> m = new HashMap<String, Object>();
471 m.put("i", i); 471 m.put("i", i);
472 - m.put("xlName", l.getXlName());  
473 - m.put("jzl", l.getJzl());  
474 - m.put("xhl", l.getXhl());  
475 - m.put("xsgl", l.getXsgl());  
476 - m.put("emptMileage", l.getEmptMileage());  
477 - m.put("sjbc", l.getSjbc()); 472 + m.put("fgs", l.getFgs()!=null?l.getFgs():"");
  473 + m.put("xlName", l.getXlName()!=null?l.getXlName():"");
  474 + m.put("jzl", l.getJzl()!=null?l.getJzl():"");
  475 + m.put("xhl", l.getXhl()!=null?l.getXhl():"");
  476 + m.put("xsgl", l.getXsgl()!=null?l.getXsgl():"");
  477 + m.put("emptMileage", l.getEmptMileage()!=null?l.getEmptMileage():"");
  478 + m.put("sjbc", l.getSjbc()!=null?l.getSjbc():"");
478 resList.add(m); 479 resList.add(m);
479 i++; 480 i++;
480 } 481 }
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
@@ -417,7 +417,11 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -417,7 +417,11 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
417 if(map.get("type")!=null){ 417 if(map.get("type")!=null){
418 type=map.get("type").toString(); 418 type=map.get("type").toString();
419 } 419 }
420 - return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type); 420 + String nature="0";
  421 + if(map.get("nature")!=null){
  422 + nature=map.get("nature").toString();
  423 + }
  424 + return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type,nature);
421 } 425 }
422 426
423 /* 427 /*
src/main/java/com/bsth/controller/realcontrol/ServiceDataInterface.java
@@ -89,6 +89,8 @@ public class ServiceDataInterface { @@ -89,6 +89,8 @@ public class ServiceDataInterface {
89 map.put("remarks", sch.getRemark()); 89 map.put("remarks", sch.getRemark());
90 map.put("status", sch.getStatus()); 90 map.put("status", sch.getStatus());
91 91
  92 + //放站班次,放到的站点
  93 + map.put("majorStationName", sch.getMajorStationName());
92 rs.add(map); 94 rs.add(map);
93 } 95 }
94 return rs; 96 return rs;
src/main/java/com/bsth/controller/report/CalcSheetController.java 0 → 100644
  1 +package com.bsth.controller.report;
  2 +import java.util.List;
  3 +import java.util.Map;
  4 +
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.web.bind.annotation.RequestMapping;
  7 +import org.springframework.web.bind.annotation.RequestMethod;
  8 +import org.springframework.web.bind.annotation.RequestParam;
  9 +import org.springframework.web.bind.annotation.RestController;
  10 +import com.bsth.controller.BaseController;
  11 +import com.bsth.entity.sheet.CalcSheet;
  12 +import com.bsth.entity.sheet.Sheet;
  13 +import com.bsth.service.report.CalcSheetService;
  14 +
  15 +@RestController
  16 +@RequestMapping("calcSheet")
  17 +public class CalcSheetController extends BaseController<CalcSheet, Integer>{
  18 + @Autowired
  19 + CalcSheetService calcSheetService;
  20 + //发车到站准点率统计
  21 + @RequestMapping(value = "/countList",method = RequestMethod.GET)
  22 + public List<CalcSheet> countList(@RequestParam Map<String, Object> map){
  23 + List<CalcSheet> list=calcSheetService.countListCalcSheet(map);
  24 + return list;
  25 + }
  26 + //发车到站准点率列表
  27 + @RequestMapping(value = "/calcListSheet",method = RequestMethod.GET)
  28 + public List<CalcSheet> calcListSheet(@RequestParam Map<String, Object> map){
  29 + List<CalcSheet> list=calcSheetService.calcListSheet(map);
  30 + return list;
  31 + }
  32 + //发车站点准点率详细
  33 + @RequestMapping(value = "/calcSheet",method = RequestMethod.GET)
  34 + public List<Sheet> calcSheet(@RequestParam Map<String, Object> map){
  35 + List<Sheet> list=calcSheetService.calcSheet(map);
  36 + return list;
  37 + }
  38 +
  39 + //营运线路出车率统计
  40 + @RequestMapping(value = "/calcTurnoutrate",method = RequestMethod.GET)
  41 + public List<Map<String, Object>> calcTurnoutrate(@RequestParam Map<String, Object> map){
  42 + List<Map<String, Object>> list=calcSheetService.calcTurnoutrate(map);
  43 + return list;
  44 + }
  45 +}
src/main/java/com/bsth/controller/schedule/core/EmployeeConfigInfoController.java
@@ -70,6 +70,27 @@ public class EmployeeConfigInfoController extends BController&lt;EmployeeConfigInfo @@ -70,6 +70,27 @@ public class EmployeeConfigInfoController extends BController&lt;EmployeeConfigInfo
70 return rtn; 70 return rtn;
71 } 71 }
72 72
  73 + @RequestMapping(value = "/validate_jsy_config", method = RequestMethod.GET)
  74 + public Map<String, Object> validate_jsy_config(@RequestParam Map<String, Object> param) {
  75 + Map<String, Object> rtn = new HashMap<>();
  76 + try {
  77 + EmployeeConfigInfo employeeConfigInfo = new EmployeeConfigInfo(
  78 + null,
  79 + param.get("xl.id_eq"),
  80 + param.get("xl.name_eq"),
  81 + param.get("jsy.id_eq"),
  82 + null
  83 + );
  84 + employeeConfigInfoService.validate_jsy_config(employeeConfigInfo);
  85 + rtn.put("status", ResponseCode.SUCCESS);
  86 + } catch (ScheduleException exp) {
  87 + rtn.put("status", ResponseCode.ERROR);
  88 + rtn.put("msg", exp.getMessage());
  89 + }
  90 +
  91 + return rtn;
  92 + }
  93 +
73 @RequestMapping(value = "/validate_spy", method = RequestMethod.GET) 94 @RequestMapping(value = "/validate_spy", method = RequestMethod.GET)
74 public Map<String, Object> validate_spy(@RequestParam Map<String, Object> param) { 95 public Map<String, Object> validate_spy(@RequestParam Map<String, Object> param) {
75 Map<String, Object> rtn = new HashMap<>(); 96 Map<String, Object> rtn = new HashMap<>();
@@ -89,4 +110,24 @@ public class EmployeeConfigInfoController extends BController&lt;EmployeeConfigInfo @@ -89,4 +110,24 @@ public class EmployeeConfigInfoController extends BController&lt;EmployeeConfigInfo
89 } 110 }
90 return rtn; 111 return rtn;
91 } 112 }
  113 +
  114 + @RequestMapping(value = "/validate_spy_config", method = RequestMethod.GET)
  115 + public Map<String, Object> validate_spy_config(@RequestParam Map<String, Object> param) {
  116 + Map<String, Object> rtn = new HashMap<>();
  117 + try {
  118 + EmployeeConfigInfo employeeConfigInfo = new EmployeeConfigInfo(
  119 + null,
  120 + param.get("xl.id_eq"),
  121 + param.get("xl.name_eq"),
  122 + null,
  123 + param.get("spy.id_eq")
  124 + );
  125 + employeeConfigInfoService.validate_spy_config(employeeConfigInfo);
  126 + rtn.put("status", ResponseCode.SUCCESS);
  127 + } catch (ScheduleException exp) {
  128 + rtn.put("status", ResponseCode.ERROR);
  129 + rtn.put("msg", exp.getMessage());
  130 + }
  131 + return rtn;
  132 + }
92 } 133 }
src/main/java/com/bsth/data/gpsdata_v2/handlers/InStationProcess.java
@@ -146,8 +146,8 @@ public class InStationProcess { @@ -146,8 +146,8 @@ public class InStationProcess {
146 dayOfSchedule.removeExecPlan(nbbm); 146 dayOfSchedule.removeExecPlan(nbbm);
147 147
148 //通知误点停靠程序,有车辆到站 148 //通知误点停靠程序,有车辆到站
149 - //LateAdjustHandle.carArrive(gps, next);  
150 - LateAdjustHandle.carArrive(gps); 149 + LateAdjustHandle.carArrive(gps, next);
  150 + //LateAdjustHandle.carArrive(gps);
151 151
152 //路牌的下一个班次,页面显示起点实际到达时间 152 //路牌的下一个班次,页面显示起点实际到达时间
153 ScheduleRealInfo lpNext = dayOfSchedule.nextByLp(sch); 153 ScheduleRealInfo lpNext = dayOfSchedule.nextByLp(sch);
src/main/java/com/bsth/data/safe_driv/SafeDrivDataLoadThread.java
@@ -20,12 +20,12 @@ import java.util.List; @@ -20,12 +20,12 @@ import java.util.List;
20 * Created by panzhao on 2017/4/6. 20 * Created by panzhao on 2017/4/6.
21 */ 21 */
22 @Component 22 @Component
23 -public class SafeDrivDataLoadThread extends Thread{ 23 +public class SafeDrivDataLoadThread extends Thread {
24 24
25 Logger logger = LoggerFactory.getLogger(this.getClass()); 25 Logger logger = LoggerFactory.getLogger(this.getClass());
26 26
27 static String url; 27 static String url;
28 - static CloseableHttpClient httpClient = null; 28 + static CloseableHttpClient httpClient;
29 static HttpGet get; 29 static HttpGet get;
30 static RequestConfig requestConfig; 30 static RequestConfig requestConfig;
31 static CloseableHttpResponse response; 31 static CloseableHttpResponse response;
@@ -51,9 +51,7 @@ public class SafeDrivDataLoadThread extends Thread{ @@ -51,9 +51,7 @@ public class SafeDrivDataLoadThread extends Thread{
51 51
52 int statusCode = response.getStatusLine().getStatusCode(); 52 int statusCode = response.getStatusLine().getStatusCode();
53 if(statusCode != 200){ 53 if(statusCode != 200){
54 - get.abort();  
55 logger.error("http client status code: " + statusCode); 54 logger.error("http client status code: " + statusCode);
56 - return;  
57 } 55 }
58 56
59 entity = response.getEntity(); 57 entity = response.getEntity();
@@ -67,7 +65,7 @@ public class SafeDrivDataLoadThread extends Thread{ @@ -67,7 +65,7 @@ public class SafeDrivDataLoadThread extends Thread{
67 65
68 list = JSON.parseArray(stringBuffer.toString(), SafeDriv.class); 66 list = JSON.parseArray(stringBuffer.toString(), SafeDriv.class);
69 67
70 - for(SafeDriv sd : list){ 68 + for (SafeDriv sd : list) {
71 SafeDrivCenter.put(sd); 69 SafeDrivCenter.put(sd);
72 } 70 }
73 } 71 }
@@ -75,7 +73,7 @@ public class SafeDrivDataLoadThread extends Thread{ @@ -75,7 +73,7 @@ public class SafeDrivDataLoadThread extends Thread{
75 if (null != response) 73 if (null != response)
76 response.close(); 74 response.close();
77 } catch (Exception e) { 75 } catch (Exception e) {
78 - logger.error("安全驾驶接口报错了" , e.getMessage()); 76 + logger.error("安全驾驶接口报错了", e.getMessage());
79 } 77 }
80 } 78 }
81 } 79 }
src/main/java/com/bsth/data/schedule/ScheduleComparator.java
@@ -9,12 +9,10 @@ import java.util.HashMap; @@ -9,12 +9,10 @@ import java.util.HashMap;
9 import java.util.Map; 9 import java.util.Map;
10 10
11 /** 11 /**
12 - *  
13 - * @ClassName: ScheduleComparator  
14 - * @Description: TODO(实际班次排序器)  
15 * @author PanZhao 12 * @author PanZhao
16 - * @date 2016年8月15日 下午1:53:28  
17 - * 13 + * @ClassName: ScheduleComparator
  14 + * @Description: TODO(实际班次排序器)
  15 + * @date 2016年8月15日 下午1:53:28
18 */ 16 */
19 public class ScheduleComparator { 17 public class ScheduleComparator {
20 18
@@ -26,71 +24,62 @@ public class ScheduleComparator { @@ -26,71 +24,62 @@ public class ScheduleComparator {
26 }*/ 24 }*/
27 25
28 26
29 - static Map<String, Integer> bcTypeOrderMap = new HashMap<>(); 27 + static Map<String, Integer> bcTypeOrderMap = new HashMap<>();
30 28
31 - static{  
32 - bcTypeOrderMap.put("out", 0);  
33 - bcTypeOrderMap.put("normal", 1);  
34 - bcTypeOrderMap.put("region", 2);  
35 - bcTypeOrderMap.put("major", 3);  
36 - bcTypeOrderMap.put("venting", 4);  
37 - bcTypeOrderMap.put("ldks", 5);  
38 - bcTypeOrderMap.put("in", 6);  
39 - }  
40 -  
41 - public static class FCSJ implements Comparator<ScheduleRealInfo>{ 29 + static {
  30 + bcTypeOrderMap.put("out", 0);
  31 + bcTypeOrderMap.put("normal", 1);
  32 + bcTypeOrderMap.put("region", 2);
  33 + bcTypeOrderMap.put("major", 3);
  34 + bcTypeOrderMap.put("venting", 4);
  35 + bcTypeOrderMap.put("ldks", 5);
  36 + bcTypeOrderMap.put("in", 6);
  37 + }
42 38
43 - @Override  
44 - public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) {  
45 - int diff = (int) (s1.getFcsjT() - s2.getFcsjT());  
46 - return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());  
47 - }  
48 - } 39 + public static class FCSJ implements Comparator<ScheduleRealInfo> {
49 40
50 - private static int typeOrder(String bcType){  
51 - return bcTypeOrderMap.get(bcType)!=null?bcTypeOrderMap.get(bcType):0;  
52 - } 41 + @Override
  42 + public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) {
  43 + int diff = (int) (s1.getFcsjT() - s2.getFcsjT());
  44 + return diff != 0 ? diff : typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());
  45 + }
  46 + }
  47 +
  48 + private static int typeOrder(String bcType) {
  49 + return bcTypeOrderMap.get(bcType) != null ? bcTypeOrderMap.get(bcType) : 0;
  50 + }
53 51
54 - public static class DFSJ implements Comparator<ScheduleRealInfo>{ 52 + public static class DFSJ implements Comparator<ScheduleRealInfo> {
55 53
56 static Logger logger = LoggerFactory.getLogger(DFSJ.class); 54 static Logger logger = LoggerFactory.getLogger(DFSJ.class);
57 55
58 - @Override  
59 - public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) {  
60 - try{ 56 + @Override
  57 + public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) {
  58 + try {
  59 + int diff;
  60 + if (!s2.isSflj() && !s1.isSflj()) {
  61 + diff = (int) (s1.getFcsjT() - s2.getFcsjT());
61 62
62 - if(!s1.getXlBm().equals(s2.getXlBm()) || !s1.getLpName().equals(s2.getLpName())){  
63 - int diff = (int) (s1.getDfsjT() - s2.getDfsjT());  
64 - return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());  
65 - }  
66 - else{  
67 - /**  
68 - * 按时刻表发车顺序号  
69 - */  
70 - Integer fc1 = s1.getFcno();  
71 - Integer fc2 = s2.getFcno();  
72 - if(null != fc1 && null != fc2){  
73 - return fc1.intValue()==fc2.intValue()?0:fc1.intValue()-fc2.intValue();  
74 - }  
75 - else{  
76 - int diff = (int) (s1.getDfsjT() - s2.getDfsjT());  
77 - return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());  
78 - } 63 + } else {
  64 + diff = (int) (s1.getDfsjT() - s2.getDfsjT());
79 } 65 }
80 - }catch (Exception e){ 66 +
  67 + return diff != 0 ? diff : typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());
  68 +
  69 + } catch (Exception e) {
81 logger.error("排序异常", e); 70 logger.error("排序异常", e);
82 - return s1.getDfsjT() - s2.getDfsjT() > 0?1:-1; 71 + return s1.getDfsjT() - s2.getDfsjT() > 0 ? 1 : -1;
83 } 72 }
84 - }  
85 - } 73 + }
  74 + }
86 75
87 - public static class DFSJ2 implements Comparator<ScheduleRealInfo>{ 76 + public static class DFSJ2 implements Comparator<ScheduleRealInfo> {
88 77
89 78
90 @Override 79 @Override
91 public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { 80 public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) {
92 int diff = (int) (s1.getDfsjT() - s2.getDfsjT()); 81 int diff = (int) (s1.getDfsjT() - s2.getDfsjT());
93 - return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType()); 82 + return diff != 0 ? diff : typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());
94 } 83 }
95 } 84 }
96 } 85 }
src/main/java/com/bsth/data/schedule/late_adjust/LateAdjustHandle.java
1 1
2 package com.bsth.data.schedule.late_adjust; 2 package com.bsth.data.schedule.late_adjust;
3 3
4 -import com.bsth.data.BasicData;  
5 import com.bsth.data.LineConfigData; 4 import com.bsth.data.LineConfigData;
6 import com.bsth.data.gpsdata_v2.entity.GpsEntity; 5 import com.bsth.data.gpsdata_v2.entity.GpsEntity;
7 import com.bsth.entity.realcontrol.LineConfig; 6 import com.bsth.entity.realcontrol.LineConfig;
8 import com.bsth.entity.realcontrol.ScheduleRealInfo; 7 import com.bsth.entity.realcontrol.ScheduleRealInfo;
9 import com.bsth.util.Arith; 8 import com.bsth.util.Arith;
10 import com.bsth.websocket.handler.SendUtils; 9 import com.bsth.websocket.handler.SendUtils;
11 -import com.google.common.collect.ArrayListMultimap;  
12 -import org.apache.commons.lang3.StringUtils;  
13 import org.slf4j.Logger; 10 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory; 11 import org.slf4j.LoggerFactory;
15 import org.springframework.beans.BeansException; 12 import org.springframework.beans.BeansException;
@@ -18,7 +15,8 @@ import org.springframework.context.ApplicationContextAware; @@ -18,7 +15,8 @@ import org.springframework.context.ApplicationContextAware;
18 import org.springframework.stereotype.Component; 15 import org.springframework.stereotype.Component;
19 16
20 import java.util.Collection; 17 import java.util.Collection;
21 -import java.util.List; 18 +import java.util.concurrent.ConcurrentHashMap;
  19 +import java.util.concurrent.ConcurrentMap;
22 20
23 /** 21 /**
24 * 误点自动调整待发 处理程序 22 * 误点自动调整待发 处理程序
@@ -35,17 +33,11 @@ public class LateAdjustHandle implements ApplicationContextAware { @@ -35,17 +33,11 @@ public class LateAdjustHandle implements ApplicationContextAware {
35 static Logger logger = LoggerFactory.getLogger(LateAdjustHandle.class); 33 static Logger logger = LoggerFactory.getLogger(LateAdjustHandle.class);
36 34
37 /** 35 /**
38 - * 应发未到车辆 和 班次  
39 - * <p>  
40 - * 起点相同的,保留最后一个班次 36 + * 应发未到的班次 key : id
41 */ 37 */
42 - private static ArrayListMultimap lateSchMaps; 38 + private static ConcurrentMap<Long, ScheduleRealInfo> lateSchMap = new ConcurrentHashMap<>();
43 39
44 40
45 - static {  
46 - lateSchMaps = ArrayListMultimap.create();  
47 - }  
48 -  
49 /** 41 /**
50 * 新增一个误点班次 42 * 新增一个误点班次
51 * 43 *
@@ -65,15 +57,14 @@ public class LateAdjustHandle implements ApplicationContextAware { @@ -65,15 +57,14 @@ public class LateAdjustHandle implements ApplicationContextAware {
65 if (sch.getDfsj().compareTo(config.getYjtkStart()) > 0 57 if (sch.getDfsj().compareTo(config.getYjtkStart()) > 0
66 && sch.getDfsj().compareTo(config.getYjtkEnd()) <= 0) { 58 && sch.getDfsj().compareTo(config.getYjtkEnd()) <= 0) {
67 59
68 - ScheduleRealInfo old = popLateSch(sch);  
69 -  
70 - //班次被压入  
71 - if (lateSchMaps.containsEntry(sch.getClZbh(), sch)) { 60 + //班次压入
  61 + if (!lateSchMap.containsKey(sch.getId())) {
  62 + logger.info("29【应发未到 班次 " + sch.getClZbh() + " -" + sch.getDfsj() + " -id: " + sch.getId() + " -加入误点调整!");
72 63
73 - logger.info("21【应发未到 -多个(" + lateSchMaps.get(sch.getClZbh()).size() + ")】班次 " + sch.getClZbh() + " -" + sch.getDfsj() + " -id: " + sch.getId() + " -加入误点调整!");  
74 - //通知客户端  
75 sch.setLate2(true); 64 sch.setLate2(true);
76 - sendUtils.sendAutoWdtz(sch, old); 65 + lateSchMap.put(sch.getId(), sch);
  66 + //通知客户端
  67 + sendUtils.sendAutoWdtz(sch, null);
77 } 68 }
78 } 69 }
79 70
@@ -82,51 +73,6 @@ public class LateAdjustHandle implements ApplicationContextAware { @@ -82,51 +73,6 @@ public class LateAdjustHandle implements ApplicationContextAware {
82 } 73 }
83 } 74 }
84 75
85 - /**  
86 - * 压入新的误点班次  
87 - *  
88 - * @param sch  
89 - * @return 返回被移除的误点班次  
90 - */  
91 - private static ScheduleRealInfo popLateSch(ScheduleRealInfo sch) {  
92 - List<ScheduleRealInfo> list = lateSchMaps.get(sch.getClZbh());  
93 -  
94 - if (null == list || list.size() == 0)  
95 - lateSchMaps.put(sch.getClZbh(), sch);  
96 - else {  
97 - ScheduleRealInfo old = findExistQdz(list, sch.getQdzCode(), sch.getQdzName(), "");  
98 -  
99 - if (null == old)  
100 - lateSchMaps.put(sch.getClZbh(), sch);  
101 - else if (old.getDfsjT() < sch.getDfsjT()) {  
102 - //同一个起点,保留时间最大的班次  
103 - lateSchMaps.remove(old.getClZbh(), old);  
104 - lateSchMaps.put(sch.getClZbh(), sch);  
105 -  
106 - logger.info(sch.getClZbh() + "【应发未到】old 班次 " + old.getId() + " -被覆盖!");  
107 - return old;  
108 - }  
109 - }  
110 -  
111 - return null;  
112 - }  
113 -  
114 - /**  
115 - * 搜索同样起点的班次  
116 - *  
117 - * @param list  
118 - * @return  
119 - */  
120 - private static ScheduleRealInfo findExistQdz(List<ScheduleRealInfo> list, String qdzCode, String nam1, String name2) {  
121 - for (ScheduleRealInfo item : list) {  
122 - if (item.getQdzCode().equals(qdzCode)  
123 - || item.getQdzName().equals(nam1)  
124 - || item.getQdzName().equals(name2))  
125 - return item;  
126 - }  
127 - return null;  
128 - }  
129 -  
130 76
131 /** 77 /**
132 * 获取所有应发未到的班次 78 * 获取所有应发未到的班次
@@ -134,13 +80,13 @@ public class LateAdjustHandle implements ApplicationContextAware { @@ -134,13 +80,13 @@ public class LateAdjustHandle implements ApplicationContextAware {
134 * @return 80 * @return
135 */ 81 */
136 public static Collection<ScheduleRealInfo> allLateSch() { 82 public static Collection<ScheduleRealInfo> allLateSch() {
137 - return lateSchMaps.values(); 83 + return lateSchMap.values();
138 } 84 }
139 85
140 public static void remove(ScheduleRealInfo sch) { 86 public static void remove(ScheduleRealInfo sch) {
141 try { 87 try {
142 - if (lateSchMaps.containsEntry(sch.getClZbh(), sch)) {  
143 - lateSchMaps.remove(sch.getClZbh(), sch); 88 + if (lateSchMap.containsKey(sch.getId())) {
  89 + lateSchMap.remove(sch.getId());
144 90
145 sch.setLate2(false); 91 sch.setLate2(false);
146 sch.setLateMinute(0); 92 sch.setLateMinute(0);
@@ -154,61 +100,47 @@ public class LateAdjustHandle implements ApplicationContextAware { @@ -154,61 +100,47 @@ public class LateAdjustHandle implements ApplicationContextAware {
154 } 100 }
155 101
156 /** 102 /**
157 - * 车辆到站 103 + * 车辆到站 进站 进 的哪个班次,就调该车辆的下一个班次
158 * 104 *
159 * @param gps 105 * @param gps
160 */ 106 */
161 - public static void carArrive(GpsEntity gps) { 107 + public static void carArrive(GpsEntity gps, ScheduleRealInfo sch) {
162 try { 108 try {
163 - if (gps.getInstation() <= 0) {  
164 - return;  
165 - }  
166 -  
167 - List<ScheduleRealInfo> list = lateSchMaps.get(gps.getNbbm());  
168 -  
169 - if (null == list || list.size() == 0) 109 + if (gps.getInstation() <= 0 || null == sch)
170 return; 110 return;
171 111
  112 + if (!lateSchMap.containsKey(sch.getId())) {
  113 + //班次是否误点(可能处于误点线程扫描的空隙,所以再判定一次)
  114 + if (sch.getDfsjT() <= gps.getTimestamp()) {
  115 + putLate(sch);
172 116
173 - String key = gps.getLineId() + "_" + gps.getUpDown() + "_" + gps.getStopNo(), name1 = BasicData.stationCode2NameMap.get(key)//站点名称  
174 - , name2 = null;  
175 - if (StringUtils.isNotEmpty(gps.getCarparkNo())) {  
176 - name2 = BasicData.stationCode2NameMap.get(gps.getCarparkNo());  
177 - } 117 + if (!lateSchMap.containsKey(sch.getId()))
  118 + return;
178 119
179 - if (gps.getInstation() == 2) {  
180 - name1 = name2;//进场,没有站 120 + logger.info("线程空隙漏掉的误点,id: " + sch.getId());
  121 + } else
  122 + return;
181 } 123 }
182 124
183 - gps.setStationName(name1);  
184 - //根据起点站获取误点班次  
185 - ScheduleRealInfo sch = findExistQdz(list, gps.getStopNo(), name1, name2);  
186 -  
187 - if (null == sch)  
188 - return;  
189 125
190 //可能是延迟信号,gps时间没有误点 126 //可能是延迟信号,gps时间没有误点
191 if (gps.getTimestamp() <= sch.getDfsjT()) { 127 if (gps.getTimestamp() <= sch.getDfsjT()) {
192 sch.setLate2(false); 128 sch.setLate2(false);
193 - lateSchMaps.remove(sch.getClZbh(), sch); 129 + lateSchMap.remove(sch.getId());
194 return; 130 return;
195 } 131 }
196 132
197 - if (gps.getStationName().equals(sch.getQdzName())  
198 - || gps.getStopNo().equals(sch.getQdzCode())  
199 - || sch.getQdzName().equals(name2)) {  
200 133
201 - //自动调整待发 到达时间 + 停靠时间  
202 - long dt = Arith.addLong(gps.getTimestamp(), (sch.getLateMinute() * 60 * 1000)); 134 + //自动调整待发 到达时间 + 停靠时间
  135 + long dt = Arith.addLong(gps.getTimestamp(), (sch.getLateMinute() * 60 * 1000));
203 136
204 - sch.setDfsjAll(dt);  
205 - sch.setDfAuto(true);  
206 - //取消应发未到标记  
207 - sch.setLate2(false); 137 + sch.setDfsjAll(dt);
  138 + sch.setDfAuto(true);
  139 + //取消应发未到标记
  140 + sch.setLate2(false);
208 141
209 - lateSchMaps.remove(sch.getClZbh(), sch);  
210 - logger.info("【应发未到】车辆到站 " + sch.getClZbh() + " -" + sch.getDfsj() + " -到站时间:" + gps.getTimestamp() + " -停靠时间:" + sch.getLateMinute() + " -自动设置的待发时间:" + dt);  
211 - } 142 + lateSchMap.remove(sch.getId());
  143 + logger.info("【应发未到】车辆到站 " + sch.getClZbh() + " -" + sch.getDfsj() + " -到站时间:" + gps.getTimestamp() + " -停靠时间:" + sch.getLateMinute() + " -自动设置的待发时间:" + dt + " -id:" + sch.getId());
212 } catch (Exception e) { 144 } catch (Exception e) {
213 e.printStackTrace(); 145 e.printStackTrace();
214 logger.error("late2 car arrive", e); 146 logger.error("late2 car arrive", e);
@@ -216,47 +148,6 @@ public class LateAdjustHandle implements ApplicationContextAware { @@ -216,47 +148,6 @@ public class LateAdjustHandle implements ApplicationContextAware {
216 } 148 }
217 149
218 150
219 - /**  
220 - * 车辆到站, 进站 进 的哪个班次,就调该车辆的下一个班次  
221 - *  
222 - * @param gps  
223 - * @param sch public static void carArrive(GpsEntity gps, ScheduleRealInfo sch) {  
224 - * try {  
225 - * if (gps.getInstation() <= 0 || null == sch) {  
226 - * return;  
227 - * }  
228 - * <p>  
229 - * List<ScheduleRealInfo> list = lateSchMaps.get(gps.getNbbm());  
230 - * <p>  
231 - * if (null == list || list.size() == 0 || !list.contains(sch)) {  
232 - * return;  
233 - * }  
234 - * <p>  
235 - * //可能是延迟信号,gps时间没有误点  
236 - * if (gps.getTimestamp() <= sch.getDfsjT()) {  
237 - * sch.setLate2(false);  
238 - * lateSchMaps.remove(sch.getClZbh(), sch);  
239 - * return;  
240 - * }  
241 - * <p>  
242 - * <p>  
243 - * //自动调整待发 到达时间 + 停靠时间  
244 - * long dt = Arith.addLong(gps.getTimestamp(), (sch.getLateMinute() * 60 * 1000));  
245 - * <p>  
246 - * sch.setDfsjAll(dt);  
247 - * sch.setDfAuto(true);  
248 - * //取消应发未到标记  
249 - * sch.setLate2(false);  
250 - * <p>  
251 - * lateSchMaps.remove(sch.getClZbh(), sch);  
252 - * logger.info("【应发未到】车辆到站 " + sch.getClZbh() + " -" + sch.getDfsj() + " -到站时间:" + gps.getTimestamp() + " -停靠时间:" + sch.getLateMinute() + " -自动设置的待发时间:" + dt);  
253 - * } catch (Exception e) {  
254 - * e.printStackTrace();  
255 - * logger.error("late2 car arrive", e);  
256 - * }  
257 - * }  
258 - */  
259 -  
260 @Override 151 @Override
261 public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { 152 public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
262 lineConfigData = applicationContext.getBean(LineConfigData.class); 153 lineConfigData = applicationContext.getBean(LineConfigData.class);
src/main/java/com/bsth/entity/calc/CalcStatistics.java
@@ -6,6 +6,7 @@ import javax.persistence.Entity; @@ -6,6 +6,7 @@ import javax.persistence.Entity;
6 import javax.persistence.GeneratedValue; 6 import javax.persistence.GeneratedValue;
7 import javax.persistence.Id; 7 import javax.persistence.Id;
8 import javax.persistence.Table; 8 import javax.persistence.Table;
  9 +import javax.persistence.Transient;
9 10
10 @Entity 11 @Entity
11 @Table(name = "calc_statistics") 12 @Table(name = "calc_statistics")
@@ -66,6 +67,8 @@ public class CalcStatistics { @@ -66,6 +67,8 @@ public class CalcStatistics {
66 private Double qtlc; 67 private Double qtlc;
67 /* 临加公里*/ 68 /* 临加公里*/
68 private Double ljlc; 69 private Double ljlc;
  70 + /* 临加空驶公里*/
  71 + private Double ljkslc;
69 /* 计划班次*/ 72 /* 计划班次*/
70 private int jhbcq; 73 private int jhbcq;
71 /* 计划班次(早高峰)*/ 74 /* 计划班次(早高峰)*/
@@ -106,8 +109,9 @@ public class CalcStatistics { @@ -106,8 +109,9 @@ public class CalcStatistics {
106 private int djgsj; 109 private int djgsj;
107 /* 备注*/ 110 /* 备注*/
108 private String remark; 111 private String remark;
109 -  
110 - 112 + /*分公司名字*/
  113 + @Transient
  114 + private String fgsName;
111 public Long getId() { 115 public Long getId() {
112 return id; 116 return id;
113 } 117 }
@@ -270,6 +274,12 @@ public class CalcStatistics { @@ -270,6 +274,12 @@ public class CalcStatistics {
270 public void setLjlc(Double ljlc) { 274 public void setLjlc(Double ljlc) {
271 this.ljlc = ljlc; 275 this.ljlc = ljlc;
272 } 276 }
  277 + public Double getLjkslc() {
  278 + return ljkslc;
  279 + }
  280 + public void setLjkslc(Double ljkslc) {
  281 + this.ljkslc = ljkslc;
  282 + }
273 public int getJhbcq() { 283 public int getJhbcq() {
274 return jhbcq; 284 return jhbcq;
275 } 285 }
@@ -390,5 +400,11 @@ public class CalcStatistics { @@ -390,5 +400,11 @@ public class CalcStatistics {
390 public void setRemark(String remark) { 400 public void setRemark(String remark) {
391 this.remark = remark; 401 this.remark = remark;
392 } 402 }
  403 + public String getFgsName() {
  404 + return fgsName;
  405 + }
  406 + public void setFgsName(String fgsName) {
  407 + this.fgsName = fgsName;
  408 + }
393 409
394 } 410 }
src/main/java/com/bsth/entity/mcy_forms/Operationservice.java
@@ -17,6 +17,10 @@ public class Operationservice { @@ -17,6 +17,10 @@ public class Operationservice {
17 private String jname; 17 private String jname;
18 18
19 private String clzbh; 19 private String clzbh;
  20 +
  21 + private String gs;
  22 +
  23 + private String fgs;
20 24
21 public String getJname() { 25 public String getJname() {
22 return jname; 26 return jname;
@@ -89,6 +93,22 @@ public class Operationservice { @@ -89,6 +93,22 @@ public class Operationservice {
89 public void setXlBm(String xlBm) { 93 public void setXlBm(String xlBm) {
90 this.xlBm = xlBm; 94 this.xlBm = xlBm;
91 } 95 }
  96 +
  97 + public String getGs() {
  98 + return gs;
  99 + }
  100 +
  101 + public void setGs(String gs) {
  102 + this.gs = gs;
  103 + }
  104 +
  105 + public String getFgs() {
  106 + return fgs;
  107 + }
  108 +
  109 + public void setFgs(String fgs) {
  110 + this.fgs = fgs;
  111 + }
92 112
93 113
94 } 114 }
src/main/java/com/bsth/entity/sheet/CalcSheet.java 0 → 100644
  1 +package com.bsth.entity.sheet;
  2 +
  3 +import javax.persistence.Entity;
  4 +import javax.persistence.GeneratedValue;
  5 +import javax.persistence.Id;
  6 +import javax.persistence.Table;
  7 +import javax.persistence.Transient;
  8 +
  9 +import com.bsth.data.BasicData;
  10 +
  11 +@Entity
  12 +@Table(name = "bsth_c_calc_sheet")
  13 +public class CalcSheet {
  14 + /* 主键*/
  15 + @Id
  16 + @GeneratedValue
  17 + private Integer id;
  18 + /* 公司代码*/
  19 + private String gsdm;
  20 + /* 分公司代码*/
  21 + private String fgsdm;
  22 + /* 日期字符串*/
  23 + private String date;
  24 + /* 线路编码*/
  25 + private String xl;
  26 + /* 线路名称*/
  27 + private String xlName;
  28 + /*计划首站发车数*/
  29 + private String jhszfcs;
  30 + /*实际首站发车正点数*/
  31 + private String sjszfczds;
  32 + /*首站发车正点率*/
  33 + private String szfczdl;
  34 + /*首站发车到达正点数*/
  35 + private String sjszddzds;
  36 + /*首站发车到达正点率*/
  37 + private String szddzdl;
  38 + /*计划出车数*/
  39 + private String jhcc;
  40 + /*实际出车数*/
  41 + private String sjcc;
  42 + /*早高峰实际出车*/
  43 + private String sjcczgf;
  44 + /*晚高峰实际出车*/
  45 + private String sjccwgf;
  46 + /*计划班次数*/
  47 + private String jhbcs;
  48 + /*实际班次数*/
  49 + private String sjbcs;
  50 + /*临加班次数*/
  51 + private String ljbcs;
  52 + /*公司名字*/
  53 + @Transient
  54 + private String gsname;
  55 + /*分公司名字*/
  56 + @Transient
  57 + private String fgsname;
  58 + public Integer getId() {
  59 + return id;
  60 + }
  61 + public void setId(Integer id) {
  62 + this.id = id;
  63 + }
  64 + public String getGsdm() {
  65 + return gsdm;
  66 + }
  67 + public void setGsdm(String gsdm) {
  68 + this.gsdm = gsdm;
  69 + }
  70 + public String getFgsdm() {
  71 + return fgsdm;
  72 + }
  73 + public void setFgsdm(String fgsdm) {
  74 + this.fgsdm = fgsdm;
  75 + }
  76 + public String getDate() {
  77 + return date;
  78 + }
  79 + public void setDate(String date) {
  80 + this.date = date;
  81 + }
  82 + public String getXl() {
  83 + return xl;
  84 + }
  85 + public void setXl(String xl) {
  86 + this.xl = xl;
  87 + }
  88 + public String getXlName() {
  89 + return xlName;
  90 + }
  91 + public void setXlName(String xlName) {
  92 + this.xlName = xlName;
  93 + }
  94 + public String getJhszfcs() {
  95 + return jhszfcs;
  96 + }
  97 + public void setJhszfcs(String jhszfcs) {
  98 + this.jhszfcs = jhszfcs;
  99 + }
  100 + public String getSjszfczds() {
  101 + return sjszfczds;
  102 + }
  103 + public void setSjszfczds(String sjszfczds) {
  104 + this.sjszfczds = sjszfczds;
  105 + }
  106 + public String getSzfczdl() {
  107 + return szfczdl;
  108 + }
  109 + public void setSzfczdl(String szfczdl) {
  110 + this.szfczdl = szfczdl;
  111 + }
  112 + public String getSjszddzds() {
  113 + return sjszddzds;
  114 + }
  115 + public void setSjszddzds(String sjszddzds) {
  116 + this.sjszddzds = sjszddzds;
  117 + }
  118 + public String getSzddzdl() {
  119 + return szddzdl;
  120 + }
  121 + public void setSzddzdl(String szddzdl) {
  122 + this.szddzdl = szddzdl;
  123 + }
  124 + public String getJhcc() {
  125 + return jhcc;
  126 + }
  127 + public void setJhcc(String jhcc) {
  128 + this.jhcc = jhcc;
  129 + }
  130 + public String getSjcc() {
  131 + return sjcc;
  132 + }
  133 + public void setSjcc(String sjcc) {
  134 + this.sjcc = sjcc;
  135 + }
  136 + public String getSjcczgf() {
  137 + return sjcczgf;
  138 + }
  139 + public void setSjcczgf(String sjcczgf) {
  140 + this.sjcczgf = sjcczgf;
  141 + }
  142 + public String getSjccwgf() {
  143 + return sjccwgf;
  144 + }
  145 + public void setSjccwgf(String sjccwgf) {
  146 + this.sjccwgf = sjccwgf;
  147 + }
  148 + public String getJhbcs() {
  149 + return jhbcs;
  150 + }
  151 + public void setJhbcs(String jhbcs) {
  152 + this.jhbcs = jhbcs;
  153 + }
  154 + public String getSjbcs() {
  155 + return sjbcs;
  156 + }
  157 + public void setSjbcs(String sjbcs) {
  158 + this.sjbcs = sjbcs;
  159 + }
  160 + public String getLjbcs() {
  161 + return ljbcs;
  162 + }
  163 + public void setLjbcs(String ljbcs) {
  164 + this.ljbcs = ljbcs;
  165 + }
  166 +
  167 + public String getGsname() {
  168 + return BasicData.businessCodeNameMap.get(this.gsdm);
  169 + }
  170 +
  171 + public void setGsname(String gsname) {
  172 + this.gsname = gsname;
  173 + }
  174 +
  175 +
  176 + public String getFgsname() {
  177 + return BasicData.businessFgsCodeNameMap.get(this.fgsdm+"_"+this.gsdm);
  178 + }
  179 +
  180 + public void setFgsname(String fgsname) {
  181 + this.fgsname = fgsname;
  182 + }
  183 +}
src/main/java/com/bsth/repository/LsStationRouteRepository.java
1 package com.bsth.repository; 1 package com.bsth.repository;
2 2
3 import java.util.List; 3 import java.util.List;
  4 +import java.util.Map;
4 5
5 import org.springframework.data.jpa.repository.EntityGraph; 6 import org.springframework.data.jpa.repository.EntityGraph;
6 import org.springframework.data.jpa.repository.Modifying; 7 import org.springframework.data.jpa.repository.Modifying;
@@ -52,4 +53,21 @@ public interface LsStationRouteRepository extends BaseRepository&lt;LsStationRoute, @@ -52,4 +53,21 @@ public interface LsStationRouteRepository extends BaseRepository&lt;LsStationRoute,
52 @Modifying 53 @Modifying
53 @Query(value="UPDATE bsth_c_ls_stationroute set destroy = 1 where line = ?1 and directions = ?2 and versions = ?3", nativeQuery=true) 54 @Query(value="UPDATE bsth_c_ls_stationroute set destroy = 1 where line = ?1 and directions = ?2 and versions = ?3", nativeQuery=true)
54 public void batchDestroy(Integer sectionRouteLine, Integer directions, Integer versions); 55 public void batchDestroy(Integer sectionRouteLine, Integer directions, Integer versions);
  56 +
  57 + /**
  58 + * 按线路编码查询各站点的顺序号
  59 + * @param lineCode 线路编码
  60 + * @param lineVersion 版本号
  61 + * @return
  62 + */
  63 + @Query("SELECT new map(" +
  64 + "lineCode as lineCode,directions as directions,stationName as stationName,stationCode as stationCode," +
  65 + "line.linePlayType as linePlayType,s.stationMark as stationMark) " +
  66 + "FROM " +
  67 + "LsStationRoute s " +
  68 + "WHERE " +
  69 + "s.destroy = 0 AND s.lineCode = ?1 AND s.versions = ?2 " +
  70 + "ORDER BY " +
  71 + "lineCode,directions,stationRouteCode")
  72 + List<Map<String, String>> findLineWithLineCode4Ygc(String lineCode,Integer lineVersion);
55 } 73 }
src/main/java/com/bsth/repository/calc/CalcStatisticsRepository.java
@@ -6,8 +6,10 @@ import javax.transaction.Transactional; @@ -6,8 +6,10 @@ import javax.transaction.Transactional;
6 6
7 import com.bsth.entity.calc.CalcStatistics; 7 import com.bsth.entity.calc.CalcStatistics;
8 import com.bsth.entity.calc.CalcWaybill; 8 import com.bsth.entity.calc.CalcWaybill;
  9 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
9 import com.bsth.repository.BaseRepository; 10 import com.bsth.repository.BaseRepository;
10 11
  12 +import org.springframework.data.jpa.repository.EntityGraph;
11 import org.springframework.data.jpa.repository.Modifying; 13 import org.springframework.data.jpa.repository.Modifying;
12 import org.springframework.data.jpa.repository.Query; 14 import org.springframework.data.jpa.repository.Query;
13 import org.springframework.stereotype.Repository; 15 import org.springframework.stereotype.Repository;
@@ -19,11 +21,11 @@ import org.springframework.stereotype.Repository; @@ -19,11 +21,11 @@ import org.springframework.stereotype.Repository;
19 public interface CalcStatisticsRepository extends BaseRepository<CalcStatistics, Integer>{ 21 public interface CalcStatisticsRepository extends BaseRepository<CalcStatistics, Integer>{
20 22
21 //按照时间段统计,公司下线路 23 //按照时间段统计,公司下线路
22 - @Query(value="select DISTINCT c from CalcStatistics c where c.xl like %?1% and c.dateStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% order by c.xl") 24 + @Query(value="select DISTINCT c from CalcStatistics c where c.xl like %?1% and c.dateStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% order by c.fgsdm,c.xl")
23 List<CalcStatistics> selectByDateAndLineTj(String line,String date,String date2,String gsdm,String fgsdm); 25 List<CalcStatistics> selectByDateAndLineTj(String line,String date,String date2,String gsdm,String fgsdm);
24 26
25 //按照时间段统计,单条线路 27 //按照时间段统计,单条线路
26 - @Query(value="select DISTINCT c from CalcStatistics c where c.xl = ?1 and c.dateStr between ?2 and ?3 order by c.xl") 28 + @Query(value="select DISTINCT c from CalcStatistics c where c.xl = ?1 and c.dateStr between ?2 and ?3 order by c.fgsdm,c.xl")
27 List<CalcStatistics> selectByDateAndLineTj2(String line,String date,String date2); 29 List<CalcStatistics> selectByDateAndLineTj2(String line,String date,String date2);
28 30
29 //按照日期和线路删除数据 31 //按照日期和线路删除数据
@@ -38,4 +40,8 @@ public interface CalcStatisticsRepository extends BaseRepository&lt;CalcStatistics, @@ -38,4 +40,8 @@ public interface CalcStatisticsRepository extends BaseRepository&lt;CalcStatistics,
38 @Query(value = "delete CalcStatistics c where c.dateStr=?1") 40 @Query(value = "delete CalcStatistics c where c.dateStr=?1")
39 void deleteByDate(String date); 41 void deleteByDate(String date);
40 42
  43 + //按照时间段查询实际排班(分公司条件不可为空)
  44 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  45 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and s.scheduleDateStr between ?2 and ?3 and gsBm = ?4 and fgsBm = ?5 order by s.fgsBm, s.xlBm")
  46 + List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date,String date2,String gsdm,String fgsdm);
41 } 47 }
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
@@ -105,7 +105,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -105,7 +105,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
105 // List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date,String gsbm,String fgsbm); 105 // List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date,String gsbm,String fgsbm);
106 106
107 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 107 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
108 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 order by s.xlBm,s.clZbh,s.jGh,s.adjustExps,s.fcsj") 108 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 order by s.xlBm,s.clZbh,s.jGh,s.realExecDate,s.fcsj")
109 List<ScheduleRealInfo> scheduleByDateAndLineTjrb(String line,String date); 109 List<ScheduleRealInfo> scheduleByDateAndLineTjrb(String line,String date);
110 110
111 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 111 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
@@ -170,7 +170,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -170,7 +170,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
170 List<ScheduleRealInfo> scheduleByDateAndLineQp2(String line,String date); 170 List<ScheduleRealInfo> scheduleByDateAndLineQp2(String line,String date);
171 171
172 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 172 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
173 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 and s.bcType not in ('in','out','ldks') order by s.xlBm,s.adjustExps,s.fcsj") 173 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 and s.bcType not in ('in','out','ldks') order by s.xlBm,s.realExecDate,s.fcsj")
174 List<ScheduleRealInfo> scheduleByDateAndLine2(String line,String date); 174 List<ScheduleRealInfo> scheduleByDateAndLine2(String line,String date);
175 175
176 //按月统计 176 //按月统计
@@ -180,12 +180,12 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -180,12 +180,12 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
180 180
181 //按照时间段统计 181 //按照时间段统计
182 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 182 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
183 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and s.scheduleDateStr between ?2 and ?3 and gsBm = ?4 and fgsBm = ?5 order by s.xlBm") 183 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and s.scheduleDateStr between ?2 and ?3 and gsBm = ?4 and fgsBm like %?5% order by s.fgsBm, s.xlBm")
184 List<ScheduleRealInfo> scheduleByDateAndLineTj(String line,String date,String date2,String gsdm,String fgsdm); 184 List<ScheduleRealInfo> scheduleByDateAndLineTj(String line,String date,String date2,String gsdm,String fgsdm);
185 185
186 //按照时间段统计 186 //按照时间段统计
187 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 187 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
188 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr >= ?2 and s.scheduleDateStr<= ?3 order by s.xlBm") 188 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr >= ?2 and s.scheduleDateStr<= ?3 order by s.fgsBm,s.xlBm")
189 List<ScheduleRealInfo> scheduleByDateAndLineTj2(String line,String date,String date2); 189 List<ScheduleRealInfo> scheduleByDateAndLineTj2(String line,String date,String date2);
190 //月报表 190 //月报表
191 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) 191 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
src/main/java/com/bsth/repository/sheet/CalcSheetRepository.java 0 → 100644
  1 +package com.bsth.repository.sheet;
  2 +
  3 +import com.bsth.entity.sheet.CalcSheet;
  4 +import com.bsth.repository.BaseRepository;
  5 +
  6 +import org.springframework.stereotype.Repository;
  7 +
  8 +/**
  9 + *
  10 + */
  11 +@Repository
  12 +public interface CalcSheetRepository extends BaseRepository<CalcSheet, Integer>{
  13 +
  14 +}
src/main/java/com/bsth/service/LineService.java
@@ -37,4 +37,6 @@ public interface LineService extends BaseService&lt;Line, Integer&gt; { @@ -37,4 +37,6 @@ public interface LineService extends BaseService&lt;Line, Integer&gt; {
37 Map<String, Object> update(Line l); 37 Map<String, Object> update(Line l);
38 38
39 Map<String,Object> remove(Integer id); 39 Map<String,Object> remove(Integer id);
  40 +
  41 + Map<String, Boolean> lineNature();
40 } 42 }
src/main/java/com/bsth/service/calc/CalcWaybillService.java
@@ -30,9 +30,9 @@ public interface CalcWaybillService extends BaseService&lt;CalcWaybill, Integer&gt; { @@ -30,9 +30,9 @@ public interface CalcWaybillService extends BaseService&lt;CalcWaybill, Integer&gt; {
30 */ 30 */
31 String calcDaily(String rq, String line) throws Exception; 31 String calcDaily(String rq, String line) throws Exception;
32 32
33 - List<CalcStatistics> calcStatisticsDaily(String gsdm,String fgsdm, String line, String date, String date2, String xlName, String type); 33 + List<CalcStatistics> calcStatisticsDaily(String gsdm,String fgsdm, String line, String date, String date2, String xlName, String type,String nature);
34 34
35 - List<Map<String, Object>> calcStatisticsDaily2(String gsdm,String fgsdm, String line, String date, String date2, String xlName, String type); 35 + List<Map<String, Object>> calcStatisticsDaily2(String gsdm,String fgsdm, String line, String date, String date2, String xlName, String type,String nature);
36 36
37 Map<String, Object> calcLineMileage(String date, String line); 37 Map<String, Object> calcLineMileage(String date, String line);
38 38
src/main/java/com/bsth/service/calc/impl/CalcWaybillServiceImpl.java
@@ -20,6 +20,7 @@ import java.util.Set; @@ -20,6 +20,7 @@ import java.util.Set;
20 import javax.transaction.Transactional; 20 import javax.transaction.Transactional;
21 21
22 import com.bsth.common.ResponseCode; 22 import com.bsth.common.ResponseCode;
  23 +import com.bsth.data.BasicData;
23 import com.bsth.entity.Line; 24 import com.bsth.entity.Line;
24 import com.bsth.entity.calc.CalcBusMileage; 25 import com.bsth.entity.calc.CalcBusMileage;
25 import com.bsth.entity.calc.CalcInterval; 26 import com.bsth.entity.calc.CalcInterval;
@@ -36,6 +37,7 @@ import com.bsth.repository.calc.CalcLineMileageRepository; @@ -36,6 +37,7 @@ import com.bsth.repository.calc.CalcLineMileageRepository;
36 import com.bsth.repository.calc.CalcStatisticsRepository; 37 import com.bsth.repository.calc.CalcStatisticsRepository;
37 import com.bsth.repository.calc.CalcWaybillRepository; 38 import com.bsth.repository.calc.CalcWaybillRepository;
38 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; 39 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
  40 +import com.bsth.service.LineService;
39 import com.bsth.service.calc.CalcToolService; 41 import com.bsth.service.calc.CalcToolService;
40 import com.bsth.service.calc.CalcWaybillService; 42 import com.bsth.service.calc.CalcWaybillService;
41 import com.bsth.service.impl.BaseServiceImpl; 43 import com.bsth.service.impl.BaseServiceImpl;
@@ -91,7 +93,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -91,7 +93,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
91 93
92 @Autowired 94 @Autowired
93 private LineRepository lineRepository; 95 private LineRepository lineRepository;
94 - 96 + @Autowired
  97 + private LineService lineService;
95 @Autowired 98 @Autowired
96 private ReportService reportService; 99 private ReportService reportService;
97 100
@@ -550,7 +553,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -550,7 +553,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
550 553
551 //查询所有线路 554 //查询所有线路
552 for(Map<String, String> m : gsList){ 555 for(Map<String, String> m : gsList){
553 - list.addAll(scheduleRealInfoRepository.scheduleByDateAndLineTj(line, rq, rq, m.get("gsdm"), m.get("fgsdm"))); 556 + list.addAll(calcStatisticsRepository.scheduleByDateAndLine(line, rq, rq, m.get("gsdm"), m.get("fgsdm")));
554 } 557 }
555 558
556 for (int i = 0; i < list.size(); i++) { 559 for (int i = 0; i < list.size(); i++) {
@@ -641,6 +644,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -641,6 +644,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
641 double sjyygl= culateService.culateSjgl(lists); 644 double sjyygl= culateService.culateSjgl(lists);
642 double zyygl= Arith.add(sjyygl,ljgl); 645 double zyygl= Arith.add(sjyygl,ljgl);
643 646
  647 + double ljksgl= culateService.culateLjksgl(lists);
644 double sjjccgl=culateService.culateJccgl(lists); 648 double sjjccgl=culateService.culateJccgl(lists);
645 double sjksgl=culateService.culateKsgl(lists); 649 double sjksgl=culateService.culateKsgl(lists);
646 double zksgl=Arith.add(sjjccgl, sjksgl); 650 double zksgl=Arith.add(sjjccgl, sjksgl);
@@ -648,6 +652,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -648,6 +652,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
648 s.setSjkslc(zksgl); 652 s.setSjkslc(zksgl);
649 s.setSjzlc(Arith.add(zyygl, zksgl)); 653 s.setSjzlc(Arith.add(zyygl, zksgl));
650 654
  655 + s.setLjkslc(ljksgl);
  656 +
651 s.setSslc(culateService.culateLbgl(list)); 657 s.setSslc(culateService.culateLbgl(list));
652 s.setSsbc(culateService.culateLbbc(list)); 658 s.setSsbc(culateService.culateLbbc(list));
653 659
@@ -733,28 +739,51 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -733,28 +739,51 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
733 739
734 @Override 740 @Override
735 public List<CalcStatistics> calcStatisticsDaily(String gsdm, String fgsdm, 741 public List<CalcStatistics> calcStatisticsDaily(String gsdm, String fgsdm,
736 - String line, String date, String date2, String xlName, String type) { 742 + String line, String date, String date2, String xlName, String type,String nature) {
737 // TODO Auto-generated method stub 743 // TODO Auto-generated method stub
738 - List<CalcStatistics> list = new ArrayList<CalcStatistics>(); 744 + List<CalcStatistics> listAll = new ArrayList<CalcStatistics>();
739 if(line.length() > 0){ 745 if(line.length() > 0){
740 - list = calcStatisticsRepository.selectByDateAndLineTj2(line, date, date2); 746 + listAll = calcStatisticsRepository.selectByDateAndLineTj2(line, date, date2);
741 } else { 747 } else {
742 - list = calcStatisticsRepository.selectByDateAndLineTj(line, date, date2, gsdm, fgsdm); 748 + listAll = calcStatisticsRepository.selectByDateAndLineTj(line, date, date2, gsdm, fgsdm);
  749 + }
  750 + Map<String, Boolean> lineMap=lineService.lineNature();
  751 + List<CalcStatistics> list = new ArrayList<CalcStatistics>();
  752 + if(nature.equals("0")){
  753 + list=listAll;
  754 + }else{
  755 + for (int i = 0; i < listAll.size(); i++) {
  756 + CalcStatistics c=listAll.get(i);
  757 + if(nature.equals("1")){
  758 + if(lineMap.get(c.getXl())){
  759 + list.add(c);
  760 + }
  761 + }else{
  762 + if(!lineMap.get(c.getXl())){
  763 + list.add(c);
  764 + }
  765 + }
  766 + }
743 } 767 }
744 -  
745 List<CalcStatistics> resList = new ArrayList<CalcStatistics>(); 768 List<CalcStatistics> resList = new ArrayList<CalcStatistics>();
746 Map<String, List<CalcStatistics>> keyMap = new HashMap<String, List<CalcStatistics>>(); 769 Map<String, List<CalcStatistics>> keyMap = new HashMap<String, List<CalcStatistics>>();
747 List<String> keyList = new ArrayList<String>(); 770 List<String> keyList = new ArrayList<String>();
748 771
749 for(CalcStatistics s : list){ 772 for(CalcStatistics s : list){
750 try { 773 try {
751 - String key = PinyinHelper.convertToPinyinString(s.getXlName(), "" , PinyinFormat.WITHOUT_TONE);  
752 - if(!keyMap.containsKey(key)){ 774 +// String key = PinyinHelper.convertToPinyinString(s.getXl(), "" , PinyinFormat.WITHOUT_TONE);
  775 + String key =s.getFgsdm()+s.getXl();
  776 +// if(line.equals("")){
  777 +// key =s.getFgsdm()+s.getXl();
  778 +// }else{
  779 +// key =s.getXl();
  780 +// }
  781 + if(!keyMap.containsKey(key)){
753 keyMap.put(key, new ArrayList<CalcStatistics>()); 782 keyMap.put(key, new ArrayList<CalcStatistics>());
754 keyList.add(key); 783 keyList.add(key);
755 } 784 }
756 keyMap.get(key).add(s); 785 keyMap.get(key).add(s);
757 - } catch (PinyinException e) { 786 + } catch (Exception e) {
758 // TODO Auto-generated catch block 787 // TODO Auto-generated catch block
759 e.printStackTrace(); 788 e.printStackTrace();
760 } 789 }
@@ -769,6 +798,13 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -769,6 +798,13 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
769 CalcStatistics s_ = keyMap.get(key).get(i); 798 CalcStatistics s_ = keyMap.get(key).get(i);
770 s = addStatistics(s, s_); 799 s = addStatistics(s, s_);
771 } 800 }
  801 +// if(line.equals("")){
  802 + s.setFgsName(BasicData.businessFgsCodeNameMap.get(s.getFgsdm()+"_"+s.getGsdm()));
  803 + /*}else{
  804 + List<Line> l=lineRepository.findLineByCode(line);
  805 + if(l.size()>0)
  806 + s.setFgsName(BasicData.businessFgsCodeNameMap.get(l.get(0).getBrancheCompany()+"_"+l.get(0).getCompany()));
  807 + }*/
772 resList.add(s); 808 resList.add(s);
773 } 809 }
774 } 810 }
@@ -776,6 +812,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -776,6 +812,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
776 if(resList.size() > 0){ 812 if(resList.size() > 0){
777 CalcStatistics temp = new CalcStatistics(); 813 CalcStatistics temp = new CalcStatistics();
778 temp.setXlName("合计"); 814 temp.setXlName("合计");
  815 + temp.setFgsName("");
779 for(CalcStatistics s : resList){ 816 for(CalcStatistics s : resList){
780 temp = addStatistics(temp, s); 817 temp = addStatistics(temp, s);
781 } 818 }
@@ -785,6 +822,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -785,6 +822,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
785 List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>(); 822 List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
786 for(CalcStatistics c : resList){ 823 for(CalcStatistics c : resList){
787 Map<String, Object> m = new HashMap<String, Object>(); 824 Map<String, Object> m = new HashMap<String, Object>();
  825 + m.put("fgsName", c.getFgsName());
788 m.put("xlName", c.getXlName()); 826 m.put("xlName", c.getXlName());
789 m.put("jhzlc", c.getJhzlc()); 827 m.put("jhzlc", c.getJhzlc());
790 m.put("jhlc", c.getJhyylc()); 828 m.put("jhlc", c.getJhyylc());
@@ -806,6 +844,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -806,6 +844,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
806 m.put("ssgl_yw", c.getYwlc()); 844 m.put("ssgl_yw", c.getYwlc());
807 m.put("ssgl_other", c.getQtlc()); 845 m.put("ssgl_other", c.getQtlc());
808 m.put("ljgl", c.getLjlc()); 846 m.put("ljgl", c.getLjlc());
  847 + m.put("ljks", c.getLjkslc());
809 m.put("jhbc", c.getJhbcq()); 848 m.put("jhbc", c.getJhbcq());
810 m.put("jhbc_m", c.getJhbcz()); 849 m.put("jhbc_m", c.getJhbcz());
811 m.put("jhbc_a", c.getJhbcw()); 850 m.put("jhbc_a", c.getJhbcw());
@@ -859,7 +898,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -859,7 +898,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
859 898
860 @Override 899 @Override
861 public List<Map<String, Object>> calcStatisticsDaily2(String gsdm, String fgsdm, 900 public List<Map<String, Object>> calcStatisticsDaily2(String gsdm, String fgsdm,
862 - String line, String date, String date2, String xlName, String type) { 901 + String line, String date, String date2, String xlName, String type,String nature) {
863 // TODO Auto-generated method stub 902 // TODO Auto-generated method stub
864 SimpleDateFormat dft = new SimpleDateFormat("yyyy-MM-dd"); 903 SimpleDateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
865 Date beginDate = new Date(); 904 Date beginDate = new Date();
@@ -899,26 +938,48 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -899,26 +938,48 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
899 } 938 }
900 939
901 940
902 - List<CalcStatistics> list = new ArrayList<CalcStatistics>(); 941 + List<CalcStatistics> listAll = new ArrayList<CalcStatistics>();
903 if(line.length() > 0){ 942 if(line.length() > 0){
904 - list = calcStatisticsRepository.selectByDateAndLineTj2(line, d1, d2); 943 + listAll = calcStatisticsRepository.selectByDateAndLineTj2(line, d1, d2);
905 } else { 944 } else {
906 - list = calcStatisticsRepository.selectByDateAndLineTj(line, d1, d2, gsdm, fgsdm); 945 + listAll = calcStatisticsRepository.selectByDateAndLineTj(line, d1, d2, gsdm, fgsdm);
907 } 946 }
  947 + Map<String, Boolean> lineMap=lineService.lineNature();
  948 + List<CalcStatistics> list=new ArrayList<CalcStatistics>();
908 949
  950 + for (int i = 0; i < listAll.size(); i++) {
  951 + CalcStatistics s=listAll.get(i);
  952 + if(nature.equals("0")){
  953 + list.add(s);
  954 + }else if(nature.equals("1")){
  955 + if(lineMap.containsKey(s.getXl()) && lineMap.get(s.getXl())){
  956 + list.add(s);
  957 + }
  958 + }else{
  959 + if(lineMap.containsKey(s.getXl()) && !lineMap.get(s.getXl())){
  960 + list.add(s);
  961 + }
  962 + }
  963 + }
909 List<CalcStatistics> resList = new ArrayList<CalcStatistics>(); 964 List<CalcStatistics> resList = new ArrayList<CalcStatistics>();
910 Map<String, List<CalcStatistics>> keyMap = new HashMap<String, List<CalcStatistics>>(); 965 Map<String, List<CalcStatistics>> keyMap = new HashMap<String, List<CalcStatistics>>();
911 List<String> keyList = new ArrayList<String>(); 966 List<String> keyList = new ArrayList<String>();
912 967
913 for(CalcStatistics s : list){ 968 for(CalcStatistics s : list){
914 try { 969 try {
915 - String key = PinyinHelper.convertToPinyinString(s.getXlName(), "" , PinyinFormat.WITHOUT_TONE);  
916 - if(!keyMap.containsKey(key)){ 970 +// String key = PinyinHelper.convertToPinyinString(s.getXlName(), "" , PinyinFormat.WITHOUT_TONE);
  971 + String key =s.getFgsdm()+s.getXl();
  972 +// if(line.equals("")){
  973 +// key =s.getFgsdm()+s.getXl();
  974 +// }else{
  975 +// key =s.getXl();
  976 +// }
  977 + if(!keyMap.containsKey(key)){
917 keyMap.put(key, new ArrayList<CalcStatistics>()); 978 keyMap.put(key, new ArrayList<CalcStatistics>());
918 keyList.add(key); 979 keyList.add(key);
919 } 980 }
920 keyMap.get(key).add(s); 981 keyMap.get(key).add(s);
921 - } catch (PinyinException e) { 982 + } catch (Exception e) {
922 // TODO Auto-generated catch block 983 // TODO Auto-generated catch block
923 e.printStackTrace(); 984 e.printStackTrace();
924 } 985 }
@@ -950,6 +1011,13 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -950,6 +1011,13 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
950 List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>(); 1011 List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
951 for(CalcStatistics c : resList){ 1012 for(CalcStatistics c : resList){
952 Map<String, Object> m = new HashMap<String, Object>(); 1013 Map<String, Object> m = new HashMap<String, Object>();
  1014 + if(c.getXl().equals("hj")){
  1015 + m.put("fgsName", "");
  1016 + m.put("fgsBm", "");
  1017 + }else{
  1018 + m.put("fgsName", BasicData.businessFgsCodeNameMap.get(c.getFgsdm()+"_"+c.getGsdm()));
  1019 + m.put("fgsBm", c.getFgsdm());
  1020 + }
953 m.put("xlBm", c.getXl()); 1021 m.put("xlBm", c.getXl());
954 m.put("xlName", c.getXlName()); 1022 m.put("xlName", c.getXlName());
955 m.put("jhzlc", c.getJhzlc()); 1023 m.put("jhzlc", c.getJhzlc());
@@ -972,6 +1040,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -972,6 +1040,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
972 m.put("ssgl_yw", c.getYwlc()); 1040 m.put("ssgl_yw", c.getYwlc());
973 m.put("ssgl_other", c.getQtlc()); 1041 m.put("ssgl_other", c.getQtlc());
974 m.put("ljgl", c.getLjlc()); 1042 m.put("ljgl", c.getLjlc());
  1043 + m.put("ljks", c.getLjkslc());
975 m.put("jhbc", c.getJhbcq()); 1044 m.put("jhbc", c.getJhbcq());
976 m.put("jhbc_m", c.getJhbcz()); 1045 m.put("jhbc_m", c.getJhbcz());
977 m.put("jhbc_a", c.getJhbcw()); 1046 m.put("jhbc_a", c.getJhbcw());
@@ -1003,7 +1072,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -1003,7 +1072,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1003 //实时数据 1072 //实时数据
1004 List<Map<String, Object>> tjlist=new ArrayList<Map<String, Object>>(); 1073 List<Map<String, Object>> tjlist=new ArrayList<Map<String, Object>>();
1005 if(!d4.equals("")){ 1074 if(!d4.equals("")){
1006 - tjlist= scheduleRealInfoService.statisticsDailyTjHb(gsdm, fgsdm, line, d3, d4, xlName, type); 1075 + tjlist= scheduleRealInfoService.statisticsDailyTjHb(gsdm, fgsdm, line, d3, d4, xlName, type,nature);
1007 } 1076 }
1008 List<Map<String, Object>> mapListHj = new ArrayList<Map<String, Object>>(); 1077 List<Map<String, Object>> mapListHj = new ArrayList<Map<String, Object>>();
1009 // List<String> lineList=new ArrayList<String>(); 1078 // List<String> lineList=new ArrayList<String>();
@@ -1011,24 +1080,37 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -1011,24 +1080,37 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1011 mapList.addAll(tjlist); 1080 mapList.addAll(tjlist);
1012 for (int i = 0; i < mapList.size(); i++) { 1081 for (int i = 0; i < mapList.size(); i++) {
1013 Map<String, Object> m =mapList.get(i); 1082 Map<String, Object> m =mapList.get(i);
1014 - if(kMap.get(m.get("xlBm").toString())==null){  
1015 - kMap.put(m.get("xlBm").toString(), m.get("xlBm").toString());  
1016 - } 1083 +// if(line.equals("")){
  1084 + if(kMap.get(m.get("fgsBm")+"_"+m.get("xlBm").toString())==null){
  1085 + kMap.put(m.get("fgsBm")+"_"+m.get("xlBm").toString(), m.get("fgsBm")+"_"+m.get("xlBm").toString());
  1086 + }
  1087 +// }else{
  1088 +// if(kMap.get(m.get("xlBm").toString())==null){
  1089 +// kMap.put(m.get("xlBm").toString(), m.get("xlBm").toString());
  1090 +// }
  1091 +// }
  1092 +
1017 } 1093 }
1018 for (Object xlbm : kMap.keySet()) { 1094 for (Object xlbm : kMap.keySet()) {
1019 Map<String, Object> hjMap = new HashMap<String, Object>(); 1095 Map<String, Object> hjMap = new HashMap<String, Object>();
1020 for (int i = 0; i < mapList.size(); i++) { 1096 for (int i = 0; i < mapList.size(); i++) {
1021 Map<String, Object> lsMap=mapList.get(i); 1097 Map<String, Object> lsMap=mapList.get(i);
1022 - if (lsMap.get("xlBm").toString().equals(xlbm)) { 1098 + String xlbm_="";
  1099 +// if(line.equals("")){
  1100 + xlbm_=lsMap.get("fgsBm").toString()+"_"+lsMap.get("xlBm").toString();
  1101 +// }else{
  1102 +// xlbm_=lsMap.get("xlBm").toString();
  1103 +// }
  1104 + if (xlbm_.equals(xlbm)) {
1023 if(hjMap.get("xlBm")==null){ 1105 if(hjMap.get("xlBm")==null){
1024 hjMap.put("xlBm", lsMap.get("xlBm")); 1106 hjMap.put("xlBm", lsMap.get("xlBm"));
1025 hjMap.put("xlName", lsMap.get("xlName")); 1107 hjMap.put("xlName", lsMap.get("xlName"));
  1108 + hjMap.put("fgsName", lsMap.get("fgsName"));
1026 try { 1109 try {
1027 if(lsMap.get("xlBm").toString().equals("hj")){ 1110 if(lsMap.get("xlBm").toString().equals("hj")){
1028 hjMap.put("xlNamePy", "zzzzz"); 1111 hjMap.put("xlNamePy", "zzzzz");
1029 -  
1030 }else{ 1112 }else{
1031 - hjMap.put("xlNamePy", PinyinHelper.convertToPinyinString(lsMap.get("xlName").toString(), "", PinyinFormat.WITHOUT_TONE)); 1113 + hjMap.put("xlNamePy", PinyinHelper.convertToPinyinString(lsMap.get("fgsBm").toString()+lsMap.get("xlName").toString(), "", PinyinFormat.WITHOUT_TONE));
1032 } 1114 }
1033 } catch (PinyinException e) { 1115 } catch (PinyinException e) {
1034 // TODO Auto-generated catch block 1116 // TODO Auto-generated catch block
@@ -1055,6 +1137,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -1055,6 +1137,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1055 hjMap.put("ssgl_yw", Arith.add(lsMap.get("ssgl_yw"), hjMap.get("ssgl_yw")==null?"0":hjMap.get("ssgl_yw"))); 1137 hjMap.put("ssgl_yw", Arith.add(lsMap.get("ssgl_yw"), hjMap.get("ssgl_yw")==null?"0":hjMap.get("ssgl_yw")));
1056 hjMap.put("ssgl_other", Arith.add(lsMap.get("ssgl_other"), hjMap.get("ssgl_other")==null?"0":hjMap.get("ssgl_other"))); 1138 hjMap.put("ssgl_other", Arith.add(lsMap.get("ssgl_other"), hjMap.get("ssgl_other")==null?"0":hjMap.get("ssgl_other")));
1057 hjMap.put("ljgl", Arith.add(lsMap.get("ljgl"), hjMap.get("ljgl")==null?"0":hjMap.get("ljgl"))); 1139 hjMap.put("ljgl", Arith.add(lsMap.get("ljgl"), hjMap.get("ljgl")==null?"0":hjMap.get("ljgl")));
  1140 + hjMap.put("ljks", Arith.add(lsMap.get("ljks"), hjMap.get("ljks")==null?"0":hjMap.get("ljks")));
1058 hjMap.put("jhbc", Integer.parseInt(lsMap.get("jhbc").toString())+ Integer.parseInt(hjMap.get("jhbc")==null?"0":hjMap.get("jhbc").toString())); 1141 hjMap.put("jhbc", Integer.parseInt(lsMap.get("jhbc").toString())+ Integer.parseInt(hjMap.get("jhbc")==null?"0":hjMap.get("jhbc").toString()));
1059 hjMap.put("jhbc_m", Integer.parseInt(lsMap.get("jhbc_m").toString())+Integer.parseInt(hjMap.get("jhbc_m")==null?"0":hjMap.get("jhbc_m").toString())); 1142 hjMap.put("jhbc_m", Integer.parseInt(lsMap.get("jhbc_m").toString())+Integer.parseInt(hjMap.get("jhbc_m")==null?"0":hjMap.get("jhbc_m").toString()));
1060 hjMap.put("jhbc_a", Integer.parseInt(lsMap.get("jhbc_a").toString())+ Integer.parseInt(hjMap.get("jhbc_a")==null?"0":hjMap.get("jhbc_a").toString())); 1143 hjMap.put("jhbc_a", Integer.parseInt(lsMap.get("jhbc_a").toString())+ Integer.parseInt(hjMap.get("jhbc_a")==null?"0":hjMap.get("jhbc_a").toString()));
@@ -1082,8 +1165,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -1082,8 +1165,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1082 hjMap.put("djg_time",hjMap.get("djg_time")); 1165 hjMap.put("djg_time",hjMap.get("djg_time"));
1083 } 1166 }
1084 } 1167 }
1085 -  
1086 -  
1087 double jl = Arith.sub(Arith.add(hjMap.get("jhlc"), hjMap.get("ljgl")), hjMap.get("ssgl")); 1168 double jl = Arith.sub(Arith.add(hjMap.get("jhlc"), hjMap.get("ljgl")), hjMap.get("ssgl"));
1088 if (jl == Double.parseDouble(hjMap.get("sjgl").toString())) { 1169 if (jl == Double.parseDouble(hjMap.get("sjgl").toString())) {
1089 hjMap.put("zt", 0); 1170 hjMap.put("zt", 0);
@@ -1097,7 +1178,15 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -1097,7 +1178,15 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1097 1178
1098 Collections.sort(mapListHj, new AccountXlbmByping()); 1179 Collections.sort(mapListHj, new AccountXlbmByping());
1099 1180
1100 - 1181 + /*if(!line.equals("")){
  1182 + for (int i = 0; i < mapListHj.size(); i++) {
  1183 + if(mapListHj.get(i).get("xlBm").equals(line)){
  1184 + List<Line> l=lineRepository.findLineByCode(line);
  1185 + if(l.size()>0)
  1186 + mapListHj.get(i).put("fgsName", BasicData.businessFgsCodeNameMap.get(l.get(0).getBrancheCompany()+"_"+l.get(0).getCompany()));
  1187 + }
  1188 + }
  1189 + }*/
1101 if (type != null && type.length() != 0 && type.equals("export")) { 1190 if (type != null && type.length() != 0 && type.equals("export")) {
1102 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), 1191 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
1103 sdfSimple = new SimpleDateFormat("yyyyMMdd"); 1192 sdfSimple = new SimpleDateFormat("yyyyMMdd");
@@ -1115,7 +1204,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -1115,7 +1204,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1115 } 1204 }
1116 listI.add(mapListHj.iterator()); 1205 listI.add(mapListHj.iterator());
1117 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; 1206 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
1118 - ee.excelReplace(listI, new Object[]{m}, path + "mould/statisticsDaily_.xls", 1207 + ee.excelReplace(listI, new Object[]{m}, path + "mould/statisticsDaily_2.xls",
1119 path + "export/" + dateTime + "-" + xlName + "-统计日报.xls"); 1208 path + "export/" + dateTime + "-" + xlName + "-统计日报.xls");
1120 } catch (Exception e) { 1209 } catch (Exception e) {
1121 // TODO: handle exception 1210 // TODO: handle exception
@@ -1148,6 +1237,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -1148,6 +1237,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1148 s.setYwlc(Arith.add(s.getYwlc()!=null?s.getYwlc():0, s_.getYwlc())); 1237 s.setYwlc(Arith.add(s.getYwlc()!=null?s.getYwlc():0, s_.getYwlc()));
1149 s.setQtlc(Arith.add(s.getQtlc()!=null?s.getQtlc():0, s_.getQtlc())); 1238 s.setQtlc(Arith.add(s.getQtlc()!=null?s.getQtlc():0, s_.getQtlc()));
1150 s.setLjlc(Arith.add(s.getLjlc()!=null?s.getLjlc():0, s_.getLjlc())); 1239 s.setLjlc(Arith.add(s.getLjlc()!=null?s.getLjlc():0, s_.getLjlc()));
  1240 + s.setLjkslc(Arith.add(s.getLjkslc()!=null?s.getLjkslc():0, s_.getLjkslc()));
1151 s.setJhbcq(s.getJhbcq() + s_.getJhbcq()); 1241 s.setJhbcq(s.getJhbcq() + s_.getJhbcq());
1152 s.setJhbcz(s.getJhbcz() + s_.getJhbcz()); 1242 s.setJhbcz(s.getJhbcz() + s_.getJhbcz());
1153 s.setJhbcw(s.getJhbcw() + s_.getJhbcw()); 1243 s.setJhbcw(s.getJhbcw() + s_.getJhbcw());
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
@@ -28,7 +28,6 @@ import com.bsth.entity.mcy_forms.Operationservice; @@ -28,7 +28,6 @@ import com.bsth.entity.mcy_forms.Operationservice;
28 import com.bsth.entity.mcy_forms.Shifday; 28 import com.bsth.entity.mcy_forms.Shifday;
29 import com.bsth.entity.mcy_forms.Shiftuehiclemanth; 29 import com.bsth.entity.mcy_forms.Shiftuehiclemanth;
30 import com.bsth.entity.mcy_forms.Singledata; 30 import com.bsth.entity.mcy_forms.Singledata;
31 -import com.bsth.entity.mcy_forms.Turnoutrate;  
32 import com.bsth.entity.mcy_forms.Vehicleloading; 31 import com.bsth.entity.mcy_forms.Vehicleloading;
33 import com.bsth.entity.mcy_forms.Waybillday; 32 import com.bsth.entity.mcy_forms.Waybillday;
34 import com.bsth.entity.oil.Dlb; 33 import com.bsth.entity.oil.Dlb;
@@ -45,6 +44,7 @@ import com.bsth.entity.mcy_forms.Allline; @@ -45,6 +44,7 @@ import com.bsth.entity.mcy_forms.Allline;
45 import com.bsth.entity.mcy_forms.Changetochange; 44 import com.bsth.entity.mcy_forms.Changetochange;
46 import com.bsth.entity.mcy_forms.Daily; 45 import com.bsth.entity.mcy_forms.Daily;
47 import com.bsth.entity.mcy_forms.Executionrate; 46 import com.bsth.entity.mcy_forms.Executionrate;
  47 +import com.bsth.service.LineService;
48 import com.bsth.service.forms.CommonService; 48 import com.bsth.service.forms.CommonService;
49 import com.bsth.service.forms.FormsService; 49 import com.bsth.service.forms.FormsService;
50 import com.bsth.service.realcontrol.ScheduleRealInfoService; 50 import com.bsth.service.realcontrol.ScheduleRealInfoService;
@@ -61,6 +61,9 @@ public class FormsServiceImpl implements FormsService { @@ -61,6 +61,9 @@ public class FormsServiceImpl implements FormsService {
61 ScheduleRealInfoService scheduleRealInfoService; 61 ScheduleRealInfoService scheduleRealInfoService;
62 62
63 @Autowired 63 @Autowired
  64 + LineService lineService;
  65 +
  66 + @Autowired
64 CommonService commonService; 67 CommonService commonService;
65 68
66 @Autowired 69 @Autowired
@@ -214,11 +217,11 @@ public class FormsServiceImpl implements FormsService { @@ -214,11 +217,11 @@ public class FormsServiceImpl implements FormsService {
214 sql+=" and l.line_code=" + map.get("line").toString(); 217 sql+=" and l.line_code=" + map.get("line").toString();
215 } 218 }
216 sql+= " AND r.gs_bm is not null"; 219 sql+= " AND r.gs_bm is not null";
217 - if(map.get("gsdmLine").toString()!=""){ 220 + if(map.get("gsdmLine") != null && map.get("gsdmLine").toString()!=""){
218 sql+=" and r.gs_bm='"+map.get("gsdmLine").toString()+"' "; 221 sql+=" and r.gs_bm='"+map.get("gsdmLine").toString()+"' ";
219 } 222 }
220 - if(map.get("fgsdmLine").toString()!=""){  
221 - sql+=" and r.fgs_bm='"+map.get("fgsdmLine").toString()+"'"; 223 + if(map.get("fgsdmLine") != null && map.get("fgsdmLine").toString()!=""){
  224 + sql+=" and r.fgs_bm='"+map.get("fgsdmLine").toString()+"' ";
222 } 225 }
223 sql += " GROUP BY s.station_name,l.name,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "; 226 sql += " GROUP BY s.station_name,l.name,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name ";
224 List<Linepasswengerflow> list = jdbcTemplate.query(sql, new RowMapper<Linepasswengerflow>() { 227 List<Linepasswengerflow> list = jdbcTemplate.query(sql, new RowMapper<Linepasswengerflow>() {
@@ -244,10 +247,10 @@ public class FormsServiceImpl implements FormsService { @@ -244,10 +247,10 @@ public class FormsServiceImpl implements FormsService {
244 final String empnames=map.get("empnames").toString(); 247 final String empnames=map.get("empnames").toString();
245 String gsdmManth=""; 248 String gsdmManth="";
246 String fgsdmManth=""; 249 String fgsdmManth="";
247 - if(map.containsKey("gsdmManth")){ 250 + if(map.get("gsdmManth") != null){
248 gsdmManth=map.get("gsdmManth").toString(); 251 gsdmManth=map.get("gsdmManth").toString();
249 } 252 }
250 - if(map.containsKey("fgsdmManth")){ 253 + if(map.get("fgsdmManth") != null){
251 fgsdmManth=map.get("fgsdmManth").toString(); 254 fgsdmManth=map.get("fgsdmManth").toString();
252 } 255 }
253 String sql ="select "; 256 String sql ="select ";
@@ -410,10 +413,10 @@ public class FormsServiceImpl implements FormsService { @@ -410,10 +413,10 @@ public class FormsServiceImpl implements FormsService {
410 final String empnames=map.get("empnames").toString(); 413 final String empnames=map.get("empnames").toString();
411 String gsdmManth=""; 414 String gsdmManth="";
412 String fgsdmManth=""; 415 String fgsdmManth="";
413 - if(map.containsKey("gsdmManth")){ 416 + if(map.get("gsdmManth")!=null){
414 gsdmManth=map.get("gsdmManth").toString(); 417 gsdmManth=map.get("gsdmManth").toString();
415 } 418 }
416 - if(map.containsKey("fgsdmManth")){ 419 + if(map.get("fgsdmManth")!=null){
417 fgsdmManth=map.get("fgsdmManth").toString(); 420 fgsdmManth=map.get("fgsdmManth").toString();
418 } 421 }
419 String sql ="select "; 422 String sql ="select ";
@@ -766,6 +769,10 @@ public class FormsServiceImpl implements FormsService { @@ -766,6 +769,10 @@ public class FormsServiceImpl implements FormsService {
766 769
767 rq = rq2 + "-" + rq3; 770 rq = rq2 + "-" + rq3;
768 771
  772 + String sfyy="";
  773 + if(map.get("sfyy")!=null){
  774 + sfyy=map.get("sfyy").toString();
  775 + }
769 String line=""; 776 String line="";
770 if(map.get("line")!=null){ 777 if(map.get("line")!=null){
771 line=map.get("line").toString().trim(); 778 line=map.get("line").toString().trim();
@@ -784,21 +791,23 @@ public class FormsServiceImpl implements FormsService { @@ -784,21 +791,23 @@ public class FormsServiceImpl implements FormsService {
784 791
785 if(!line.equals("")){ 792 if(!line.equals("")){
786 sql +=" and xl= '"+line+"'"; 793 sql +=" and xl= '"+line+"'";
787 - }else{  
788 - sql += " and gs= '"+gs+"' and fgs= '"+fgs+"'"; 794 + }
  795 + if(!gs.equals("")){
  796 + sql += " and gs= '"+gs+"'";
  797 + }
  798 + if(!fgs.equals("")){
  799 + sql += " and fgs= '"+fgs+"'";
789 } 800 }
790 801
791 sql +=" order by rq"; 802 sql +=" order by rq";
792 List<Changetochange> list = jdbcTemplate.query(sql, new RowMapper<Changetochange>() { 803 List<Changetochange> list = jdbcTemplate.query(sql, new RowMapper<Changetochange>() {
793 -  
794 -  
795 @Override 804 @Override
796 public Changetochange mapRow(ResultSet arg0, int arg1) throws SQLException { 805 public Changetochange mapRow(ResultSet arg0, int arg1) throws SQLException {
797 Changetochange chan = new Changetochange(); 806 Changetochange chan = new Changetochange();
798 chan.setRq(arg0.getString("rq")); 807 chan.setRq(arg0.getString("rq"));
799 chan.setGs(BasicData.businessCodeNameMap.get(arg0.getString("gs"))); 808 chan.setGs(BasicData.businessCodeNameMap.get(arg0.getString("gs")));
800 chan.setFgs(BasicData.businessFgsCodeNameMap.get(arg0.getString("fgs")+"_"+arg0.getString("gs"))); 809 chan.setFgs(BasicData.businessFgsCodeNameMap.get(arg0.getString("fgs")+"_"+arg0.getString("gs")));
801 - chan.setXl(BasicData.lineCode2NameMap.get(arg0.getString("xl"))); 810 + chan.setXl(arg0.getString("xl"));
802 chan.setLp(arg0.getString("lp")); 811 chan.setLp(arg0.getString("lp"));
803 chan.setFssj(arg0.getString("fssj")); 812 chan.setFssj(arg0.getString("fssj"));
804 chan.setXgsj(arg0.getString("xgsj")); 813 chan.setXgsj(arg0.getString("xgsj"));
@@ -813,13 +822,42 @@ public class FormsServiceImpl implements FormsService { @@ -813,13 +822,42 @@ public class FormsServiceImpl implements FormsService {
813 return chan; 822 return chan;
814 } 823 }
815 }); 824 });
816 - return list; 825 +
  826 + Map<String, Boolean> lineNature = lineService.lineNature();
  827 + List<Changetochange> resList = new ArrayList<Changetochange>();
  828 +
  829 + for(Changetochange c : list){
  830 + String xl = c.getXl();
  831 + if(sfyy.length() != 0){
  832 + if(sfyy.equals("0")){
  833 + resList.add(c);
  834 + } else if(sfyy.equals("1")){
  835 + if(lineNature.containsKey(xl) && lineNature.get(xl)){
  836 + resList.add(c);
  837 + }
  838 + } else {
  839 + if(lineNature.containsKey(xl) && !lineNature.get(xl)){
  840 + resList.add(c);
  841 + }
  842 + }
  843 + } else {
  844 + resList.add(c);
  845 + }
  846 +
  847 + c.setXl(BasicData.lineCode2NameMap.get(xl));
  848 + }
  849 +
  850 + return resList;
817 } 851 }
818 852
819 853
820 // 路单数据 854 // 路单数据
821 @Override 855 @Override
822 public List<Singledata> singledatatj(Map<String, Object> map) { 856 public List<Singledata> singledatatj(Map<String, Object> map) {
  857 + String sfyy="";
  858 + if(map.get("sfyy")!=null){
  859 + sfyy=map.get("sfyy").toString();
  860 + }
823 String gsdm=""; 861 String gsdm="";
824 if(map.get("gsdmSing")!=null){ 862 if(map.get("gsdmSing")!=null){
825 gsdm=map.get("gsdmSing").toString(); 863 gsdm=map.get("gsdmSing").toString();
@@ -843,16 +881,20 @@ public class FormsServiceImpl implements FormsService { @@ -843,16 +881,20 @@ public class FormsServiceImpl implements FormsService {
843 List<Singledata> list_=new ArrayList<Singledata>(); 881 List<Singledata> list_=new ArrayList<Singledata>();
844 if(tjtype.equals("jsy")){ 882 if(tjtype.equals("jsy")){
845 //油统计 883 //油统计
846 - String sql="select r.j_gh, r.xl_bm,r.cl_zbh,r.j_name" 884 + String sql="select r.j_gh, r.xl_bm,r.cl_zbh,r.j_name,r.fgs_bm"
847 + " from bsth_c_s_sp_info_real r where " 885 + " from bsth_c_s_sp_info_real r where "
848 + " r.schedule_date_str = '"+startDate+"'"; 886 + " r.schedule_date_str = '"+startDate+"'";
849 - if(xlbm.equals("")){  
850 - sql +="and r.gs_bm='"+gsdm+"' "  
851 - + " and r.fgs_bm='"+fgsdm+"'";  
852 - }else{ 887 + if(xlbm.length() != 0){
853 sql += " and r.xl_bm = '"+xlbm+"'"; 888 sql += " and r.xl_bm = '"+xlbm+"'";
854 } 889 }
855 - sql += " group by r.j_gh,r.xl_bm,r.cl_zbh,r.j_name order by r.xl_bm,r.cl_zbh"; 890 + if(gsdm.length() != 0){
  891 + sql += " and r.gs_bm ='"+gsdm+"'";
  892 + }
  893 + if(fgsdm.length() != 0){
  894 + sql += " and r.fgs_bm ='"+fgsdm+"'";
  895 + }
  896 + sql += " group by r.j_gh,r.xl_bm,r.cl_zbh,r.j_name order by r.xl_bm,r.cl_zbh";
  897 +
856 list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { 898 list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
857 @Override 899 @Override
858 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { 900 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
@@ -861,20 +903,30 @@ public class FormsServiceImpl implements FormsService { @@ -861,20 +903,30 @@ public class FormsServiceImpl implements FormsService {
861 sin.setJsy(arg0.getString("j_gh")); 903 sin.setJsy(arg0.getString("j_gh"));
862 sin.setjName(arg0.getString("j_name")); 904 sin.setjName(arg0.getString("j_name"));
863 sin.setClzbh(arg0.getString("cl_zbh")); 905 sin.setClzbh(arg0.getString("cl_zbh"));
  906 + sin.setgS(arg0.getString("fgs_bm"));
864 return sin; 907 return sin;
865 } 908 }
866 }); 909 });
  910 +
  911 + Collections.sort(list,new SingledataByXlbm());
  912 +
867 String linesql=""; 913 String linesql="";
868 if(!xlbm.equals("")){ 914 if(!xlbm.equals("")){
869 linesql +=" and xlbm ='"+xlbm+"' "; 915 linesql +=" and xlbm ='"+xlbm+"' ";
870 } 916 }
871 - String nysql="SELECT id,xlbm,nbbm, jsy,jzl as jzl,yh as yh,sh as sh FROM bsth_c_ylb " 917 + if(!gsdm.equals("")){
  918 + linesql +=" and ssgsdm ='"+gsdm+"' ";
  919 + }
  920 + if(!fgsdm.equals("")){
  921 + linesql +=" and fgsdm ='"+fgsdm+"' ";
  922 + }
  923 + String nysql="SELECT id,xlbm,nbbm,jsy,jzl as jzl,yh as yh,sh as sh,fgsdm FROM bsth_c_ylb"
872 + " WHERE rq = '"+startDate+"'" 924 + " WHERE rq = '"+startDate+"'"
873 - + " AND ssgsdm = '"+gsdm+"' AND fgsdm = '"+fgsdm+"'" +linesql 925 + + linesql
874 + " union" 926 + " union"
875 - + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh FROM bsth_c_dlb" 927 + + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh,fgsdm FROM bsth_c_dlb"
876 + " WHERE rq = '"+startDate+"'" 928 + " WHERE rq = '"+startDate+"'"
877 - + " AND ssgsdm = '"+gsdm+"' AND fgsdm = '"+fgsdm+"'"+linesql; 929 + + linesql;
878 List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() { 930 List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() {
879 @Override 931 @Override
880 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { 932 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
@@ -885,6 +937,7 @@ public class FormsServiceImpl implements FormsService { @@ -885,6 +937,7 @@ public class FormsServiceImpl implements FormsService {
885 sin.setJzl(arg0.getString("jzl")); 937 sin.setJzl(arg0.getString("jzl"));
886 sin.setHyl(arg0.getString("yh")); 938 sin.setHyl(arg0.getString("yh"));
887 sin.setUnyyyl(arg0.getString("sh")); 939 sin.setUnyyyl(arg0.getString("sh"));
  940 + sin.setgS(arg0.getString("fgsdm"));
888 return sin; 941 return sin;
889 } 942 }
890 }); 943 });
@@ -913,7 +966,7 @@ public class FormsServiceImpl implements FormsService { @@ -913,7 +966,7 @@ public class FormsServiceImpl implements FormsService {
913 s.setClzbh(clzbh); 966 s.setClzbh(clzbh);
914 s.setSgh(""); 967 s.setSgh("");
915 s.setsName(""); 968 s.setsName("");
916 - s.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); 969 + s.setgS(BasicData.businessFgsCodeNameMap.get(sin_.getgS()+"_"+gsdm));
917 s.setxL(line); 970 s.setxL(line);
918 s.setXlmc(BasicData.lineCode2NameMap.get(line)); 971 s.setXlmc(BasicData.lineCode2NameMap.get(line));
919 s.setJzl(sin_.getJzl()); 972 s.setJzl(sin_.getJzl());
@@ -983,27 +1036,29 @@ public class FormsServiceImpl implements FormsService { @@ -983,27 +1036,29 @@ public class FormsServiceImpl implements FormsService {
983 // sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy)); 1036 // sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));
984 sin.setSgh(""); 1037 sin.setSgh("");
985 sin.setsName(""); 1038 sin.setsName("");
986 - sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); 1039 + sin.setgS(BasicData.businessFgsCodeNameMap.get(sin.getgS()+"_"+gsdm));
987 list_.add(sin); 1040 list_.add(sin);
988 1041
989 } 1042 }
990 - Collections.sort(list_,new SingledataByXlbm());  
991 }else{ 1043 }else{
992 String sql="select r.s_gh,r.s_name, " 1044 String sql="select r.s_gh,r.s_name, "
993 + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm" 1045 + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm"
994 + " from bsth_c_s_sp_info_real r where " 1046 + " from bsth_c_s_sp_info_real r where "
995 + " r.schedule_date_str = '"+startDate+"'" 1047 + " r.schedule_date_str = '"+startDate+"'"
996 + " and r.s_gh !='' and r.s_gh is not null "; 1048 + " and r.s_gh !='' and r.s_gh is not null ";
997 - if(xlbm.equals("")){  
998 - sql +="and r.gs_bm='"+gsdm+"' "  
999 - + " and r.fgs_bm='"+fgsdm+"'";  
1000 - }else{ 1049 + if(!xlbm.equals("")){
1001 sql += " and r.xl_bm = '"+xlbm+"'"; 1050 sql += " and r.xl_bm = '"+xlbm+"'";
1002 } 1051 }
1003 - sql += " group by r.s_gh,r.s_name," 1052 + if(!gsdm.equals("")){
  1053 + sql += " and r.gs_bm = '"+gsdm+"'";
  1054 + }
  1055 + if(!fgsdm.equals("")){
  1056 + sql += " and r.fgs_bm = '"+fgsdm+"'";
  1057 + }
  1058 + sql += " group by r.s_gh,r.s_name,"
1004 + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; 1059 + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh";
1005 1060
1006 - list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { 1061 + list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
1007 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 1062 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
1008 @Override 1063 @Override
1009 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { 1064 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
@@ -1013,10 +1068,13 @@ public class FormsServiceImpl implements FormsService { @@ -1013,10 +1068,13 @@ public class FormsServiceImpl implements FormsService {
1013 sin.setClzbh(arg0.getString("cl_zbh")); 1068 sin.setClzbh(arg0.getString("cl_zbh"));
1014 sin.setSgh(arg0.getString("s_gh")); 1069 sin.setSgh(arg0.getString("s_gh"));
1015 sin.setsName(arg0.getString("s_name")); 1070 sin.setsName(arg0.getString("s_name"));
  1071 + sin.setgS(arg0.getString("fgs_bm"));
1016 return sin; 1072 return sin;
1017 } 1073 }
1018 }); 1074 });
1019 1075
  1076 + Collections.sort(list,new SingledataByXlbm());
  1077 +
1020 for (int i = 0; i < list.size(); i++) { 1078 for (int i = 0; i < list.size(); i++) {
1021 Singledata sin=list.get(i); 1079 Singledata sin=list.get(i);
1022 String jsy=sin.getSgh(); 1080 String jsy=sin.getSgh();
@@ -1058,15 +1116,36 @@ public class FormsServiceImpl implements FormsService { @@ -1058,15 +1116,36 @@ public class FormsServiceImpl implements FormsService {
1058 sin.setClzbh(clzbh); 1116 sin.setClzbh(clzbh);
1059 sin.setJsy(""); 1117 sin.setJsy("");
1060 sin.setjName(""); 1118 sin.setjName("");
1061 - sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); 1119 + sin.setgS(BasicData.businessFgsCodeNameMap.get(sin.getgS()+"_"+gsdm));
1062 sin.setHyl(""); 1120 sin.setHyl("");
1063 sin.setJzl(""); 1121 sin.setJzl("");
1064 sin.setUnyyyl(""); 1122 sin.setUnyyyl("");
1065 list_.add(sin); 1123 list_.add(sin);
1066 } 1124 }
1067 - Collections.sort(list_,new SingledataByXlbm());  
1068 } 1125 }
1069 - return list_; 1126 +
  1127 + Map<String, Boolean> lineNature = lineService.lineNature();
  1128 + List<Singledata> resList = new ArrayList<Singledata>();
  1129 + for(Singledata s : list_){
  1130 + String xlBm = s.getxL();
  1131 + if(sfyy.length() != 0){
  1132 + if(sfyy.equals("0")){
  1133 + resList.add(s);
  1134 + } else if(sfyy.equals("1")){
  1135 + if(lineNature.containsKey(xlBm) && lineNature.get(xlBm)){
  1136 + resList.add(s);
  1137 + }
  1138 + } else {
  1139 + if(lineNature.containsKey(xlBm) && !lineNature.get(xlBm)){
  1140 + resList.add(s);
  1141 + }
  1142 + }
  1143 + } else {
  1144 + resList.add(s);
  1145 + }
  1146 + }
  1147 +
  1148 + return resList;
1070 } 1149 }
1071 1150
1072 1151
@@ -1098,12 +1177,15 @@ public class FormsServiceImpl implements FormsService { @@ -1098,12 +1177,15 @@ public class FormsServiceImpl implements FormsService {
1098 String sql="select r.j_gh, r.xl_bm,r.cl_zbh,r.j_name" 1177 String sql="select r.j_gh, r.xl_bm,r.cl_zbh,r.j_name"
1099 + " from bsth_c_s_sp_info_real r where " 1178 + " from bsth_c_s_sp_info_real r where "
1100 + " r.schedule_date_str = '"+startDate+"'"; 1179 + " r.schedule_date_str = '"+startDate+"'";
1101 - if(xlbm.equals("")){  
1102 - sql +="and r.gs_bm='"+gsdm+"' "  
1103 - + " and r.fgs_bm='"+fgsdm+"'";  
1104 - }else{ 1180 + if(!xlbm.equals("")){
1105 sql += " and r.xl_bm = '"+xlbm+"'"; 1181 sql += " and r.xl_bm = '"+xlbm+"'";
1106 } 1182 }
  1183 + if(!gsdm.equals("")){
  1184 + sql += " and r.gs_bm='"+gsdm+"'";
  1185 + }
  1186 + if(!fgsdm.equals("")){
  1187 + sql += " and r.fgs_bm='"+fgsdm+"'";
  1188 + }
1107 sql += " group by r.j_gh,r.xl_bm,r.cl_zbh,r.j_name order by r.xl_bm,r.cl_zbh"; 1189 sql += " group by r.j_gh,r.xl_bm,r.cl_zbh,r.j_name order by r.xl_bm,r.cl_zbh";
1108 list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { 1190 list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
1109 @Override 1191 @Override
@@ -1118,15 +1200,21 @@ public class FormsServiceImpl implements FormsService { @@ -1118,15 +1200,21 @@ public class FormsServiceImpl implements FormsService {
1118 }); 1200 });
1119 String linesql=""; 1201 String linesql="";
1120 if(!xlbm.equals("")){ 1202 if(!xlbm.equals("")){
1121 - linesql +=" and xlbm ='"+xlbm+"' "; 1203 + linesql += " and xlbm ='"+xlbm+"' ";
1122 } 1204 }
  1205 + if(!gsdm.equals("")){
  1206 + linesql += " and ssgsdm ='"+gsdm+"'";
  1207 + }
  1208 + if(!fgsdm.equals("")){
  1209 + linesql += " and fgsdm ='"+fgsdm+"'";
  1210 + }
1123 String nysql="SELECT id,xlbm,nbbm, jsy,jzl as jzl,yh as yh,sh as sh FROM bsth_c_ylb " 1211 String nysql="SELECT id,xlbm,nbbm, jsy,jzl as jzl,yh as yh,sh as sh FROM bsth_c_ylb "
1124 + " WHERE rq = '"+startDate+"'" 1212 + " WHERE rq = '"+startDate+"'"
1125 - + " AND ssgsdm = '"+gsdm+"' AND fgsdm = '"+fgsdm+"'" +linesql 1213 + + linesql
1126 + " union" 1214 + " union"
1127 + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh FROM bsth_c_dlb" 1215 + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh FROM bsth_c_dlb"
1128 + " WHERE rq = '"+startDate+"'" 1216 + " WHERE rq = '"+startDate+"'"
1129 - + " AND ssgsdm = '"+gsdm+"' AND fgsdm = '"+fgsdm+"'"+linesql; 1217 + + linesql;
1130 List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() { 1218 List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() {
1131 @Override 1219 @Override
1132 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { 1220 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
@@ -1246,14 +1334,17 @@ public class FormsServiceImpl implements FormsService { @@ -1246,14 +1334,17 @@ public class FormsServiceImpl implements FormsService {
1246 + " from bsth_c_s_sp_info_real r where " 1334 + " from bsth_c_s_sp_info_real r where "
1247 + " r.schedule_date_str = '"+startDate+"'" 1335 + " r.schedule_date_str = '"+startDate+"'"
1248 + " and r.s_gh !='' and r.s_gh is not null "; 1336 + " and r.s_gh !='' and r.s_gh is not null ";
1249 - if(xlbm.equals("")){  
1250 - sql +="and r.gs_bm='"+gsdm+"' "  
1251 - + " and r.fgs_bm='"+fgsdm+"'";  
1252 - }else{ 1337 + if(!xlbm.equals("")){
1253 sql += " and r.xl_bm = '"+xlbm+"'"; 1338 sql += " and r.xl_bm = '"+xlbm+"'";
1254 } 1339 }
1255 - sql += " group by r.s_gh,r.s_name,"  
1256 - + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; 1340 + if(!gsdm.equals("")){
  1341 + sql += " and r.gs_bm='"+gsdm+"'";
  1342 + }
  1343 + if(!fgsdm.equals("")){
  1344 + sql += " and r.fgs_bm='"+fgsdm+"'";
  1345 + }
  1346 + sql += " group by r.s_gh,r.s_name,"
  1347 + + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh";
1257 1348
1258 list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { 1349 list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
1259 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 1350 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -1635,14 +1726,17 @@ public class FormsServiceImpl implements FormsService { @@ -1635,14 +1726,17 @@ public class FormsServiceImpl implements FormsService {
1635 String sql="select r.s_gh,r.s_name, " 1726 String sql="select r.s_gh,r.s_name, "
1636 + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm" 1727 + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm"
1637 + " from bsth_c_s_sp_info_real r where r.schedule_date_str = '"+startDate+"'"; 1728 + " from bsth_c_s_sp_info_real r where r.schedule_date_str = '"+startDate+"'";
1638 - if(xlbm.equals("")){  
1639 - sql +="and r.gs_bm='"+gsdm+"' "  
1640 - + " and r.fgs_bm='"+fgsdm+"'";  
1641 - }else{ 1729 + if(!xlbm.equals("")){
1642 sql += " and r.xl_bm = '"+xlbm+"'"; 1730 sql += " and r.xl_bm = '"+xlbm+"'";
1643 } 1731 }
1644 - sql += " group by r.s_gh,r.s_name,"  
1645 - + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; 1732 + if(!gsdm.equals("")){
  1733 + sql += " and r.gs_bm='"+gsdm+"'";
  1734 + }
  1735 + if(!fgsdm.equals("")){
  1736 + sql += " and r.fgs_bm='"+fgsdm+"'";
  1737 + }
  1738 + sql += " group by r.s_gh,r.s_name,"
  1739 + + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh";
1646 1740
1647 List<Singledata> list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { 1741 List<Singledata> list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
1648 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 1742 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -1929,14 +2023,17 @@ public class FormsServiceImpl implements FormsService { @@ -1929,14 +2023,17 @@ public class FormsServiceImpl implements FormsService {
1929 + " from bsth_c_s_sp_info_real r where " 2023 + " from bsth_c_s_sp_info_real r where "
1930 + " r.schedule_date_str = '"+startDate+"'" 2024 + " r.schedule_date_str = '"+startDate+"'"
1931 + " and r.s_gh !='' and r.s_gh is not null "; 2025 + " and r.s_gh !='' and r.s_gh is not null ";
1932 - if(xlbm.equals("")){  
1933 - sql +="and r.gs_bm='"+gsdm+"' "  
1934 - + " and r.fgs_bm='"+fgsdm+"'";  
1935 - }else{ 2026 + if(!xlbm.equals("")){
1936 sql += " and r.xl_bm = '"+xlbm+"'"; 2027 sql += " and r.xl_bm = '"+xlbm+"'";
1937 } 2028 }
1938 - sql += " group by r.s_gh,r.s_name,"  
1939 - + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; 2029 + if(!gsdm.equals("")){
  2030 + sql += " and r.gs_bm='"+gsdm+"'";
  2031 + }
  2032 + if(!fgsdm.equals("")){
  2033 + sql += " and r.fgs_bm='"+fgsdm+"'";
  2034 + }
  2035 + sql += " group by r.s_gh,r.s_name,"
  2036 + + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh";
1940 2037
1941 list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { 2038 list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
1942 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 2039 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -2205,13 +2302,16 @@ public class FormsServiceImpl implements FormsService { @@ -2205,13 +2302,16 @@ public class FormsServiceImpl implements FormsService {
2205 + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm" 2302 + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm"
2206 + " from bsth_c_s_sp_info_real r where " 2303 + " from bsth_c_s_sp_info_real r where "
2207 + " r.schedule_date_str = '"+startDate+"'" 2304 + " r.schedule_date_str = '"+startDate+"'"
2208 - + " and r.s_gh !='' and r.s_gh is not null ";  
2209 - if(xlbm.equals("")){  
2210 - sql +="and r.gs_bm='"+gsdm+"' "  
2211 - + " and r.fgs_bm='"+fgsdm+"'";  
2212 - }else{ 2305 + + " and r.s_gh !='' and r.s_gh is not null ";
  2306 + if(!xlbm.equals("")){
2213 sql += " and r.xl_bm = '"+xlbm+"'"; 2307 sql += " and r.xl_bm = '"+xlbm+"'";
2214 } 2308 }
  2309 + if(!gsdm.equals("")){
  2310 + sql += " and r.gs_bm='"+gsdm+"'";
  2311 + }
  2312 + if(!fgsdm.equals("")){
  2313 + sql += " and r.fgs_bm='"+fgsdm+"'";
  2314 + }
2215 sql += " group by r.s_gh,r.s_name," 2315 sql += " group by r.s_gh,r.s_name,"
2216 + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; 2316 + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh";
2217 2317
@@ -2285,7 +2385,10 @@ public class FormsServiceImpl implements FormsService { @@ -2285,7 +2385,10 @@ public class FormsServiceImpl implements FormsService {
2285 @Override 2385 @Override
2286 public List<Operationservice> operationservice(Map<String, Object> map) { 2386 public List<Operationservice> operationservice(Map<String, Object> map) {
2287 2387
2288 - String xlbm=map.get("line").toString().trim(); 2388 + String sfyy="";
  2389 + if(map.get("sfyy")!=null){
  2390 + sfyy=map.get("sfyy").toString();
  2391 + }
2289 String gsdm=""; 2392 String gsdm="";
2290 if(map.get("gsdmOperat")!=null){ 2393 if(map.get("gsdmOperat")!=null){
2291 gsdm=map.get("gsdmOperat").toString(); 2394 gsdm=map.get("gsdmOperat").toString();
@@ -2294,37 +2397,72 @@ public class FormsServiceImpl implements FormsService { @@ -2294,37 +2397,72 @@ public class FormsServiceImpl implements FormsService {
2294 if(map.get("fgsdmOperat")!=null){ 2397 if(map.get("fgsdmOperat")!=null){
2295 fgsdm=map.get("fgsdmOperat").toString(); 2398 fgsdm=map.get("fgsdmOperat").toString();
2296 } 2399 }
2297 - startDate=map.get("startDate").toString();  
2298 - endDate =map.get("endDate").toString();  
2299 - String sql="select r.xl_bm" 2400 + String xlbm=map.get("line").toString().trim();
  2401 + String startDate=map.get("startDate").toString();
  2402 + String endDate =map.get("endDate").toString();
  2403 +
  2404 + String sql="select r.xl_bm, r.gs_bm, r.fgs_bm"
2300 + " from bsth_c_s_sp_info_real r where" 2405 + " from bsth_c_s_sp_info_real r where"
2301 + " r.schedule_date_str BETWEEN '"+startDate+"' and '"+endDate+"'"; 2406 + " r.schedule_date_str BETWEEN '"+startDate+"' and '"+endDate+"'";
2302 - if(xlbm.equals("")){  
2303 - sql +="and r.gs_bm='"+gsdm+"' "  
2304 - + " and r.fgs_bm='"+fgsdm+"'";  
2305 - }else{ 2407 + if(xlbm.length() != 0){
2306 sql += " and r.xl_bm = '"+xlbm+"'"; 2408 sql += " and r.xl_bm = '"+xlbm+"'";
2307 } 2409 }
2308 - sql += " group by r.xl_bm";  
2309 - 2410 + if(gsdm.length() != 0){
  2411 + sql += " and r.gs_bm='"+gsdm+"'";
  2412 + }
  2413 + if(fgsdm.length() != 0){
  2414 + sql += " and r.fgs_bm='"+fgsdm+"'";
  2415 + }
  2416 + sql += " group by r.gs_bm, r.fgs_bm, r.xl_bm " +
  2417 + "order by r.gs_bm, r.fgs_bm, r.xl_bm";
  2418 +
  2419 + System.out.println(sql);
2310 2420
2311 - List<Operationservice> list= jdbcTemplate.query(sql, new RowMapper<Operationservice>() {  
2312 - @Override  
2313 - public Operationservice mapRow(ResultSet arg0, int arg1) throws SQLException {  
2314 - Operationservice ve = new Operationservice();  
2315 - ve.setXlBm(arg0.getString("xl_bm"));  
2316 - return ve; 2421 + List<Operationservice> query = jdbcTemplate.query(sql, new RowMapper<Operationservice>() {
  2422 + @Override
  2423 + public Operationservice mapRow(ResultSet arg0, int arg1) throws SQLException {
  2424 + Operationservice ve = new Operationservice();
  2425 + ve.setXlBm(arg0.getString("xl_bm"));
  2426 + ve.setGs(arg0.getString("gs_bm"));
  2427 + ve.setFgs(arg0.getString("fgs_bm"));
  2428 + return ve;
  2429 + }
  2430 + });
  2431 +
  2432 + List<Operationservice> list = new ArrayList<Operationservice>();
  2433 + Map<String, Boolean> lineNature = lineService.lineNature();
  2434 + for(Operationservice o : query){
  2435 + o.setFgs(BasicData.businessFgsCodeNameMap.get(o.getFgs()+"_"+o.getGs()));
  2436 +
  2437 + String xl = o.getXlBm();
  2438 + if(sfyy.length() != 0){
  2439 + if(sfyy.equals("0")){
  2440 + list.add(o);
  2441 + } else if(sfyy.equals("1")){
  2442 + if(lineNature.containsKey(xl) && lineNature.get(xl)){
  2443 + list.add(o);
  2444 + }
  2445 + } else {
  2446 + if(lineNature.containsKey(xl) && !lineNature.get(xl)){
  2447 + list.add(o);
  2448 + }
2317 } 2449 }
2318 - });  
2319 -  
2320 - String ylbSql=" select * from bsth_c_ylb where rq BETWEEN '"+startDate+"' and '"+endDate+"'";  
2321 - if(xlbm.equals("")){  
2322 - ylbSql +="and ssgsdm='"+gsdm+"' "  
2323 - + " and fgsdm='"+fgsdm+"'";  
2324 - }else{ 2450 + } else {
  2451 + list.add(o);
  2452 + }
  2453 + }
  2454 +
  2455 + String ylbSql=" select * from bsth_c_ylb where rq BETWEEN '"+startDate+"' and '"+endDate+"'";
  2456 + if(!xlbm.equals("")){
2325 ylbSql += " and xlbm = '"+xlbm+"'"; 2457 ylbSql += " and xlbm = '"+xlbm+"'";
2326 } 2458 }
2327 - List<Ylb> ylbList= jdbcTemplate.query(ylbSql, new RowMapper<Ylb>() { 2459 + if(!gsdm.equals("")){
  2460 + ylbSql += " and ssgsdm='"+gsdm+"'";
  2461 + }
  2462 + if(!fgsdm.equals("")){
  2463 + ylbSql += " and fgsdm='"+fgsdm+"'";
  2464 + }
  2465 + List<Ylb> ylbList= jdbcTemplate.query(ylbSql, new RowMapper<Ylb>() {
2328 @Override 2466 @Override
2329 public Ylb mapRow(ResultSet arg0, int arg1) throws SQLException { 2467 public Ylb mapRow(ResultSet arg0, int arg1) throws SQLException {
2330 Ylb y = new Ylb(); 2468 Ylb y = new Ylb();
@@ -2333,16 +2471,19 @@ public class FormsServiceImpl implements FormsService { @@ -2333,16 +2471,19 @@ public class FormsServiceImpl implements FormsService {
2333 y.setYh(arg0.getDouble("yh")); 2471 y.setYh(arg0.getDouble("yh"));
2334 return y; 2472 return y;
2335 } 2473 }
2336 - }); 2474 + });
2337 2475
2338 - String dlbSql=" select * from bsth_c_dlb where rq BETWEEN '"+startDate+"' and '"+endDate+"'";  
2339 - if(xlbm.equals("")){  
2340 - ylbSql +="and ssgsdm='"+gsdm+"' "  
2341 - + " and fgsdm='"+fgsdm+"'";  
2342 - }else{ 2476 + String dlbSql=" select * from bsth_c_dlb where rq BETWEEN '"+startDate+"' and '"+endDate+"'";
  2477 + if(!xlbm.equals("")){
2343 ylbSql += " and xlbm = '"+xlbm+"'"; 2478 ylbSql += " and xlbm = '"+xlbm+"'";
2344 } 2479 }
2345 - List<Dlb> dlbList= jdbcTemplate.query(dlbSql, new RowMapper<Dlb>() { 2480 + if(!gsdm.equals("")){
  2481 + ylbSql += " and ssgsdm='"+gsdm+"'";
  2482 + }
  2483 + if(!fgsdm.equals("")){
  2484 + ylbSql += " and fgsdm='"+fgsdm+"'";
  2485 + }
  2486 + List<Dlb> dlbList= jdbcTemplate.query(dlbSql, new RowMapper<Dlb>() {
2346 @Override 2487 @Override
2347 public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException { 2488 public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException {
2348 Dlb d = new Dlb(); 2489 Dlb d = new Dlb();
@@ -2544,8 +2685,13 @@ public class FormsServiceImpl implements FormsService { @@ -2544,8 +2685,13 @@ public class FormsServiceImpl implements FormsService {
2544 } 2685 }
2545 String rq2 = sdf1.format(d); 2686 String rq2 = sdf1.format(d);
2546 String rq3 = sdf1.format(d1); 2687 String rq3 = sdf1.format(d1);
2547 - String company = map.get("gsdmTurn").toString();  
2548 - String subCompany = map.get("fgsdmTurn").toString(); 2688 + String company = "", subCompany = "";
  2689 + if(map.get("gsdmTurn") != null){
  2690 + company = map.get("gsdmTurn").toString();
  2691 + }
  2692 + if(map.get("fgsdmTurn") != null){
  2693 + subCompany = map.get("fgsdmTurn").toString();
  2694 + }
2549 String line = map.get("line").toString(); 2695 String line = map.get("line").toString();
2550 String startDate = map.get("startDate").toString(); 2696 String startDate = map.get("startDate").toString();
2551 String endDate = map.get("endDate").toString(); 2697 String endDate = map.get("endDate").toString();
@@ -2559,12 +2705,17 @@ public class FormsServiceImpl implements FormsService { @@ -2559,12 +2705,17 @@ public class FormsServiceImpl implements FormsService {
2559 List<Line> lineList = lineRepository.findLineBygsBm(company, subCompany, line.length()==0?"%"+line+"%":line); 2705 List<Line> lineList = lineRepository.findLineBygsBm(company, subCompany, line.length()==0?"%"+line+"%":line);
2560 2706
2561 String sql = "select gs_name, fgs_name, cl_zbh, fcsj, bc_type, xl_bm, xl_name, schedule_date" 2707 String sql = "select gs_name, fgs_name, cl_zbh, fcsj, bc_type, xl_bm, xl_name, schedule_date"
2562 - + " from bsth_c_s_sp_info where gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"' "  
2563 - + "and schedule_date >= '"+startDate+"' "  
2564 - + "and schedule_date <= '"+endDate+"' "; 2708 + + " from bsth_c_s_sp_info where "
  2709 + + "schedule_date >= '"+startDate+"' and schedule_date <= '"+endDate+"' ";
2565 if(line.trim().length() != 0){ 2710 if(line.trim().length() != 0){
2566 sql += "and xl_bm = '"+line+"' "; 2711 sql += "and xl_bm = '"+line+"' ";
2567 } 2712 }
  2713 + if(company.trim().length() != 0){
  2714 + sql += "and gs_bm = '"+company+"' ";
  2715 + }
  2716 + if(subCompany.trim().length() != 0){
  2717 + sql += "and fgs_bm = '"+subCompany+"' ";
  2718 + }
2568 List<SchedulePlanInfo> planList = jdbcTemplate.query(sql, new RowMapper<SchedulePlanInfo>() { 2719 List<SchedulePlanInfo> planList = jdbcTemplate.query(sql, new RowMapper<SchedulePlanInfo>() {
2569 2720
2570 @Override 2721 @Override
@@ -2711,18 +2862,34 @@ public class FormsServiceImpl implements FormsService { @@ -2711,18 +2862,34 @@ public class FormsServiceImpl implements FormsService {
2711 2862
2712 e.printStackTrace(); 2863 e.printStackTrace();
2713 } 2864 }
  2865 +
  2866 + String gsbm = "", fgsbm = "";
  2867 + if(map.get("gsdmEcecut")!=null){
  2868 + gsbm = map.get("gsdmEcecut").toString();
  2869 + }
  2870 + if(map.get("fgsdmEcecut")!=null){
  2871 + fgsbm = map.get("fgsdmEcecut").toString();
  2872 + }
  2873 +
2714 String rq2 = sdf1.format(d); 2874 String rq2 = sdf1.format(d);
2715 String rq3 = sdf1.format(d1); 2875 String rq3 = sdf1.format(d1);
2716 2876
2717 rq = rq2 + "-" + rq3; 2877 rq = rq2 + "-" + rq3;
2718 2878
  2879 + String where = "";
  2880 + if(gsbm.trim().length() != 0){
  2881 + where += " and gs_bm = '" + gsbm + "'";
  2882 + }
  2883 + if(fgsbm.trim().length() != 0){
  2884 + where += " and fgs_bm = '" + fgsbm + "'";
  2885 + }
  2886 +
2719 String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.xl_name,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm,a.bc_type from " 2887 String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.xl_name,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm,a.bc_type from "
2720 + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl,bc_type" 2888 + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl,bc_type"
2721 + " from bsth_c_s_sp_info" + " where schedule_date >= '" 2889 + " from bsth_c_s_sp_info" + " where schedule_date >= '"
2722 + map.get("startDate").toString() + "' and schedule_date <= '" + map.get("endDate").toString() + "' and xl_bm='" 2890 + map.get("startDate").toString() + "' and schedule_date <= '" + map.get("endDate").toString() + "' and xl_bm='"
2723 + map.get("line").toString() + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out')" 2891 + map.get("line").toString() + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out')"
2724 - + " and gs_bm='"+ map.get("gsdmEcecut").toString() + "'"  
2725 - + " and fgs_bm='"+ map.get("fgsdmEcecut").toString() + "'" 2892 + + where
2726 // + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type " 2893 // + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type "
2727 + " ) a left JOIN (" 2894 + " ) a left JOIN ("
2728 + "SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.xl_name,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl " 2895 + "SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.xl_name,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl "
@@ -2899,14 +3066,17 @@ public class FormsServiceImpl implements FormsService { @@ -2899,14 +3066,17 @@ public class FormsServiceImpl implements FormsService {
2899 + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm" 3066 + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm"
2900 + " from bsth_c_s_sp_info_real r where " 3067 + " from bsth_c_s_sp_info_real r where "
2901 + "r.schedule_date_str = '"+map.get("date").toString()+"'"; 3068 + "r.schedule_date_str = '"+map.get("date").toString()+"'";
2902 - if(xlbm.equals("")){  
2903 - sql +="and r.gs_bm='"+gsbm+"' "  
2904 - + " and r.fgs_bm='"+fgsbm+"'";  
2905 - }else{ 3069 + if(!xlbm.equals("")){
2906 sql += " and r.xl_bm = '"+xlbm+"'"; 3070 sql += " and r.xl_bm = '"+xlbm+"'";
2907 } 3071 }
2908 - sql += " group by r.schedule_date_str,"  
2909 - + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; 3072 + if(!gsbm.equals("")){
  3073 + sql += " and r.gs_bm='"+gsbm+"'";
  3074 + }
  3075 + if(!fgsbm.equals("")){
  3076 + sql += " and r.fgs_bm='"+fgsbm+"'";
  3077 + }
  3078 + sql += " group by r.schedule_date_str,"
  3079 + + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh";
2910 3080
2911 List<Daily> list = jdbcTemplate.query(sql, new RowMapper<Daily>() { 3081 List<Daily> list = jdbcTemplate.query(sql, new RowMapper<Daily>() {
2912 @Override 3082 @Override
@@ -2972,10 +3142,10 @@ public class FormsServiceImpl implements FormsService { @@ -2972,10 +3142,10 @@ public class FormsServiceImpl implements FormsService {
2972 } 3142 }
2973 3143
2974 class SingledataByXlbm implements Comparator<Singledata>{ 3144 class SingledataByXlbm implements Comparator<Singledata>{
2975 - @Override  
2976 - public int compare(Singledata o1, Singledata o2) {  
2977 - // TODO Auto-generated method stub  
2978 - return (o2.getxL()+o2.getClzbh()).compareTo((o1.getxL()+o1.getClzbh()));  
2979 - } 3145 + @Override
  3146 + public int compare(Singledata o1, Singledata o2) {
  3147 + // TODO Auto-generated method stub
  3148 + return (o1.getgS()+o1.getxL()+o1.getClzbh()).compareTo((o2.getgS()+o2.getxL()+o2.getClzbh()));
  3149 + }
2980 } 3150 }
2981 } 3151 }
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
@@ -150,9 +150,9 @@ public class GpsServiceImpl implements GpsService { @@ -150,9 +150,9 @@ public class GpsServiceImpl implements GpsService {
150 * @return -1无效 0上行 1下行 150 * @return -1无效 0上行 1下行
151 */ 151 */
152 public static byte getUpOrDown(long serviceState) { 152 public static byte getUpOrDown(long serviceState) {
153 - if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000 153 + /*if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000
154 || (serviceState & 0x01000000) == 0x01000000 || (serviceState & 0x08000000) == 0x08000000) 154 || (serviceState & 0x01000000) == 0x01000000 || (serviceState & 0x08000000) == 0x08000000)
155 - return -1; 155 + return -1;*/
156 return (byte) (((serviceState & 0x10000000) == 0x10000000) ? 1 : 0); 156 return (byte) (((serviceState & 0x10000000) == 0x10000000) ? 1 : 0);
157 } 157 }
158 158
@@ -162,8 +162,8 @@ public class GpsServiceImpl implements GpsService { @@ -162,8 +162,8 @@ public class GpsServiceImpl implements GpsService {
162 * @return -1无效 0运营 1未运营 162 * @return -1无效 0运营 1未运营
163 */ 163 */
164 public static byte getService(long serviceState) { 164 public static byte getService(long serviceState) {
165 - if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000)  
166 - return -1; 165 + /*if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000)
  166 + return -1;*/
167 return (byte) (((serviceState & 0x02000000) == 0x02000000) ? 1 : 0); 167 return (byte) (((serviceState & 0x02000000) == 0x02000000) ? 1 : 0);
168 } 168 }
169 169
@@ -359,6 +359,10 @@ public class GpsServiceImpl implements GpsService { @@ -359,6 +359,10 @@ public class GpsServiceImpl implements GpsService {
359 return (byte)(((serviceState & 0x80000000) == 0x80000000) ? 1 : 0); 359 return (byte)(((serviceState & 0x80000000) == 0x80000000) ? 1 : 0);
360 } 360 }
361 361
  362 + public static void main(String[] args){
  363 + System.out.println(getGpsValid(-2147483648));
  364 + }
  365 +
362 public Map<String, ArrivalEntity> findArrivalByTs(Long st, Long et, List<DeviceChange> dcs) { 366 public Map<String, ArrivalEntity> findArrivalByTs(Long st, Long et, List<DeviceChange> dcs) {
363 Map<String, ArrivalEntity> map = new HashMap<>(); 367 Map<String, ArrivalEntity> map = new HashMap<>();
364 368
@@ -743,11 +747,12 @@ public class GpsServiceImpl implements GpsService { @@ -743,11 +747,12 @@ public class GpsServiceImpl implements GpsService {
743 row.setHeight((short) (1.5 * 256)); 747 row.setHeight((short) (1.5 * 256));
744 row.createCell(0).setCellValue("序号"); 748 row.createCell(0).setCellValue("序号");
745 row.createCell(1).setCellValue("车辆"); 749 row.createCell(1).setCellValue("车辆");
746 - row.createCell(2).setCellValue("所在道路");  
747 - row.createCell(3).setCellValue("经度");  
748 - row.createCell(4).setCellValue("纬度");  
749 - row.createCell(5).setCellValue("时间");  
750 - row.createCell(6).setCellValue("速度"); 750 + row.createCell(2).setCellValue("牌照号");
  751 + row.createCell(3).setCellValue("所在道路");
  752 + row.createCell(4).setCellValue("经度");
  753 + row.createCell(5).setCellValue("纬度");
  754 + row.createCell(6).setCellValue("时间");
  755 + row.createCell(7).setCellValue("速度");
751 //数据 756 //数据
752 DateTimeFormatter fmtHHmmss = DateTimeFormat.forPattern("HH:mm.ss"), 757 DateTimeFormatter fmtHHmmss = DateTimeFormat.forPattern("HH:mm.ss"),
753 fmt = DateTimeFormat.forPattern("yyyyMMddHHmm"); 758 fmt = DateTimeFormat.forPattern("yyyyMMddHHmm");
@@ -756,12 +761,13 @@ public class GpsServiceImpl implements GpsService { @@ -756,12 +761,13 @@ public class GpsServiceImpl implements GpsService {
756 gps = list.get(i); 761 gps = list.get(i);
757 row = sheet.createRow(i + 1); 762 row = sheet.createRow(i + 1);
758 row.createCell(0).setCellValue(i + 1); 763 row.createCell(0).setCellValue(i + 1);
759 - row.createCell(1).setCellValue(gps.getNbbm());  
760 - row.createCell(2).setCellValue(gps.getSection_name());  
761 - row.createCell(3).setCellValue(gps.getLon());  
762 - row.createCell(4).setCellValue(gps.getLat());  
763 - row.createCell(5).setCellValue(fmtHHmmss.print(gps.getTimestamp()));  
764 - row.createCell(6).setCellValue(gps.getSpeed()); 764 + row.createCell(1).setCellValue(nbbm);
  765 + row.createCell(2).setCellValue(BasicData.nbbmCompanyPlateMap.get(nbbm));
  766 + row.createCell(3).setCellValue(gps.getSection_name());
  767 + row.createCell(4).setCellValue(gps.getLon());
  768 + row.createCell(5).setCellValue(gps.getLat());
  769 + row.createCell(6).setCellValue(fmtHHmmss.print(gps.getTimestamp()));
  770 + row.createCell(7).setCellValue(gps.getSpeed());
765 } 771 }
766 772
767 st = st * 1000; 773 st = st * 1000;
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
@@ -44,6 +44,7 @@ import com.bsth.repository.oil.DlbRepository; @@ -44,6 +44,7 @@ import com.bsth.repository.oil.DlbRepository;
44 import com.bsth.repository.oil.YlbRepository; 44 import com.bsth.repository.oil.YlbRepository;
45 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; 45 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
46 import com.bsth.service.BusIntervalService; 46 import com.bsth.service.BusIntervalService;
  47 +import com.bsth.service.LineService;
47 import com.bsth.service.report.CulateMileageService; 48 import com.bsth.service.report.CulateMileageService;
48 import com.bsth.service.schedule.PeopleCarPlanService; 49 import com.bsth.service.schedule.PeopleCarPlanService;
49 import com.bsth.service.sys.DutyEmployeeService; 50 import com.bsth.service.sys.DutyEmployeeService;
@@ -60,8 +61,11 @@ import com.google.gson.Gson; @@ -60,8 +61,11 @@ import com.google.gson.Gson;
60 public class BusIntervalServiceImpl implements BusIntervalService { 61 public class BusIntervalServiceImpl implements BusIntervalService {
61 62
62 @Autowired 63 @Autowired
63 - CulateMileageService culateService; 64 + LineService lineService;
64 65
  66 + @Autowired
  67 + CulateMileageService culateService;
  68 +
65 @Autowired 69 @Autowired
66 private PeopleCarPlanService peopleCarPlanService; 70 private PeopleCarPlanService peopleCarPlanService;
67 71
@@ -113,7 +117,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -113,7 +117,10 @@ public class BusIntervalServiceImpl implements BusIntervalService {
113 } 117 }
114 } 118 }
115 if(company.length() != 0){ 119 if(company.length() != 0){
116 - sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; 120 + sql += " and gs_bm = '"+company+"'";
  121 + }
  122 + if(subCompany.length() != 0){
  123 + sql += " and fgs_bm = '"+subCompany+"'";
117 } 124 }
118 if(normal){ 125 if(normal){
119 sql += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; 126 sql += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'";
@@ -147,6 +154,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -147,6 +154,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
147 schedule.setAdjustExps(rs.getString("adjust_exps")); 154 schedule.setAdjustExps(rs.getString("adjust_exps"));
148 schedule.setJhlcOrig(rs.getDouble("jhlc_orig")); 155 schedule.setJhlcOrig(rs.getDouble("jhlc_orig"));
149 schedule.setRemarks(rs.getString("remarks")); 156 schedule.setRemarks(rs.getString("remarks"));
  157 + schedule.setFgsBm(rs.getString("fgs_bm"));
150 schedule.setGsName(rs.getString("gs_name")); 158 schedule.setGsName(rs.getString("gs_name"));
151 schedule.setFgsName(rs.getString("fgs_name")); 159 schedule.setFgsName(rs.getString("fgs_name"));
152 schedule.setDfAuto(rs.getBoolean("df_auto")); 160 schedule.setDfAuto(rs.getBoolean("df_auto"));
@@ -419,8 +427,11 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -419,8 +427,11 @@ public class BusIntervalServiceImpl implements BusIntervalService {
419 List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>(); 427 List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
420 Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); 428 Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>();
421 429
422 - String company = map.get("company").toString();  
423 - String subCompany = map.get("subCompany").toString(); 430 + String company = "", subCompany = "";
  431 + if(map.get("company")!=null)
  432 + company = map.get("company").toString();
  433 + if(map.get("subCompany")!=null)
  434 + subCompany = map.get("subCompany").toString();
424 String line = map.get("line").toString(); 435 String line = map.get("line").toString();
425 String startDate = map.get("startDate").toString(); 436 String startDate = map.get("startDate").toString();
426 String endDate = map.get("endDate").toString(); 437 String endDate = map.get("endDate").toString();
@@ -429,6 +440,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -429,6 +440,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
429 String times1 = map.get("times1").toString(); 440 String times1 = map.get("times1").toString();
430 String times2 = map.get("times2").toString(); 441 String times2 = map.get("times2").toString();
431 String type = map.get("type").toString(); 442 String type = map.get("type").toString();
  443 + String sfyy = map.get("sfyy").toString();
432 int sfqr = Integer.valueOf(map.get("sfqr").toString()); 444 int sfqr = Integer.valueOf(map.get("sfqr").toString());
433 445
434 if(startDate.length() == 0){ 446 if(startDate.length() == 0){
@@ -467,6 +479,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -467,6 +479,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
467 // int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]); 479 // int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]);
468 // int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]); 480 // int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]);
469 481
  482 + Map<String, Boolean> lineNature = lineService.lineNature();
  483 +
470 for(ScheduleRealInfo schedule : list){ 484 for(ScheduleRealInfo schedule : list){
471 if(schedule.isCcService()) 485 if(schedule.isCcService())
472 continue; 486 continue;
@@ -479,7 +493,19 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -479,7 +493,19 @@ public class BusIntervalServiceImpl implements BusIntervalService {
479 } 493 }
480 if(schedule.getXlName() == null || schedule.getXlName().trim().length() == 0) 494 if(schedule.getXlName() == null || schedule.getXlName().trim().length() == 0)
481 continue; 495 continue;
482 - String key = schedule.getXlBm() + "/" + schedule.getXlName() + "/" + schedule.getQdzName(); 496 +
  497 + if(lineNature.containsKey(schedule.getXlBm()) && lineNature.get(schedule.getXlBm()) != null){
  498 + if(sfyy.equals("1") && !lineNature.get(schedule.getXlBm())){
  499 + continue;
  500 + } else if(sfyy.equals("2") && lineNature.get(schedule.getXlBm())){
  501 + continue;
  502 + }
  503 + } else if(sfyy.equals("2")){
  504 + continue;
  505 + }
  506 +
  507 + String key = schedule.getXlBm() + "/" + schedule.getXlName() + "/" + schedule.getQdzName()
  508 + + "/" + schedule.getFgsName() + "/" + schedule.getFgsBm();
483 if(!keyMap.containsKey(key)) 509 if(!keyMap.containsKey(key))
484 keyMap.put(key, new ArrayList<ScheduleRealInfo>()); 510 keyMap.put(key, new ArrayList<ScheduleRealInfo>());
485 keyMap.get(key).add(schedule); 511 keyMap.get(key).add(schedule);
@@ -592,7 +618,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -592,7 +618,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
592 tempMap.put("line", split[1]); 618 tempMap.put("line", split[1]);
593 tempMap.put("qdz", split[2]); 619 tempMap.put("qdz", split[2]);
594 tempMap.put("company", companyName); 620 tempMap.put("company", companyName);
595 - tempMap.put("subCompany", subCompanyName); 621 + tempMap.put("subCompany", split[3]);
  622 + tempMap.put("fgsbm", split[4]);
596 long jhInterval = 0l; 623 long jhInterval = 0l;
597 long sjInterval = 0l; 624 long sjInterval = 0l;
598 for(Long i : fcsjs) 625 for(Long i : fcsjs)
@@ -622,7 +649,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -622,7 +649,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
622 Map<Long, List<Map<String, Object>>> sortMap = new HashMap<Long, List<Map<String, Object>>>(); 649 Map<Long, List<Map<String, Object>>> sortMap = new HashMap<Long, List<Map<String, Object>>>();
623 for(Map<String, Object> m : tempList){ 650 for(Map<String, Object> m : tempList){
624 String times = m.get("times").toString(); 651 String times = m.get("times").toString();
625 - Long sort = Long.valueOf(times.substring(0, 2)); 652 + Long sort = Long.valueOf(times.substring(0, 2)) * 1000l
  653 + + Long.valueOf(m.get("fgsbm").toString());
626 if(!sortMap.containsKey(sort)){ 654 if(!sortMap.containsKey(sort)){
627 sortMap.put(sort, new ArrayList<Map<String, Object>>()); 655 sortMap.put(sort, new ArrayList<Map<String, Object>>());
628 sortList.add(sort); 656 sortList.add(sort);
@@ -649,7 +677,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -649,7 +677,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
649 }else if(statu.equals("0")){ 677 }else if(statu.equals("0")){
650 List<Long> longList = new ArrayList<Long>(); 678 List<Long> longList = new ArrayList<Long>();
651 for(String key : keyList){ 679 for(String key : keyList){
652 - long xlBm = Long.valueOf(key.split("/")[0]); 680 + long xlBm = Long.valueOf(key.split("/")[4]) * 1000000l + Long.valueOf(key.split("/")[0]);
653 if(!longList.contains(xlBm)) 681 if(!longList.contains(xlBm))
654 longList.add(xlBm); 682 longList.add(xlBm);
655 Collections.sort(longList); 683 Collections.sort(longList);
@@ -657,7 +685,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -657,7 +685,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
657 for(long xlBm : longList){ 685 for(long xlBm : longList){
658 for(String key : keyList){ 686 for(String key : keyList){
659 String[] split = key.split("/"); 687 String[] split = key.split("/");
660 - if((long)Long.valueOf(split[0]) == xlBm){ 688 + long kl = Long.valueOf(split[4]) * 1000000l + Long.valueOf(split[0]);
  689 + if(kl == xlBm){
661 Map<String, Object> tempMap = new HashMap<String, Object>(); 690 Map<String, Object> tempMap = new HashMap<String, Object>();
662 List<Long> fcsjs = new ArrayList<Long>(); 691 List<Long> fcsjs = new ArrayList<Long>();
663 List<Long> fcsjAs = new ArrayList<Long>(); 692 List<Long> fcsjAs = new ArrayList<Long>();
@@ -683,7 +712,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -683,7 +712,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
683 tempMap.put("line", split[1]); 712 tempMap.put("line", split[1]);
684 tempMap.put("qdz", split[2]); 713 tempMap.put("qdz", split[2]);
685 tempMap.put("company", companyName); 714 tempMap.put("company", companyName);
686 - tempMap.put("subCompany", subCompanyName); 715 + tempMap.put("subCompany", split[3]);
  716 + tempMap.put("fgsbm", split[4]);
687 tempMap.put("jhInterval", fcsjs.size()>0?df.format((double)fcsj/fcsjs.size()):"/"); 717 tempMap.put("jhInterval", fcsjs.size()>0?df.format((double)fcsj/fcsjs.size()):"/");
688 tempMap.put("sjInterval", fcsjAs.size()>0?df.format((double)fcsjA/fcsjAs.size()):"/"); 718 tempMap.put("sjInterval", fcsjAs.size()>0?df.format((double)fcsjA/fcsjAs.size()):"/");
689 tempMap.put("MaxInterval", fcsjAs.size()>0?fcsjAs.get(fcsjAs.size() - 1):"/"); 719 tempMap.put("MaxInterval", fcsjAs.size()>0?fcsjAs.get(fcsjAs.size() - 1):"/");
@@ -745,9 +775,13 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -745,9 +775,13 @@ public class BusIntervalServiceImpl implements BusIntervalService {
745 Set<Long> tsSet = new HashSet<Long>(); 775 Set<Long> tsSet = new HashSet<Long>();
746 Set<Long> ttSet = new HashSet<Long>(); 776 Set<Long> ttSet = new HashSet<Long>();
747 777
748 - String company = map.get("company").toString();  
749 - String subCompany = map.get("subCompany").toString(); 778 + String company = "", subCompany = "";
  779 + if(map.get("company")!=null)
  780 + company = map.get("company").toString();
  781 + if(map.get("subCompany")!=null)
  782 + subCompany = map.get("subCompany").toString();
750 String lp = map.get("lp").toString(); 783 String lp = map.get("lp").toString();
  784 + String sfyy = map.get("sfyy").toString();
751 String line = map.get("line").toString(); 785 String line = map.get("line").toString();
752 String statu = map.get("statu").toString(); 786 String statu = map.get("statu").toString();
753 String startDate = map.get("startDate").toString(); 787 String startDate = map.get("startDate").toString();
@@ -775,7 +809,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -775,7 +809,10 @@ public class BusIntervalServiceImpl implements BusIntervalService {
775 where += " and lp_name = '"+lp+"'"; 809 where += " and lp_name = '"+lp+"'";
776 } 810 }
777 if(company.length() != 0){ 811 if(company.length() != 0){
778 - where += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; 812 + where += " and gs_bm = '"+company+"'";
  813 + }
  814 + if(subCompany.length() != 0){
  815 + where += " and fgs_bm = '"+subCompany+"'";
779 } 816 }
780 if(sfqr == 1){ 817 if(sfqr == 1){
781 where += " and zdsj >= '"+times1+"' and fcsj <= '"+times2+"'"; 818 where += " and zdsj >= '"+times1+"' and fcsj <= '"+times2+"'";
@@ -783,7 +820,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -783,7 +820,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
783 // where += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; 820 // where += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'";
784 where += " and bc_type != 'ldks'"; 821 where += " and bc_type != 'ldks'";
785 822
786 - String sql = "select id, schedule_date_str, real_exec_date, xl_name, lp_name, bcs, bcsj, jhlc, bc_type," 823 + String sql = "select id, schedule_date_str, real_exec_date, xl_name, lp_name, bcs, bcsj, jhlc, bc_type, xl_bm, fgs_bm,"
787 + " fcsj, fcsj_actual, zdsj, zdsj_actual, qdz_name, zdz_name, xl_dir, status, remarks, gs_name, fgs_name, sp_id" 824 + " fcsj, fcsj_actual, zdsj, zdsj_actual, qdz_name, zdz_name, xl_dir, status, remarks, gs_name, fgs_name, sp_id"
788 + " ,cc_service from bsth_c_s_sp_info_real where schedule_date_str >= '"+startDate+"'" 825 + " ,cc_service from bsth_c_s_sp_info_real where schedule_date_str >= '"+startDate+"'"
789 + " and schedule_date_str <= '"+endDate+"'"+where+""; 826 + " and schedule_date_str <= '"+endDate+"'"+where+"";
@@ -796,6 +833,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -796,6 +833,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
796 schedule.setId(rs.getLong("id")); 833 schedule.setId(rs.getLong("id"));
797 schedule.setScheduleDateStr(rs.getString("schedule_date_str")); 834 schedule.setScheduleDateStr(rs.getString("schedule_date_str"));
798 schedule.setRealExecDate(rs.getString("real_exec_date")); 835 schedule.setRealExecDate(rs.getString("real_exec_date"));
  836 + schedule.setXlBm(rs.getString("xl_bm"));
799 schedule.setXlName(rs.getString("xl_name")); 837 schedule.setXlName(rs.getString("xl_name"));
800 schedule.setLpName(rs.getString("lp_name")); 838 schedule.setLpName(rs.getString("lp_name"));
801 schedule.setBcs(rs.getInt("bcs")); 839 schedule.setBcs(rs.getInt("bcs"));
@@ -813,6 +851,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -813,6 +851,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
813 schedule.setRemarks(rs.getString("remarks")); 851 schedule.setRemarks(rs.getString("remarks"));
814 schedule.setGsName(rs.getString("gs_name")); 852 schedule.setGsName(rs.getString("gs_name"));
815 schedule.setFgsName(rs.getString("fgs_name")); 853 schedule.setFgsName(rs.getString("fgs_name"));
  854 + schedule.setFgsBm(rs.getString("fgs_bm"));
816 schedule.setSpId(rs.getLong("sp_id")); 855 schedule.setSpId(rs.getLong("sp_id"));
817 schedule.setCcService(rs.getBoolean("cc_service")); 856 schedule.setCcService(rs.getBoolean("cc_service"));
818 857
@@ -877,7 +916,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -877,7 +916,10 @@ public class BusIntervalServiceImpl implements BusIntervalService {
877 sql += " and xl_bm = '"+line+"'"; 916 sql += " and xl_bm = '"+line+"'";
878 } 917 }
879 if(company.length() != 0){ 918 if(company.length() != 0){
880 - sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; 919 + sql += " and gs_bm = '"+company+"'";
  920 + }
  921 + if(subCompany.length() != 0){
  922 + sql += " and fgs_bm = '"+subCompany+"'";
881 } 923 }
882 temp1 = jdbcTemplate.query(sql, 924 temp1 = jdbcTemplate.query(sql,
883 new RowMapper<Map<String, String>>(){ 925 new RowMapper<Map<String, String>>(){
@@ -1002,13 +1044,26 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1002,13 +1044,26 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1002 cMap.get(key).add(cTask); 1044 cMap.get(key).add(cTask);
1003 } 1045 }
1004 1046
  1047 + Map<String, Boolean> lineNature = lineService.lineNature();
  1048 +
1005 for(ScheduleRealInfo schedule : list){ 1049 for(ScheduleRealInfo schedule : list){
1006 if(schedule.getXlName()==null || schedule.getXlName().trim().length()==0 1050 if(schedule.getXlName()==null || schedule.getXlName().trim().length()==0
1007 || schedule.isCcService()) 1051 || schedule.isCcService())
1008 continue; 1052 continue;
  1053 + String xlBm = schedule.getXlBm();
  1054 + if(lineNature.containsKey(xlBm) && lineNature.get(xlBm) != null){
  1055 + if(sfyy.equals("1") && !lineNature.get(xlBm)){
  1056 + continue;
  1057 + } else if(sfyy.equals("2") && lineNature.get(xlBm)){
  1058 + continue;
  1059 + }
  1060 + } else if(sfyy.equals("2")){
  1061 + continue;
  1062 + }
  1063 + String key = schedule.getScheduleDateStr() + "/" + schedule.getXlName() + "/"
  1064 + + schedule.getLpName() + "/" + schedule.getFgsName();
1009 if(model.length() != 0){ 1065 if(model.length() != 0){
1010 if(ttSet.contains(schedule.getSpId())){ 1066 if(ttSet.contains(schedule.getSpId())){
1011 - String key = schedule.getScheduleDateStr() + "/" + schedule.getXlName() + "/" + schedule.getLpName();  
1012 if(!keyMap.containsKey(key)) 1067 if(!keyMap.containsKey(key))
1013 keyMap.put(key, new ArrayList<ScheduleRealInfo>()); 1068 keyMap.put(key, new ArrayList<ScheduleRealInfo>());
1014 keyMap.get(key).add(schedule); 1069 keyMap.get(key).add(schedule);
@@ -1023,7 +1078,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1023,7 +1078,6 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1023 // } 1078 // }
1024 // } 1079 // }
1025 }else{ 1080 }else{
1026 - String key = schedule.getScheduleDateStr() + "/" + schedule.getXlName() + "/" + schedule.getLpName();  
1027 if(!keyMap.containsKey(key)) 1081 if(!keyMap.containsKey(key))
1028 keyMap.put(key, new ArrayList<ScheduleRealInfo>()); 1082 keyMap.put(key, new ArrayList<ScheduleRealInfo>());
1029 keyMap.get(key).add(schedule); 1083 keyMap.get(key).add(schedule);
@@ -1081,9 +1135,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1081,9 +1135,6 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1081 }else{ 1135 }else{
1082 jhyysj += fcsj2 - fcsj1; 1136 jhyysj += fcsj2 - fcsj1;
1083 } 1137 }
1084 - if(jhyysj < 0){  
1085 - System.out.println(fcsj2 + " - " + fcsj1 + " = " + (fcsj2 - fcsj1));  
1086 - }  
1087 jhyysj1 += fcsj2 - fcsj1; 1138 jhyysj1 += fcsj2 - fcsj1;
1088 } 1139 }
1089 if(i == 1 && schedule1.getBcType().toString().equals("normal")){ 1140 if(i == 1 && schedule1.getBcType().toString().equals("normal")){
@@ -1220,9 +1271,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1220,9 +1271,9 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1220 sjlc += Double.valueOf(m.get("lc").toString()); 1271 sjlc += Double.valueOf(m.get("lc").toString());
1221 } 1272 }
1222 } 1273 }
1223 - tempMap.put("company", companyName);  
1224 - tempMap.put("subCompany", subCompanyName);  
1225 String[] split = key.split("/"); 1274 String[] split = key.split("/");
  1275 + tempMap.put("company", companyName);
  1276 + tempMap.put("subCompany", split[3]);
1226 tempMap.put("date", split[0]); 1277 tempMap.put("date", split[0]);
1227 tempMap.put("line", split[1]); 1278 tempMap.put("line", split[1]);
1228 tempMap.put("lp", split[2]); 1279 tempMap.put("lp", split[2]);
@@ -1272,7 +1323,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1272,7 +1323,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1272 } 1323 }
1273 Map<String, List<Map<String, Object>>> keyMap2 = new HashMap<String, List<Map<String, Object>>>(); 1324 Map<String, List<Map<String, Object>>> keyMap2 = new HashMap<String, List<Map<String, Object>>>();
1274 for(Map<String, Object> m : resList){ 1325 for(Map<String, Object> m : resList){
1275 - String key = m.get("line").toString() + "/" + m.get("lp").toString(); 1326 + String key = m.get("line").toString() + "/" + m.get("lp").toString()
  1327 + + "/" + m.get("subCompany").toString();
1276 if(!keyMap2.containsKey(key)) 1328 if(!keyMap2.containsKey(key))
1277 keyMap2.put(key, new ArrayList<Map<String, Object>>()); 1329 keyMap2.put(key, new ArrayList<Map<String, Object>>());
1278 keyMap2.get(key).add(m); 1330 keyMap2.get(key).add(m);
@@ -1333,6 +1385,32 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1333,6 +1385,32 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1333 return a.compareTo(b); 1385 return a.compareTo(b);
1334 } 1386 }
1335 }); 1387 });
  1388 + Collections.sort(list3, new Comparator<String>() {
  1389 +
  1390 + public int compare(String o1, String o2) {
  1391 +
  1392 + Long a = 0l;
  1393 + Long b = 0l;
  1394 + String[] split1 = o1.split("/");
  1395 + String[] split2 = o2.split("/");
  1396 + char[] charArray1 = split1[2].toCharArray();
  1397 + char[] charArray2 = split2[2].toCharArray();
  1398 + for(int i = 0; i < charArray1.length; i++){
  1399 + long temp = 1l;
  1400 + for(int j = 0; j < i; j++)
  1401 + temp *= 10;
  1402 + a += (long)charArray1[charArray1.length - 1 - i] * temp;
  1403 + }
  1404 + for(int i = 0; i < charArray2.length; i++){
  1405 + long temp = 1l;
  1406 + for(int j = 0; j < i; j++)
  1407 + temp *= 10;
  1408 + b += (long)charArray2[charArray2.length - 1 - i] * temp;
  1409 + }
  1410 +
  1411 + return a.compareTo(b);
  1412 + }
  1413 + });
1336 for(String key : list3){ 1414 for(String key : list3){
1337 Map<String, Object> tempMap = new HashMap<String, Object>(); 1415 Map<String, Object> tempMap = new HashMap<String, Object>();
1338 BigDecimal jhyysj = new BigDecimal(0), jhyssj = new BigDecimal(0); 1416 BigDecimal jhyysj = new BigDecimal(0), jhyssj = new BigDecimal(0);
@@ -1362,7 +1440,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1362,7 +1440,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1362 tempMap.put("line", split[0]); 1440 tempMap.put("line", split[0]);
1363 tempMap.put("lp", split[1]); 1441 tempMap.put("lp", split[1]);
1364 tempMap.put("company", companyName); 1442 tempMap.put("company", companyName);
1365 - tempMap.put("subCompany", subCompanyName); 1443 + tempMap.put("subCompany", split[2]);
1366 tempMap.put("date", date); 1444 tempMap.put("date", date);
1367 list4.add(tempMap); 1445 list4.add(tempMap);
1368 } 1446 }
@@ -1373,7 +1451,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1373,7 +1451,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1373 List<Map<String, Object>> list5 = new ArrayList<Map<String, Object>>(); 1451 List<Map<String, Object>> list5 = new ArrayList<Map<String, Object>>();
1374 List<String> keyList = new ArrayList<String>(); 1452 List<String> keyList = new ArrayList<String>();
1375 for(Map<String, Object> m : list4){ 1453 for(Map<String, Object> m : list4){
1376 - String key = m.get("line").toString(); 1454 + String key = m.get("line").toString() + "/" + m.get("subCompany").toString();
1377 if(!keyMap4.containsKey(key)){ 1455 if(!keyMap4.containsKey(key)){
1378 keyList.add(key); 1456 keyList.add(key);
1379 keyMap4.put(key, new ArrayList<Map<String, Object>>()); 1457 keyMap4.put(key, new ArrayList<Map<String, Object>>());
@@ -1405,10 +1483,11 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1405,10 +1483,11 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1405 tempMap.put("sjyssj", sjyssj.equals(0)?0:sjyssj.divide(size, 2, RoundingMode.HALF_UP)); 1483 tempMap.put("sjyssj", sjyssj.equals(0)?0:sjyssj.divide(size, 2, RoundingMode.HALF_UP));
1406 tempMap.put("sjyycs", sjyycs.equals(0)?0:sjyycs.divide(size, 2, RoundingMode.HALF_UP)); 1484 tempMap.put("sjyycs", sjyycs.equals(0)?0:sjyycs.divide(size, 2, RoundingMode.HALF_UP));
1407 tempMap.put("sjyscs", sjyscs.equals(0)?0:sjyscs.divide(size, 2, RoundingMode.HALF_UP)); 1485 tempMap.put("sjyscs", sjyscs.equals(0)?0:sjyscs.divide(size, 2, RoundingMode.HALF_UP));
1408 - tempMap.put("line", key); 1486 + String[] split = key.split("/");
  1487 + tempMap.put("line", split[0]);
1409 tempMap.put("lp", keyMap4.get(key).size()); 1488 tempMap.put("lp", keyMap4.get(key).size());
1410 tempMap.put("company", companyName); 1489 tempMap.put("company", companyName);
1411 - tempMap.put("subCompany", subCompanyName); 1490 + tempMap.put("subCompany", split[1]);
1412 tempMap.put("date", date); 1491 tempMap.put("date", date);
1413 tempMap.put("work", keyMap4.get(key)); 1492 tempMap.put("work", keyMap4.get(key));
1414 list5.add(tempMap); 1493 list5.add(tempMap);
@@ -1491,8 +1570,13 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1491,8 +1570,13 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1491 Map<String, List<Map<String, Object>>> keyMap0 = new HashMap<String, List<Map<String, Object>>>(); 1570 Map<String, List<Map<String, Object>>> keyMap0 = new HashMap<String, List<Map<String, Object>>>();
1492 Map<String, List<Map<String, Object>>> keyMap1 = new HashMap<String, List<Map<String, Object>>>(); 1571 Map<String, List<Map<String, Object>>> keyMap1 = new HashMap<String, List<Map<String, Object>>>();
1493 1572
1494 - String company = map.get("company").toString();  
1495 - String subCompany = map.get("subCompany").toString(); 1573 + String sfqr = "", company = "", subCompany = "";
  1574 + if(map.get("sfqr")!=null)
  1575 + sfqr = map.get("sfqr").toString();
  1576 + if(map.get("company")!=null)
  1577 + company = map.get("company").toString();
  1578 + if(map.get("subCompany")!=null)
  1579 + subCompany = map.get("subCompany").toString();
1496 String line = map.get("line").toString(); 1580 String line = map.get("line").toString();
1497 String startDate = map.get("startDate").toString(); 1581 String startDate = map.get("startDate").toString();
1498 String endDate = map.get("endDate").toString(); 1582 String endDate = map.get("endDate").toString();
@@ -1510,6 +1594,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1510,6 +1594,9 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1510 if(times.length() == 0){ 1594 if(times.length() == 0){
1511 times = "05:00-23:00"; 1595 times = "05:00-23:00";
1512 } 1596 }
  1597 + if(sfqr.equals("0")){
  1598 + times = "";
  1599 + }
1513 1600
1514 list = getSchedule(company, subCompany, line, startDate, endDate, model, times, false); 1601 list = getSchedule(company, subCompany, line, startDate, endDate, model, times, false);
1515 1602
@@ -1522,9 +1609,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1522,9 +1609,9 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1522 date = startDate; 1609 date = startDate;
1523 } 1610 }
1524 1611
1525 - String[] split = times.split("-");  
1526 - int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]);  
1527 - int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]); 1612 +// String[] split = times.split("-");
  1613 +// int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]);
  1614 +// int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]);
1528 1615
1529 for(ScheduleRealInfo s : list){ 1616 for(ScheduleRealInfo s : list){
1530 if(s.isCcService()){ 1617 if(s.isCcService()){
@@ -1708,7 +1795,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1708,7 +1795,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1708 1795
1709 Map<String, Object> m = mapList.get(0); 1796 Map<String, Object> m = mapList.get(0);
1710 tempMap.put("dates", date); 1797 tempMap.put("dates", date);
1711 - tempMap.put("times", times); 1798 + tempMap.put("times", times.length()==0?"全日":times);
1712 tempMap.put("line", m.get("line")); 1799 tempMap.put("line", m.get("line"));
1713 tempMap.put("lp", m.get("lp")); 1800 tempMap.put("lp", m.get("lp"));
1714 tempMap.put("station", m.get("station")); 1801 tempMap.put("station", m.get("station"));
@@ -1730,10 +1817,14 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1730,10 +1817,14 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1730 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); 1817 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
1731 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); 1818 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
1732 Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); 1819 Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>();
1733 -  
1734 - String company = map.get("company").toString();  
1735 - String subCompany = map.get("subCompany").toString(); 1820 +
  1821 + String company = "", subCompany = "";
  1822 + String sfyy = map.get("sfyy").toString();
1736 String line = map.get("line").toString(); 1823 String line = map.get("line").toString();
  1824 + if(map.get("company")!=null)
  1825 + company = map.get("company").toString();
  1826 + if(map.get("subCompany")!=null)
  1827 + subCompany = map.get("subCompany").toString();
1737 String startDate = map.get("startDate").toString(); 1828 String startDate = map.get("startDate").toString();
1738 String endDate = map.get("endDate").toString(); 1829 String endDate = map.get("endDate").toString();
1739 String model = map.get("model").toString(); 1830 String model = map.get("model").toString();
@@ -1777,17 +1868,86 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1777,17 +1868,86 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1777 int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]); 1868 int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]);
1778 int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]); 1869 int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]);
1779 1870
  1871 + Map<String, Boolean> lineNature = lineService.lineNature();
  1872 +
1780 for(ScheduleRealInfo schedule : list){ 1873 for(ScheduleRealInfo schedule : list){
1781 Long fcsj = schedule.getFcsjT(); 1874 Long fcsj = schedule.getFcsjT();
1782 if(sfqr == 1 && !(endTime!=0?fcsj>=startTime&&fcsj<endTime:fcsj>=startTime)){ 1875 if(sfqr == 1 && !(endTime!=0?fcsj>=startTime&&fcsj<endTime:fcsj>=startTime)){
1783 continue; 1876 continue;
1784 } 1877 }
1785 - String key = schedule.getXlName(); 1878 +
  1879 + String xlBm = schedule.getXlBm();
  1880 + if(lineNature.containsKey(xlBm) && lineNature.get(xlBm) != null){
  1881 + if(sfyy.equals("1") && !lineNature.get(xlBm)){
  1882 + continue;
  1883 + } else if(sfyy.equals("2") && lineNature.get(xlBm)){
  1884 + continue;
  1885 + }
  1886 + } else if(sfyy.equals("2")){
  1887 + continue;
  1888 + }
  1889 +
  1890 + String key = schedule.getXlName() + "/" + schedule.getFgsName();
1786 if(!keyMap.containsKey(key)) 1891 if(!keyMap.containsKey(key))
1787 keyMap.put(key, new ArrayList<ScheduleRealInfo>()); 1892 keyMap.put(key, new ArrayList<ScheduleRealInfo>());
1788 keyMap.get(key).add(schedule); 1893 keyMap.get(key).add(schedule);
1789 } 1894 }
1790 1895
  1896 + List<String> keyList = new ArrayList<String>();
  1897 + keyList.addAll(keyMap.keySet());
  1898 + Collections.sort(keyList, new Comparator<String>() {
  1899 +
  1900 + public int compare(String o1, String o2) {
  1901 +
  1902 + Long a = 0l;
  1903 + Long b = 0l;
  1904 + String[] split1 = o1.split("/");
  1905 + String[] split2 = o2.split("/");
  1906 + char[] charArray1 = split1[0].toCharArray();
  1907 + char[] charArray2 = split2[0].toCharArray();
  1908 + for(int i = 0; i < charArray1.length; i++){
  1909 + long temp = 1l;
  1910 + for(int j = 0; j < i; j++)
  1911 + temp *= 10;
  1912 + a += (long)charArray1[charArray1.length - 1 - i] * temp;
  1913 + }
  1914 + for(int i = 0; i < charArray2.length; i++){
  1915 + long temp = 1l;
  1916 + for(int j = 0; j < i; j++)
  1917 + temp *= 10;
  1918 + b += (long)charArray2[charArray2.length - 1 - i] * temp;
  1919 + }
  1920 +
  1921 + return a.compareTo(b);
  1922 + }
  1923 + });
  1924 + Collections.sort(keyList, new Comparator<String>() {
  1925 +
  1926 + public int compare(String o1, String o2) {
  1927 +
  1928 + Long a = 0l;
  1929 + Long b = 0l;
  1930 + String[] split1 = o1.split("/");
  1931 + String[] split2 = o2.split("/");
  1932 + char[] charArray1 = split1[1].toCharArray();
  1933 + char[] charArray2 = split2[1].toCharArray();
  1934 + for(int i = 0; i < charArray1.length; i++){
  1935 + long temp = 1l;
  1936 + for(int j = 0; j < i; j++)
  1937 + temp *= 10;
  1938 + a += (long)charArray1[charArray1.length - 1 - i] * temp;
  1939 + }
  1940 + for(int i = 0; i < charArray2.length; i++){
  1941 + long temp = 1l;
  1942 + for(int j = 0; j < i; j++)
  1943 + temp *= 10;
  1944 + b += (long)charArray2[charArray2.length - 1 - i] * temp;
  1945 + }
  1946 +
  1947 + return a.compareTo(b);
  1948 + }
  1949 + });
  1950 +
1791 Map<String, Object> temp = new HashMap<String, Object>(); 1951 Map<String, Object> temp = new HashMap<String, Object>();
1792 int jhbc_ = 0, sjbc_ = 0, 1952 int jhbc_ = 0, sjbc_ = 0,
1793 lzbc_ = 0, dmbc_ = 0, 1953 lzbc_ = 0, dmbc_ = 0,
@@ -1801,7 +1961,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1801,7 +1961,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1801 qclc_ = new BigDecimal("0"), kxlc_ = new BigDecimal("0"), 1961 qclc_ = new BigDecimal("0"), kxlc_ = new BigDecimal("0"),
1802 qhlc_ = new BigDecimal("0"), wylc_ = new BigDecimal("0"), 1962 qhlc_ = new BigDecimal("0"), wylc_ = new BigDecimal("0"),
1803 qtlc_ = new BigDecimal("0"); 1963 qtlc_ = new BigDecimal("0");
1804 - for(String key : keyMap.keySet()){ 1964 +// for(String key : keyMap.keySet()){
  1965 + for(String key : keyList){
1805 Map<String, Object> tempMap = new HashMap<String, Object>(); 1966 Map<String, Object> tempMap = new HashMap<String, Object>();
1806 int jhbc = 0, sjbc = 0, 1967 int jhbc = 0, sjbc = 0,
1807 lzbc = 0, dmbc = 0, 1968 lzbc = 0, dmbc = 0,
@@ -1907,11 +2068,12 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1907,11 +2068,12 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1907 if(jhlc.doubleValue() == 0d){ 2068 if(jhlc.doubleValue() == 0d){
1908 flag = false; 2069 flag = false;
1909 } 2070 }
  2071 + String[] keys = key.split("/");
1910 tempMap.put("date", Date); 2072 tempMap.put("date", Date);
1911 tempMap.put("company", companyName); 2073 tempMap.put("company", companyName);
1912 - tempMap.put("subCompany", subCompanyName); 2074 + tempMap.put("subCompany", keys[1]);
1913 tempMap.put("times", sfqr == 1 ? times : "全日"); 2075 tempMap.put("times", sfqr == 1 ? times : "全日");
1914 - tempMap.put("line", key); 2076 + tempMap.put("line", keys[0]);
1915 tempMap.put("jhbc", jhbc); 2077 tempMap.put("jhbc", jhbc);
1916 tempMap.put("sjbc", sjbc); 2078 tempMap.put("sjbc", sjbc);
1917 tempMap.put("bcbfb", df.format(jhbc>0?(double)sjbc/jhbc*100:0)+"%"); 2079 tempMap.put("bcbfb", df.format(jhbc>0?(double)sjbc/jhbc*100:0)+"%");
@@ -2055,10 +2217,14 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2055,10 +2217,14 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2055 Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); 2217 Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>();
2056 Map<String, List<Map<String, Object>>> keyMap0 = new HashMap<String, List<Map<String, Object>>>(); 2218 Map<String, List<Map<String, Object>>> keyMap0 = new HashMap<String, List<Map<String, Object>>>();
2057 Map<String, List<Map<String, Object>>> keyMap1 = new HashMap<String, List<Map<String, Object>>>(); 2219 Map<String, List<Map<String, Object>>> keyMap1 = new HashMap<String, List<Map<String, Object>>>();
2058 -  
2059 - String company = map.get("company").toString();  
2060 - String subCompany = map.get("subCompany").toString(); 2220 +
  2221 + String company = "", subCompany = "";
  2222 + String sfyy = map.get("sfyy").toString();
2061 String line = map.get("line").toString(); 2223 String line = map.get("line").toString();
  2224 + if(map.get("company")!=null)
  2225 + company = map.get("company").toString();
  2226 + if(map.get("subCompany")!=null)
  2227 + subCompany = map.get("subCompany").toString();
2062 String startDate = map.get("startDate").toString(); 2228 String startDate = map.get("startDate").toString();
2063 String endDate = map.get("endDate").toString(); 2229 String endDate = map.get("endDate").toString();
2064 String times = map.get("times").toString(); 2230 String times = map.get("times").toString();
@@ -2091,7 +2257,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2091,7 +2257,10 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2091 } 2257 }
2092 } 2258 }
2093 if(company.length() != 0){ 2259 if(company.length() != 0){
2094 - sql += " and (gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"')"; 2260 + sql += " and gs_bm = '"+company+"'";
  2261 + }
  2262 + if(subCompany.length() != 0){
  2263 + sql += " and fgs_bm = '"+subCompany+"'";
2095 } 2264 }
2096 sql += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; 2265 sql += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'";
2097 2266
@@ -2152,10 +2321,23 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2152,10 +2321,23 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2152 date = startDate; 2321 date = startDate;
2153 else 2322 else
2154 date = startDate + "--" + endDate; 2323 date = startDate + "--" + endDate;
  2324 +
  2325 + Map<String, Boolean> lineNature = lineService.lineNature();
2155 2326
2156 for(ScheduleRealInfo schedule : list){ 2327 for(ScheduleRealInfo schedule : list){
2157 if(schedule.getXlName() == null || schedule.getXlName().trim().length() == 0) 2328 if(schedule.getXlName() == null || schedule.getXlName().trim().length() == 0)
2158 continue; 2329 continue;
  2330 + String xlBm = schedule.getXlBm();
  2331 + if(lineNature.containsKey(xlBm) && lineNature.get(xlBm) != null){
  2332 + if(sfyy.equals("1") && !lineNature.get(xlBm)){
  2333 + continue;
  2334 + } else if(sfyy.equals("2") && lineNature.get(xlBm)){
  2335 + continue;
  2336 + }
  2337 + } else if(sfyy.equals("2")){
  2338 + continue;
  2339 + }
  2340 +
2159 String key = schedule.getGsName() + "/" + schedule.getFgsName() + "/" + schedule.getXlBm(); 2341 String key = schedule.getGsName() + "/" + schedule.getFgsName() + "/" + schedule.getXlBm();
2160 if(!keyMap.containsKey(key)) 2342 if(!keyMap.containsKey(key))
2161 keyMap.put(key, new ArrayList<ScheduleRealInfo>()); 2343 keyMap.put(key, new ArrayList<ScheduleRealInfo>());
@@ -2339,13 +2521,14 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2339,13 +2521,14 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2339 // tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%"); 2521 // tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%");
2340 resList.add(tempMap); 2522 resList.add(tempMap);
2341 } 2523 }
  2524 +
2342 //计算掉线调整 2525 //计算掉线调整
2343 String sqldot = "select * from " 2526 String sqldot = "select * from "
2344 - + "logger_sch_modify where gsbm =? and fgsbm=? and rq BETWEEN ? and ? order by line_code,sch_id";  
2345 -  
2346 - ; 2527 + + "logger_sch_modify where gsbm = ? and fgsbm like ? and rq BETWEEN ? and ? order by line_code,sch_id";
  2528 +
  2529 +
2347 List<SchEditInfoDto> listDot = jdbcTemplate.query(sqldot, 2530 List<SchEditInfoDto> listDot = jdbcTemplate.query(sqldot,
2348 - new BeanPropertyRowMapper(SchEditInfoDto.class),company,subCompany,map.get("startDate").toString(),map.get("endDate").toString()); 2531 + new BeanPropertyRowMapper(SchEditInfoDto.class),company,"%"+subCompany+"%",map.get("startDate").toString(),map.get("endDate").toString());
2349 int dxtzz=0; 2532 int dxtzz=0;
2350 Map<String, Object> mapSchId=new HashMap<String,Object>(); 2533 Map<String, Object> mapSchId=new HashMap<String,Object>();
2351 for (int i = 0; i < resList.size(); i++) { 2534 for (int i = 0; i < resList.size(); i++) {
@@ -2604,7 +2787,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2604,7 +2787,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2604 Map.put("xlName", s.getXlName()); 2787 Map.put("xlName", s.getXlName());
2605 Map.put("clZbh", s.getClZbh()); 2788 Map.put("clZbh", s.getClZbh());
2606 Map.put("plate", BasicData.nbbmCompanyPlateMap.get(s.getClZbh())); 2789 Map.put("plate", BasicData.nbbmCompanyPlateMap.get(s.getClZbh()));
2607 - Map.put("fcsjActual", s.getFcsjActual()); 2790 + Map.put("fcsjActual", s.getFcsjActual()==null?"":s.getFcsjActual());
2608 Map.put("zdzName", s.getZdzName()); 2791 Map.put("zdzName", s.getZdzName());
2609 Map.put("scheduleDate", s.getScheduleDateStr()); 2792 Map.put("scheduleDate", s.getScheduleDateStr());
2610 Map.put("lpName", s.getLpName()); 2793 Map.put("lpName", s.getLpName());
@@ -2860,21 +3043,28 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2860,21 +3043,28 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2860 String startDate = map.get("startDate").toString().trim(); 3043 String startDate = map.get("startDate").toString().trim();
2861 String endDate = map.get("endDate").toString().trim(); 3044 String endDate = map.get("endDate").toString().trim();
2862 String line = map.get("line").toString().trim(); 3045 String line = map.get("line").toString().trim();
2863 - String company = map.get("gs").toString().trim();  
2864 - String subCompany = map.get("fgs").toString().trim(); 3046 + String company = "", subCompany = "";
  3047 + if(map.get("gs")!=null)
  3048 + company = map.get("gs").toString().trim();
  3049 + if(map.get("fgs")!=null)
  3050 + subCompany = map.get("fgs").toString().trim();
  3051 + String sfyy = "";
  3052 + if(map.get("sfyy")!=null)
  3053 + sfyy = map.get("sfyy").toString().trim();
2865 3054
2866 String sql = "select id, cl_zbh, fcsj, fcsj_actual, j_gh, j_name, lp_name, qdz_name, " + 3055 String sql = "select id, cl_zbh, fcsj, fcsj_actual, j_gh, j_name, lp_name, qdz_name, " +
2867 - "schedule_date_str, xl_name, zdsj, zdsj_actual, fgs_name, gs_name, xl_dir, xl_bm " + 3056 + "schedule_date_str, xl_name, zdsj, zdsj_actual, fgs_bm, fgs_name, gs_name, xl_dir, xl_bm " +
2868 "from bsth_c_s_sp_info_real " + 3057 "from bsth_c_s_sp_info_real " +
2869 "where schedule_date_str >= '"+startDate+"' and schedule_date_str <= '"+endDate+"' " + 3058 "where schedule_date_str >= '"+startDate+"' and schedule_date_str <= '"+endDate+"' " +
2870 "and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' and cc_service = 0"; 3059 "and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' and cc_service = 0";
2871 3060
2872 if(company.length() != 0) 3061 if(company.length() != 0)
2873 - sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; 3062 + sql += " and gs_bm = '"+company+"'";
  3063 + if(subCompany.length() != 0)
  3064 + sql += " and fgs_bm = '"+subCompany+"'";
2874 if(line.length() != 0) 3065 if(line.length() != 0)
2875 sql += " and xl_bm = '"+line+"'"; 3066 sql += " and xl_bm = '"+line+"'";
2876 3067
2877 - System.out.println(sql);  
2878 List<ScheduleRealInfo> list = jdbcTemplate.query(sql, 3068 List<ScheduleRealInfo> list = jdbcTemplate.query(sql,
2879 new RowMapper<ScheduleRealInfo>(){ 3069 new RowMapper<ScheduleRealInfo>(){
2880 @Override 3070 @Override
@@ -2893,6 +3083,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2893,6 +3083,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2893 schedule.setQdzName(rs.getString("qdz_name")); 3083 schedule.setQdzName(rs.getString("qdz_name"));
2894 schedule.setGsName(rs.getString("gs_name")); 3084 schedule.setGsName(rs.getString("gs_name"));
2895 schedule.setFgsName(rs.getString("fgs_name")); 3085 schedule.setFgsName(rs.getString("fgs_name"));
  3086 + schedule.setFgsBm(rs.getString("fgs_bm"));
2896 schedule.setClZbh(rs.getString("cl_zbh")); 3087 schedule.setClZbh(rs.getString("cl_zbh"));
2897 schedule.setjGh(rs.getString("j_gh")); 3088 schedule.setjGh(rs.getString("j_gh"));
2898 schedule.setjName(rs.getString("j_name")); 3089 schedule.setjName(rs.getString("j_name"));
@@ -2903,8 +3094,21 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2903,8 +3094,21 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2903 Map<String, Map<String, List<ScheduleRealInfo>>> sches = new HashMap<String, Map<String, List<ScheduleRealInfo>>>(); 3094 Map<String, Map<String, List<ScheduleRealInfo>>> sches = new HashMap<String, Map<String, List<ScheduleRealInfo>>>();
2904 Map<String, List<List<Map<String, Object>>>> keyMap = new HashMap<String, List<List<Map<String, Object>>>>(); 3095 Map<String, List<List<Map<String, Object>>>> keyMap = new HashMap<String, List<List<Map<String, Object>>>>();
2905 3096
  3097 + Map<String, Boolean> lineNature = lineService.lineNature();
  3098 +
2906 for(ScheduleRealInfo s : list){ 3099 for(ScheduleRealInfo s : list){
2907 - String xl = s.getXlName(); 3100 + String xlBm = s.getXlBm();
  3101 + if(lineNature.containsKey(xlBm) && lineNature.get(xlBm) != null){
  3102 + if(sfyy.equals("1") && !lineNature.get(xlBm)){
  3103 + continue;
  3104 + } else if(sfyy.equals("2") && lineNature.get(xlBm)){
  3105 + continue;
  3106 + }
  3107 + } else if(sfyy.equals("2")){
  3108 + continue;
  3109 + }
  3110 +
  3111 + String xl = s.getXlName() + "/" + s.getFgsName();
2908 String dateStr = s.getScheduleDateStr(); 3112 String dateStr = s.getScheduleDateStr();
2909 if(!sches.containsKey(xl)){ 3113 if(!sches.containsKey(xl)){
2910 sches.put(xl, new HashMap<String, List<ScheduleRealInfo>>()); 3114 sches.put(xl, new HashMap<String, List<ScheduleRealInfo>>());
@@ -2956,6 +3160,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2956,6 +3160,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2956 Map<String, Object> temp = new HashMap<String, Object>(); 3160 Map<String, Object> temp = new HashMap<String, Object>();
2957 temp.put("gs", s.getGsName()); 3161 temp.put("gs", s.getGsName());
2958 temp.put("fgs", s.getFgsName()); 3162 temp.put("fgs", s.getFgsName());
  3163 + temp.put("fgsBm", s.getFgsBm());
2959 temp.put("date", date); 3164 temp.put("date", date);
2960 temp.put("xlbm", s.getXlBm()); 3165 temp.put("xlbm", s.getXlBm());
2961 temp.put("line", s.getXlName()); 3166 temp.put("line", s.getXlName());
@@ -3020,6 +3225,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -3020,6 +3225,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
3020 } 3225 }
3021 tempMap.put("gs", list1.get(0).get(0).get("gs")); 3226 tempMap.put("gs", list1.get(0).get(0).get("gs"));
3022 tempMap.put("fgs", list1.get(0).get(0).get("fgs")); 3227 tempMap.put("fgs", list1.get(0).get(0).get("fgs"));
  3228 + tempMap.put("fgsBm", list1.get(0).get(0).get("fgsBm"));
3023 tempMap.put("line", list1.get(0).get(0).get("line")); 3229 tempMap.put("line", list1.get(0).get(0).get("line"));
3024 tempMap.put("date", list1.get(0).get(0).get("date")); 3230 tempMap.put("date", list1.get(0).get(0).get("date"));
3025 tempMap.put("xlbm", list1.get(0).get(0).get("xlbm")); 3231 tempMap.put("xlbm", list1.get(0).get(0).get("xlbm"));
@@ -3077,6 +3283,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -3077,6 +3283,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
3077 } 3283 }
3078 tempMap.put("gs", list2.get(0).get("gs")); 3284 tempMap.put("gs", list2.get(0).get("gs"));
3079 tempMap.put("fgs", list2.get(0).get("fgs")); 3285 tempMap.put("fgs", list2.get(0).get("fgs"));
  3286 + tempMap.put("fgsBm", list2.get(0).get("fgsBm"));
3080 tempMap.put("line", list2.get(0).get("line")); 3287 tempMap.put("line", list2.get(0).get("line"));
3081 tempMap.put("date", list2.get(0).get("date")); 3288 tempMap.put("date", list2.get(0).get("date"));
3082 tempMap.put("xl_date", list2.get(0).get("date") + "_" + list2.get(0).get("xlbm") + "_" + list2.get(0).get("line")); 3289 tempMap.put("xl_date", list2.get(0).get("date") + "_" + list2.get(0).get("xlbm") + "_" + list2.get(0).get("line"));
src/main/java/com/bsth/service/impl/LineServiceImpl.java
@@ -6,10 +6,14 @@ import com.bsth.repository.LineRepository; @@ -6,10 +6,14 @@ import com.bsth.repository.LineRepository;
6 import com.bsth.service.LineService; 6 import com.bsth.service.LineService;
7 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.jdbc.core.JdbcTemplate; 8 import org.springframework.jdbc.core.JdbcTemplate;
  9 +import org.springframework.jdbc.core.RowMapper;
9 import org.springframework.stereotype.Service; 10 import org.springframework.stereotype.Service;
10 import org.springframework.transaction.annotation.Transactional; 11 import org.springframework.transaction.annotation.Transactional;
11 12
  13 +import java.sql.ResultSet;
  14 +import java.sql.SQLException;
12 import java.util.HashMap; 15 import java.util.HashMap;
  16 +import java.util.List;
13 import java.util.Map; 17 import java.util.Map;
14 18
15 /** 19 /**
@@ -117,4 +121,34 @@ public class LineServiceImpl extends BaseServiceImpl&lt;Line, Integer&gt; implements L @@ -117,4 +121,34 @@ public class LineServiceImpl extends BaseServiceImpl&lt;Line, Integer&gt; implements L
117 } 121 }
118 return map; 122 return map;
119 } 123 }
  124 +
  125 + /*获取线路性质*/
  126 + @Override
  127 + public Map<String, Boolean> lineNature() {
  128 + // TODO Auto-generated method stub
  129 +// List<Line> lineList=repository.findLineBygsBm(gsBm, fgsBm, line);
  130 + String sql="select * from bsth_c_line ";
  131 + List<Line> lineList=jdbcTemplate.query(sql,
  132 + new RowMapper<Line>(){
  133 + @Override
  134 + public Line mapRow(ResultSet rs, int rowNum) throws SQLException {
  135 + Line l=new Line();
  136 + l.setLineCode(rs.getString("line_code"));
  137 + l.setNature(rs.getString("nature"));
  138 + return l;
  139 + }
  140 + });
  141 + Map<String, Boolean> map=new HashMap<String,Boolean>();
  142 + for (int i = 0; i < lineList.size(); i++) {
  143 + Line t=lineList.get(i);
  144 + String nature=t.getNature()==null?"":t.getNature();
  145 + if(nature.equals("yxl")||nature.equals("cgxl")||nature.equals("gjxl")
  146 + ||nature.equals("csbs")||nature.equals("cctxl")){
  147 + map.put(t.getLineCode(), true);
  148 + }else{
  149 + map.put(t.getLineCode(), false);
  150 + }
  151 + }
  152 + return map;
  153 + }
120 } 154 }
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
@@ -743,6 +743,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -743,6 +743,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
743 try { 743 try {
744 // 获取线路ID 744 // 获取线路ID
745 Integer lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); 745 Integer lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString());
  746 + Integer fileVersions = map.get("fileVersions").equals("") ? 2 : Integer.parseInt(map.get("fileVersions").toString());// 没有输入就默认2
746 /** 查询线路信息 @param:<lineId:线路ID> */ 747 /** 查询线路信息 @param:<lineId:线路ID> */
747 Line line = lineRepository.findOne(lineId); 748 Line line = lineRepository.findOne(lineId);
748 /** 查询线路信息下的站点路由信息 @param:<lineId:线路ID> */ 749 /** 查询线路信息下的站点路由信息 @param:<lineId:线路ID> */
@@ -778,7 +779,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -778,7 +779,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
778 textStr = newTextFileToFTP(objects,lineId);/** 双向行单文件内容 @param:<objects:站点路由;lineId:线路ID>*/ 779 textStr = newTextFileToFTP(objects,lineId);/** 双向行单文件内容 @param:<objects:站点路由;lineId:线路ID>*/
779 else 780 else
780 resultMap.put("status","NOLinePlayType");// 线路无线路规划类型 781 resultMap.put("status","NOLinePlayType");// 线路无线路规划类型
781 - textStr = line.getName() + " " + "2" + "\r" + textStr; 782 + textStr = line.getName() + " " + fileVersions + "\r" + textStr;
782 InputStream input = new ByteArrayInputStream(textStr.getBytes("gbk")); 783 InputStream input = new ByteArrayInputStream(textStr.getBytes("gbk"));
783 /** 生成txt文件,上传ftp */ 784 /** 生成txt文件,上传ftp */
784 clientUtils.uploadFile(url, port, username, password, remotePath, textFileName, input); 785 clientUtils.uploadFile(url, port, username, password, remotePath, textFileName, input);
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
@@ -77,6 +77,10 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -77,6 +77,10 @@ public class TrafficManageServiceImpl implements TrafficManageService{
77 @Autowired 77 @Autowired
78 private StationRouteRepository stationRouteRepository; 78 private StationRouteRepository stationRouteRepository;
79 79
  80 + // 历史站点路由repository
  81 + @Autowired
  82 + private LsStationRouteRepository lsStationRouteRepository;
  83 +
80 @Autowired 84 @Autowired
81 private SectionRepository sectionRepository; 85 private SectionRepository sectionRepository;
82 86
@@ -944,6 +948,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -944,6 +948,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{
944 String result = "failure"; 948 String result = "failure";
945 StringBuffer sBuffer = new StringBuffer(); 949 StringBuffer sBuffer = new StringBuffer();
946 DecimalFormat df = new DecimalFormat("######0.000"); 950 DecimalFormat df = new DecimalFormat("######0.000");
  951 + Map<String,String> lsStationCode2NameMap;
  952 + Map<String, Integer> lsStationName2YgcNumber;
947 try { 953 try {
948 String[] idArray = ids.split(","); 954 String[] idArray = ids.split(",");
949 StringBuffer sBufferA ,sBufferB ,sBufferC ; 955 StringBuffer sBufferA ,sBufferB ,sBufferC ;
@@ -960,10 +966,17 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -960,10 +966,17 @@ public class TrafficManageServiceImpl implements TrafficManageService{
960 HashMap<String,String> paramMap; 966 HashMap<String,String> paramMap;
961 HashMap<String,String> otherMap = new HashMap<>(); 967 HashMap<String,String> otherMap = new HashMap<>();
962 for (int i = 0; i < idArray.length; i++) { 968 for (int i = 0; i < idArray.length; i++) {
963 - ttInfo = ttInfoRepository.findOne(Long.valueOf(idArray[i])); 969 + long ttinfoId = Long.valueOf(idArray[i]);
  970 + ttInfo = ttInfoRepository.findOne(ttinfoId);
964 if(ttInfo == null) 971 if(ttInfo == null)
965 continue; 972 continue;
966 ttinfoList.add(ttInfo); // 保存时刻表 973 ttinfoList.add(ttInfo); // 保存时刻表
  974 + // 得到时刻表版本号
  975 + int lineVersion = ttInfo.getLineVersion();
  976 + // 查询历史站点路由
  977 + lsStationCode2NameMap = getLsStationCode(ttInfo.getXl().getLineCode(),lineVersion);
  978 + // 查询历史站点路由
  979 + lsStationName2YgcNumber = getLsStationRoute(ttInfo.getXl().getLineCode(),lineVersion);
967 zlc = 0.0f; 980 zlc = 0.0f;
968 yylc = 0.0f; 981 yylc = 0.0f;
969 // 获得时刻表 982 // 获得时刻表
@@ -992,7 +1005,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -992,7 +1005,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
992 ttInfoDetail = ttInfoDetailIterator.next(); 1005 ttInfoDetail = ttInfoDetailIterator.next();
993 bcType = ttInfoDetail.getBcType(); 1006 bcType = ttInfoDetail.getBcType();
994 sxx = ttInfoDetail.getXlDir(); 1007 sxx = ttInfoDetail.getXlDir();
995 - // 进出场班次 1008 + // 进出场班次的里程,加入总里程
996 if(bcType.equals("in") || bcType.equals("out")){ 1009 if(bcType.equals("in") || bcType.equals("out")){
997 // 进出班次的计划里程,算空驶里程 1010 // 进出班次的计划里程,算空驶里程
998 emptyLc = ttInfoDetail.getJhlc(); 1011 emptyLc = ttInfoDetail.getJhlc();
@@ -1000,6 +1013,10 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -1000,6 +1013,10 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1000 zlc += emptyLc; 1013 zlc += emptyLc;
1001 continue; 1014 continue;
1002 } 1015 }
  1016 + // 不是正常班次,不传到运管处
  1017 + if(!bcType.equals("normal")){
  1018 + continue;
  1019 + }
1003 // 如果发车时间格式错误,忽略此条 1020 // 如果发车时间格式错误,忽略此条
1004 if(changeTimeFormat(ttInfoDetail) == null){ 1021 if(changeTimeFormat(ttInfoDetail) == null){
1005 continue; 1022 continue;
@@ -1007,19 +1024,19 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -1007,19 +1024,19 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1007 sBufferC.append("<BC>"); 1024 sBufferC.append("<BC>");
1008 sBufferC.append("<LPBH>").append(ttInfoDetail.getLp().getLpNo()).append("</LPBH>"); 1025 sBufferC.append("<LPBH>").append(ttInfoDetail.getLp().getLpNo()).append("</LPBH>");
1009 sBufferC.append("<SXX>").append(sxx).append("</SXX>"); 1026 sBufferC.append("<SXX>").append(sxx).append("</SXX>");
1010 - sBufferC.append("<FCZDMC>").append(BasicData.stationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir() 1027 + sBufferC.append("<FCZDMC>").append(lsStationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir()
1011 +"_"+ttInfoDetail.getQdzCode())).append("</FCZDMC>"); 1028 +"_"+ttInfoDetail.getQdzCode())).append("</FCZDMC>");
1012 // 起点站的参数 1029 // 起点站的参数
1013 otherMap.put("stationMark","B"); 1030 otherMap.put("stationMark","B");
1014 paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); 1031 paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap);
1015 - sBufferC.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</ZDXH>"); 1032 + sBufferC.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,lsStationName2YgcNumber)).append("</ZDXH>");
1016 sBufferC.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>"); 1033 sBufferC.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>");
1017 - sBufferC.append("<DDZDMC>").append(BasicData.stationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir() 1034 + sBufferC.append("<DDZDMC>").append(lsStationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir()
1018 +"_"+ttInfoDetail.getZdzCode())).append("</DDZDMC>"); 1035 +"_"+ttInfoDetail.getZdzCode())).append("</DDZDMC>");
1019 // 起点站的参数 1036 // 起点站的参数
1020 otherMap.put("stationMark","E"); 1037 otherMap.put("stationMark","E");
1021 paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); 1038 paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap);
1022 - sBufferC.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</DDXH>"); 1039 + sBufferC.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,lsStationName2YgcNumber)).append("</DDXH>");
1023 sBufferC.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>"); 1040 sBufferC.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>");
1024 sBufferC.append("</BC>"); 1041 sBufferC.append("</BC>");
1025 // 0:上行;1:下行 1042 // 0:上行;1:下行
@@ -1520,4 +1537,51 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -1520,4 +1537,51 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1520 map.put("stationMark",stationMark); // 站点类型 1537 map.put("stationMark",stationMark); // 站点类型
1521 return map; 1538 return map;
1522 } 1539 }
  1540 +
  1541 + /**
  1542 + * 取得历史站点编码和站点名称的对应关系
  1543 + * @return
  1544 + */
  1545 + private Map<String, String> getLsStationCode(String lineCode,int lineVersion){
  1546 + Map<String,Object> map = new HashMap<>();
  1547 + map.put("lineCode_eq", lineCode);
  1548 + map.put("versions_eq",lineVersion);
  1549 + LsStationRoute lsroute;
  1550 + Iterator<LsStationRoute> iterator = lsStationRouteRepository.findAll(new CustomerSpecs<LsStationRoute>(map)).iterator();
  1551 + Map<String, String> stationCode2Name = new HashMap<>();
  1552 + while (iterator.hasNext()) {
  1553 + lsroute = iterator.next();
  1554 + stationCode2Name.put(lsroute.getLineCode() + "_" + lsroute.getDirections() + "_" + lsroute.getStationCode(), lsroute.getStationName());
  1555 + }
  1556 + return stationCode2Name;
  1557 + }
  1558 +
  1559 + private Map<String, Integer> getLsStationRoute(String xlbm,int lineVersion){
  1560 + Map<String, Integer> tempStationName2YgcNumber = new HashMap<String, Integer>();
  1561 + /**
  1562 + * 加载运管处的站点及序号
  1563 + * 上行从1开始,下行顺序续编
  1564 + */
  1565 + List<Map<String, String>> ygcLines = lsStationRouteRepository.findLineWithLineCode4Ygc(xlbm,lineVersion);
  1566 + if(ygcLines != null && ygcLines.size() > 0){
  1567 + int size = ygcLines.size();
  1568 + Map<String, String> tempMap ;
  1569 + int num = 1;
  1570 + String key;
  1571 + String lineCode = "";
  1572 + for (int i = 0; i < size; i ++){
  1573 + tempMap = ygcLines.get(i);
  1574 + if(lineCode.equals("")){
  1575 + lineCode = tempMap.get("lineCode");
  1576 + }else if(!lineCode.equals(tempMap.get("lineCode"))){
  1577 + num = 1;
  1578 + lineCode = tempMap.get("lineCode");
  1579 + }
  1580 + key = tempMap.get("lineCode") + "_"+String.valueOf(tempMap.get("directions"))
  1581 + + "_"+tempMap.get("stationCode")+ "_"+tempMap.get("stationMark");
  1582 + tempStationName2YgcNumber.put(key,num++);
  1583 + }
  1584 + }
  1585 + return tempStationName2YgcNumber;
  1586 + }
1523 } 1587 }
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
@@ -117,10 +117,10 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L @@ -117,10 +117,10 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
117 117
118 List<Map<String,Object>> statisticsDaily(String line, String date, String xlName, String type); 118 List<Map<String,Object>> statisticsDaily(String line, String date, String xlName, String type);
119 119
120 - List<Map<String,Object>> statisticsDailyTj(String gsdm,String fgsdm,String line, String date,String date2, String xlName, String type); 120 + List<Map<String,Object>> statisticsDailyTj(String gsdm,String fgsdm,String line, String date,String date2, String xlName, String type,String nature);
121 121
122 //用于实时数据与统计数据合并查询 122 //用于实时数据与统计数据合并查询
123 - List<Map<String,Object>> statisticsDailyTjHb(String gsdm,String fgsdm,String line, String date,String date2, String xlName, String type); 123 + List<Map<String,Object>> statisticsDailyTjHb(String gsdm,String fgsdm,String line, String date,String date2, String xlName, String type,String nature);
124 124
125 //List<Object> scheduleDaily(String line,String date); 125 //List<Object> scheduleDaily(String line,String date);
126 126
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -53,6 +53,7 @@ import com.bsth.repository.schedule.CarConfigInfoRepository; @@ -53,6 +53,7 @@ import com.bsth.repository.schedule.CarConfigInfoRepository;
53 import com.bsth.repository.schedule.EmployeeConfigInfoRepository; 53 import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
54 import com.bsth.repository.schedule.GuideboardInfoRepository; 54 import com.bsth.repository.schedule.GuideboardInfoRepository;
55 import com.bsth.security.util.SecurityUtils; 55 import com.bsth.security.util.SecurityUtils;
  56 +import com.bsth.service.LineService;
56 import com.bsth.service.SectionRouteService; 57 import com.bsth.service.SectionRouteService;
57 import com.bsth.service.directive.DirectiveService; 58 import com.bsth.service.directive.DirectiveService;
58 import com.bsth.service.impl.BaseServiceImpl; 59 import com.bsth.service.impl.BaseServiceImpl;
@@ -114,7 +115,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -114,7 +115,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
114 115
115 @Autowired 116 @Autowired
116 LineRepository lineRepository; 117 LineRepository lineRepository;
117 - 118 + @Autowired
  119 + LineService lineService;
118 @Autowired 120 @Autowired
119 GuideboardInfoRepository guideboardInfoRepository; 121 GuideboardInfoRepository guideboardInfoRepository;
120 122
@@ -2666,10 +2668,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2666,10 +2668,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2666 } 2668 }
2667 Map<String, Object> map = new HashMap<String, Object>(); 2669 Map<String, Object> map = new HashMap<String, Object>();
2668 if (list.size() > 0) { 2670 if (list.size() > 0) {
  2671 + map.put("fgsBm", list.get(0).getFgsBm());
2669 map.put("xlBm", list.get(0).getXlBm()); 2672 map.put("xlBm", list.get(0).getXlBm());
2670 map.put("xlName", list.get(0).getXlName()); 2673 map.put("xlName", list.get(0).getXlName());
  2674 + map.put("fgsName", list.get(0).getFgsName());
2671 try { 2675 try {
2672 - map.put("xlNamePy", PinyinHelper.convertToPinyinString(list.get(0).getXlName(), "", PinyinFormat.WITHOUT_TONE)); 2676 + map.put("xlNamePy", PinyinHelper.convertToPinyinString(list.get(0).getFgsBm()+list.get(0).getXlName(), "", PinyinFormat.WITHOUT_TONE));
2673 } catch (PinyinException e) { 2677 } catch (PinyinException e) {
2674 // TODO Auto-generated catch block 2678 // TODO Auto-generated catch block
2675 e.printStackTrace(); 2679 e.printStackTrace();
@@ -2679,7 +2683,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2679,7 +2683,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2679 map.put("jhlc", jhyygl); 2683 map.put("jhlc", jhyygl);
2680 map.put("jcclc", jhjcclc); 2684 map.put("jcclc", jhjcclc);
2681 map.put("jhzlc", Arith.add(jhyygl, jhjcclc)); 2685 map.put("jhzlc", Arith.add(jhyygl, jhjcclc));
2682 - 2686 + double ljks=culateService.culateLjksgl(lists);
  2687 + map.put("ljks", ljks);
2683 double ljgl = culateService.culateLjgl(lists); 2688 double ljgl = culateService.culateLjgl(lists);
2684 double sjyygl = culateService.culateSjgl(lists); 2689 double sjyygl = culateService.culateSjgl(lists);
2685 double zyygl = Arith.add(sjyygl, ljgl); 2690 double zyygl = Arith.add(sjyygl, ljgl);
@@ -2744,18 +2749,34 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2744,18 +2749,34 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2744 2749
2745 @Override 2750 @Override
2746 public List<Map<String, Object>> statisticsDailyTj(String gsdm, String fgsdm, String line, String date, String date2, 2751 public List<Map<String, Object>> statisticsDailyTj(String gsdm, String fgsdm, String line, String date, String date2,
2747 - String xlName, String type) {  
2748 - List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); 2752 + String xlName, String type,String nature) {
  2753 + List<ScheduleRealInfo> listAll = new ArrayList<ScheduleRealInfo>();
2749 List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>(); 2754 List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>();
2750 List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); 2755 List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>();
2751 line = line.trim(); 2756 line = line.trim();
2752 if (line.equals("")) { 2757 if (line.equals("")) {
2753 //查询所有线路 2758 //查询所有线路
2754 - list = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date, date2, gsdm, fgsdm); 2759 + listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date, date2, gsdm, fgsdm);
2755 } else { 2760 } else {
2756 //查询单条线路 2761 //查询单条线路
2757 - list = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date, date2);  
2758 - } 2762 + listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date, date2);
  2763 + }
  2764 + Map<String, Boolean> lineMap=lineService.lineNature();
  2765 + List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>();
  2766 + for (int i = 0; i < listAll.size(); i++) {
  2767 + ScheduleRealInfo s=listAll.get(i);
  2768 + if (nature.equals("0")) {
  2769 + list.add(s);
  2770 + }else if(nature.equals("1")){
  2771 + if(lineMap.get(s.getXlBm())){
  2772 + list.add(s);
  2773 + }
  2774 + }else{
  2775 + if(!lineMap.get(s.getXlBm())){
  2776 + list.add(s);
  2777 + }
  2778 + }
  2779 + }
2759 for (int i = 0; i < list.size(); i++) { 2780 for (int i = 0; i < list.size(); i++) {
2760 ScheduleRealInfo s = list.get(i); 2781 ScheduleRealInfo s = list.get(i);
2761 Set<ChildTaskPlan> cts = s.getcTasks(); 2782 Set<ChildTaskPlan> cts = s.getcTasks();
@@ -2770,7 +2791,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2770,7 +2791,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2770 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); 2791 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
2771 for (int i = 0; i < list.size(); i++) { 2792 for (int i = 0; i < list.size(); i++) {
2772 if (i < list.size() - 1) { 2793 if (i < list.size() - 1) {
2773 - if (list.get(i + 1).getXlBm().equals(list.get(i).getXlBm())) { 2794 + if ((list.get(i+1).getFgsBm()+list.get(i + 1).getXlBm()).equals(list.get(i).getFgsBm()+list.get(i).getXlBm())) {
2774 lists.add(list.get(i)); 2795 lists.add(list.get(i));
2775 } else { 2796 } else {
2776 lists.add(list.get(i)); 2797 lists.add(list.get(i));
@@ -2779,7 +2800,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2779,7 +2800,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2779 lists = new ArrayList<ScheduleRealInfo>(); 2800 lists = new ArrayList<ScheduleRealInfo>();
2780 } 2801 }
2781 } else { 2802 } else {
2782 - if (list.get(i).getXlBm().equals(list.get(i - 1).getXlBm())) { 2803 + if ((list.get(i).getFgsBm()+list.get(i).getXlBm()).equals(list.get(i - 1).getFgsBm()+list.get(i - 1).getXlBm())) {
2783 lists.add(list.get(i)); 2804 lists.add(list.get(i));
2784 Map<String, Object> map = staticTj(lists); 2805 Map<String, Object> map = staticTj(lists);
2785 lMap.add(map); 2806 lMap.add(map);
@@ -2791,10 +2812,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2791,10 +2812,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2791 } 2812 }
2792 } 2813 }
2793 } 2814 }
2794 - 2815 + /*if(!line.equals("")){
  2816 + List<Line> l=lineRepository.findLineByCode(line);
  2817 + if(l.size()>0)
  2818 + lMap.get(0).put("fgsName", BasicData.businessFgsCodeNameMap.get(l.get(0).getBrancheCompany()+"_"+l.get(0).getCompany()));
  2819 + }*/
2795 Collections.sort(lMap, new AccountXlbm()); 2820 Collections.sort(lMap, new AccountXlbm());
2796 Map<String, Object> map = new HashMap<String, Object>(); 2821 Map<String, Object> map = new HashMap<String, Object>();
2797 map.put("xlName", "合计"); 2822 map.put("xlName", "合计");
  2823 + map.put("fgsName", "");
2798 double jhyygl = culateService.culateJhgl(list);//计划营运公里 2824 double jhyygl = culateService.culateJhgl(list);//计划营运公里
2799 double jhjcclc = culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里) 2825 double jhjcclc = culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里)
2800 map.put("jhlc", jhyygl); 2826 map.put("jhlc", jhyygl);
@@ -2804,7 +2830,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2804,7 +2830,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2804 double ljgl = culateService.culateLjgl(list_s); 2830 double ljgl = culateService.culateLjgl(list_s);
2805 double sjyygl = culateService.culateSjgl(list_s); 2831 double sjyygl = culateService.culateSjgl(list_s);
2806 double zyygl = Arith.add(sjyygl, ljgl); 2832 double zyygl = Arith.add(sjyygl, ljgl);
2807 - 2833 + double ljks=culateService.culateLjksgl(list_s);
  2834 + map.put("ljks", ljks);
2808 double sjjccgl = culateService.culateJccgl(list_s); 2835 double sjjccgl = culateService.culateJccgl(list_s);
2809 double sjksgl = culateService.culateKsgl(list_s); 2836 double sjksgl = culateService.culateKsgl(list_s);
2810 double zksgl = Arith.add(sjjccgl, sjksgl); 2837 double zksgl = Arith.add(sjjccgl, sjksgl);
@@ -2902,7 +2929,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2902,7 +2929,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2902 } 2929 }
2903 listI.add(lMap.iterator()); 2930 listI.add(lMap.iterator());
2904 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; 2931 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
2905 - ee.excelReplace(listI, new Object[]{m}, path + "mould/statisticsDaily_.xls", 2932 + ee.excelReplace(listI, new Object[]{m}, path + "mould/statisticsDaily_2.xls",
2906 path + "export/" + dateTime + "-" + xlName + "-统计日报.xls"); 2933 path + "export/" + dateTime + "-" + xlName + "-统计日报.xls");
2907 } catch (Exception e) { 2934 } catch (Exception e) {
2908 // TODO: handle exception 2935 // TODO: handle exception
@@ -2916,18 +2943,35 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2916,18 +2943,35 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2916 2943
2917 @Override 2944 @Override
2918 public List<Map<String, Object>> statisticsDailyTjHb(String gsdm, String fgsdm, String line, String date, String date2, 2945 public List<Map<String, Object>> statisticsDailyTjHb(String gsdm, String fgsdm, String line, String date, String date2,
2919 - String xlName, String type) {  
2920 - List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); 2946 + String xlName, String type,String nature) {
  2947 + List<ScheduleRealInfo> listAll = new ArrayList<ScheduleRealInfo>();
2921 List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>(); 2948 List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>();
2922 List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); 2949 List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>();
2923 line = line.trim(); 2950 line = line.trim();
2924 if (line.equals("")) { 2951 if (line.equals("")) {
2925 //查询所有线路 2952 //查询所有线路
2926 - list = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date, date2, gsdm, fgsdm); 2953 + listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date, date2, gsdm, fgsdm);
2927 } else { 2954 } else {
2928 //查询单条线路 2955 //查询单条线路
2929 - list = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date, date2);  
2930 - } 2956 + listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date, date2);
  2957 + }
  2958 +
  2959 + Map<String, Boolean> lineMap=lineService.lineNature();
  2960 + List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>();
  2961 + for (int i = 0; i < listAll.size(); i++) {
  2962 + ScheduleRealInfo s=listAll.get(i);
  2963 + if (nature.equals("0")) {
  2964 + list.add(s);
  2965 + }else if(nature.equals("1")){
  2966 + if(lineMap.get(s.getXlBm())){
  2967 + list.add(s);
  2968 + }
  2969 + }else{
  2970 + if(!lineMap.get(s.getXlBm())){
  2971 + list.add(s);
  2972 + }
  2973 + }
  2974 + }
2931 for (int i = 0; i < list.size(); i++) { 2975 for (int i = 0; i < list.size(); i++) {
2932 ScheduleRealInfo s = list.get(i); 2976 ScheduleRealInfo s = list.get(i);
2933 Set<ChildTaskPlan> cts = s.getcTasks(); 2977 Set<ChildTaskPlan> cts = s.getcTasks();
@@ -2942,7 +2986,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2942,7 +2986,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2942 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); 2986 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
2943 for (int i = 0; i < list.size(); i++) { 2987 for (int i = 0; i < list.size(); i++) {
2944 if (i < list.size() - 1) { 2988 if (i < list.size() - 1) {
2945 - if (list.get(i + 1).getXlBm().equals(list.get(i).getXlBm())) { 2989 + if ((list.get(i + 1).getFgsBm()+list.get(i + 1).getXlBm()).equals(list.get(i).getFgsBm()+list.get(i).getXlBm())) {
2946 lists.add(list.get(i)); 2990 lists.add(list.get(i));
2947 } else { 2991 } else {
2948 lists.add(list.get(i)); 2992 lists.add(list.get(i));
@@ -2951,7 +2995,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2951,7 +2995,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2951 lists = new ArrayList<ScheduleRealInfo>(); 2995 lists = new ArrayList<ScheduleRealInfo>();
2952 } 2996 }
2953 } else { 2997 } else {
2954 - if (list.get(i).getXlBm().equals(list.get(i - 1).getXlBm())) { 2998 + if ((list.get(i).getFgsBm()+list.get(i).getXlBm()).equals(list.get(i - 1).getFgsBm()+list.get(i - 1).getXlBm())) {
2955 lists.add(list.get(i)); 2999 lists.add(list.get(i));
2956 Map<String, Object> map = staticTj(lists); 3000 Map<String, Object> map = staticTj(lists);
2957 lMap.add(map); 3001 lMap.add(map);
@@ -2968,6 +3012,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2968,6 +3012,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2968 Map<String, Object> map = new HashMap<String, Object>(); 3012 Map<String, Object> map = new HashMap<String, Object>();
2969 map.put("xlBm", "hj"); 3013 map.put("xlBm", "hj");
2970 map.put("xlName", "合计"); 3014 map.put("xlName", "合计");
  3015 + map.put("fgsBm", "");
  3016 + map.put("fgsName", "");
  3017 + map.put("gsBm", "");
2971 double jhyygl = culateService.culateJhgl(list);//计划营运公里 3018 double jhyygl = culateService.culateJhgl(list);//计划营运公里
2972 double jhjcclc = culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里) 3019 double jhjcclc = culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里)
2973 map.put("jhlc", jhyygl); 3020 map.put("jhlc", jhyygl);
@@ -2977,7 +3024,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2977,7 +3024,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2977 double ljgl = culateService.culateLjgl(list_s); 3024 double ljgl = culateService.culateLjgl(list_s);
2978 double sjyygl = culateService.culateSjgl(list_s); 3025 double sjyygl = culateService.culateSjgl(list_s);
2979 double zyygl = Arith.add(sjyygl, ljgl); 3026 double zyygl = Arith.add(sjyygl, ljgl);
2980 - 3027 + double ljks=culateService.culateLjksgl(list_s);
  3028 + map.put("ljks", ljks);
2981 double sjjccgl = culateService.culateJccgl(list_s); 3029 double sjjccgl = culateService.culateJccgl(list_s);
2982 double sjksgl = culateService.culateKsgl(list_s); 3030 double sjksgl = culateService.culateKsgl(list_s);
2983 double zksgl = Arith.add(sjjccgl, sjksgl); 3031 double zksgl = Arith.add(sjjccgl, sjksgl);
src/main/java/com/bsth/service/report/CalcSheetService.java 0 → 100644
  1 +package com.bsth.service.report;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import com.bsth.entity.sheet.CalcSheet;
  7 +import com.bsth.entity.sheet.Sheet;
  8 +import com.bsth.service.BaseService;
  9 +
  10 +public interface CalcSheetService extends BaseService<CalcSheet, Integer>{
  11 + public List<CalcSheet> countListCalcSheet(Map<String, Object> map);
  12 + public List<CalcSheet> calcListSheet(Map<String, Object> map);
  13 + public List<Sheet> calcSheet(Map<String, Object> map);
  14 + public List<Map<String, Object>> calcTurnoutrate(Map<String, Object> map);
  15 +}
src/main/java/com/bsth/service/report/CulateMileageService.java
@@ -4,6 +4,7 @@ import java.util.List; @@ -4,6 +4,7 @@ import java.util.List;
4 import java.util.Map; 4 import java.util.Map;
5 5
6 import com.bsth.entity.realcontrol.ScheduleRealInfo; 6 import com.bsth.entity.realcontrol.ScheduleRealInfo;
  7 +import com.google.common.util.concurrent.AbstractScheduledService.Scheduler;
7 8
8 public interface CulateMileageService { 9 public interface CulateMileageService {
9 10
@@ -12,6 +13,7 @@ public interface CulateMileageService { @@ -12,6 +13,7 @@ public interface CulateMileageService {
12 int culateLbbc(List<ScheduleRealInfo> lists); 13 int culateLbbc(List<ScheduleRealInfo> lists);
13 14
14 List<Map<String,Object>> jobLjqk(List<ScheduleRealInfo> lists); 15 List<Map<String,Object>> jobLjqk(List<ScheduleRealInfo> lists);
  16 + double culateLjksgl(List<ScheduleRealInfo> lists);
15 double culateLjgl(List<ScheduleRealInfo> lists); 17 double culateLjgl(List<ScheduleRealInfo> lists);
16 double culateLjgl_(List<ScheduleRealInfo> lists,String item); 18 double culateLjgl_(List<ScheduleRealInfo> lists,String item);
17 double culateLjgl_spy(List<ScheduleRealInfo> lists); 19 double culateLjgl_spy(List<ScheduleRealInfo> lists);
@@ -43,7 +45,7 @@ public interface CulateMileageService { @@ -43,7 +45,7 @@ public interface CulateMileageService {
43 45
44 int culateDtfzbc(List<ScheduleRealInfo> lists,String type,String status,String item); 46 int culateDtfzbc(List<ScheduleRealInfo> lists,String type,String status,String item);
45 47
46 - 48 +
47 //以下计算方法供新报表使用 49 //以下计算方法供新报表使用
48 Map<String, Double> culateSjlcMap(List<ScheduleRealInfo> lists);//计划内营运and计划外营运 50 Map<String, Double> culateSjlcMap(List<ScheduleRealInfo> lists);//计划内营运and计划外营运
49 51
src/main/java/com/bsth/service/report/impl/CalcSheetServiceImpl.java 0 → 100644
  1 +package com.bsth.service.report.impl;
  2 +
  3 +
  4 +import java.lang.reflect.InvocationTargetException;
  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.GregorianCalendar;
  16 +import java.util.HashMap;
  17 +import java.util.Iterator;
  18 +import java.util.List;
  19 +import java.util.Map;
  20 +
  21 +import org.apache.commons.lang3.StringUtils;
  22 +import org.springframework.beans.factory.annotation.Autowired;
  23 +import org.springframework.jdbc.core.JdbcTemplate;
  24 +import org.springframework.jdbc.core.RowMapper;
  25 +import org.springframework.stereotype.Service;
  26 +
  27 +import com.bsth.data.BasicData;
  28 +import com.bsth.entity.Line;
  29 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  30 +import com.bsth.entity.sheet.CalcSheet;
  31 +import com.bsth.entity.sheet.Sheet;
  32 +import com.bsth.repository.LineRepository;
  33 +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
  34 +import com.bsth.service.LineService;
  35 +import com.bsth.service.impl.BaseServiceImpl;
  36 +import com.bsth.service.report.CalcSheetService;
  37 +import com.bsth.util.ComparableReal;
  38 +import com.bsth.util.ReportRelatedUtils;
  39 +import com.bsth.util.ReportUtils;
  40 +
  41 +
  42 +@Service
  43 +public class CalcSheetServiceImpl extends BaseServiceImpl<CalcSheet, Integer> implements CalcSheetService {
  44 + @Autowired
  45 + JdbcTemplate jdbcTemplate;
  46 + @Autowired
  47 + ScheduleRealInfoRepository scheduleRealInfoRepository;
  48 + @Autowired
  49 + LineRepository lineRepository;
  50 + @Autowired
  51 + LineService lineService;
  52 + @Override
  53 + public List<CalcSheet> countListCalcSheet(Map<String, Object> map) {
  54 + // TODO Auto-generated method stub
  55 + final DecimalFormat df = new DecimalFormat("0.00");
  56 + String line="";
  57 + if(map.get("line")!=null){
  58 + line =map.get("line").toString().trim();
  59 + }
  60 + String gs="";
  61 + if(map.get("gs")!=null){
  62 + gs=map.get("gs").toString().trim();
  63 + }
  64 + String fgs="";
  65 + if(map.get("fgs")!=null){
  66 + fgs=map.get("fgs").toString().trim();
  67 + }
  68 + String nature="0";
  69 + if(map.get("nature")!=null){
  70 + nature=map.get("nature").toString();
  71 + }
  72 + Map<String, Boolean> lineMap=lineService.lineNature();
  73 +
  74 + String date=map.get("date").toString();
  75 + String endDate=map.get("endDate").toString();
  76 + String sql="select gsdm,fgsdm,xl,xl_name,max(id) as id,sum(jhszfcs) as jhszfcs ,"
  77 + + " sum(sjszfczds) as sjszfczds,sum(sjszddzds) as sjszddzds"
  78 + + " from bsth_c_calc_sheet where date >= '"+date+"' and date <= '"+endDate+"'";
  79 + if(line.trim().equals("")){
  80 + sql +=" and gsdm = '"+gs+"' and fgsdm like '%"+fgs+"%'";
  81 + }else{
  82 + sql +=" and xl ='"+line+"'";
  83 + }
  84 + sql +=" group by gsdm,fgsdm,xl,xl_name";
  85 + List<CalcSheet> lists=jdbcTemplate.query(sql,
  86 + new RowMapper<CalcSheet>(){
  87 + @Override
  88 + public CalcSheet mapRow(ResultSet rs, int rowNum) throws SQLException {
  89 + CalcSheet s=new CalcSheet();
  90 + s.setGsdm(rs.getString("gsdm"));
  91 + s.setFgsdm(rs.getString("fgsdm"));
  92 + s.setXl(rs.getString("xl"));
  93 + s.setXlName(rs.getString("xl_name"));
  94 + s.setId(rs.getInt("id"));
  95 + s.setJhszfcs(rs.getString("jhszfcs"));
  96 + s.setSjszfczds(rs.getString("sjszfczds"));
  97 + s.setSjszddzds(rs.getString("sjszddzds"));
  98 + int jhfc=Integer.parseInt(rs.getString("jhszfcs"));
  99 + int zdfc=Integer.parseInt(rs.getString("sjszfczds"));
  100 + int zddd=Integer.parseInt(rs.getString("sjszddzds"));
  101 + if(jhfc>0){
  102 + double zdl=(zdfc*1.0)/(jhfc*1.0)*100;
  103 + s.setSzfczdl(df.format(zdl)+"%");
  104 + zdl=(zddd*1.0)/(jhfc*1.0)*100;
  105 + s.setSzddzdl(df.format(zdl)+"%");
  106 + }else{
  107 + s.setSzfczdl("0.0%");
  108 + s.setSzddzdl("0.0%");
  109 + }
  110 + return s;
  111 + }
  112 + });
  113 + List<CalcSheet> list=new ArrayList<CalcSheet>();
  114 + for (int i = 0; i < lists.size(); i++) {
  115 + if (nature.equals("0")) {
  116 + list.add(lists.get(i));
  117 + }else if(nature.equals("1")){
  118 + if(lineMap.get(lists.get(i).getXl())){
  119 + list.add(lists.get(i));
  120 + }
  121 + }else{
  122 + if(!lineMap.get(lists.get(i).getXl())){
  123 + list.add(lists.get(i));
  124 + }
  125 + }
  126 + }
  127 + if(map.get("type").equals("export")){
  128 + String lineName="";
  129 + if(!line.equals("")){
  130 + lineName=list.get(0).getXlName();
  131 + }else if(!fgs.equals("")){
  132 + lineName=list.get(0).getFgsname();
  133 + }else{
  134 + lineName=list.get(0).getGsname();
  135 + }
  136 + List<Map<String, Object>> listmap=new ArrayList<Map<String, Object>>();
  137 + for (int i = 0; i < list.size(); i++) {
  138 + CalcSheet c=list.get(i);
  139 + Map<String, Object> m=new HashMap<String,Object>();
  140 + m.put("gs", c.getGsname());
  141 + m.put("fgs", c.getFgsname());
  142 + m.put("line", c.getXlName());
  143 + m.put("bcs", c.getJhszfcs());
  144 + m.put("zdbcs", c.getSjszfczds());
  145 + m.put("zdlv", c.getSzfczdl());
  146 + m.put("ddzdbcs", c.getSjszddzds());
  147 + m.put("ddzdlv", c.getSzddzdl());
  148 + listmap.add(m);
  149 + }
  150 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  151 + Map<String, Object> m = new HashMap<String, Object>();
  152 + m.put("date", date);
  153 + m.put("endDate", endDate);
  154 + ReportUtils ee = new ReportUtils();
  155 + try {
  156 + String dateTime = "";
  157 + if(date.equals(endDate)){
  158 + dateTime = date.replaceAll("-", "");
  159 + } else {
  160 + dateTime = date.replaceAll("-", "")+"-"+
  161 + endDate.replaceAll("-", "");
  162 + }
  163 + listI.add(listmap.iterator());
  164 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  165 + ee.excelReplace(listI, new Object[]{m}, path + "mould/" + "calcSheetList.xls",
  166 + path + "export/"+dateTime+"-"+lineName+"-发车到站准点率.xls");
  167 + } catch (Exception e) {
  168 + // TODO: handle exception
  169 + e.printStackTrace();
  170 + }
  171 + }
  172 + return list;
  173 + }
  174 + @Override
  175 + public List<CalcSheet> calcListSheet(Map<String, Object> map) {
  176 + // TODO Auto-generated method stub
  177 + String line=map.get("line").toString();
  178 + String date=map.get("date").toString();
  179 + String endDate=map.get("endDate").toString();
  180 + String sql="select * from bsth_c_calc_sheet where date >= '"+date+"' and "
  181 + + " date <= '"+endDate+"' and xl = '"+line+"' order by date";
  182 + List<CalcSheet> list=jdbcTemplate.query(sql,
  183 + new RowMapper<CalcSheet>(){
  184 + @Override
  185 + public CalcSheet mapRow(ResultSet rs, int rowNum) throws SQLException {
  186 + CalcSheet s=new CalcSheet();
  187 + s.setGsdm(rs.getString("gsdm"));
  188 + s.setFgsdm(rs.getString("fgsdm"));
  189 + s.setXl(rs.getString("xl"));
  190 + s.setXlName(rs.getString("xl_name"));
  191 + s.setId(rs.getInt("id"));
  192 + s.setDate(rs.getString("date"));
  193 + s.setJhszfcs(rs.getString("jhszfcs"));
  194 + s.setSjszfczds(rs.getString("sjszfczds"));
  195 + s.setSzfczdl(rs.getString("szfczdl"));
  196 + s.setSjszddzds(rs.getString("sjszddzds"));
  197 + s.setSzddzdl(rs.getString("szddzdl"));
  198 + return s;
  199 + }
  200 + });
  201 + if(map.get("type").equals("export")){
  202 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  203 + for (int i = 0; i < list.size(); i++) {
  204 + Map<String, Object> m = new HashMap<String, Object>();
  205 + CalcSheet c = list.get(i);
  206 + m.put("gs", c.getGsname());
  207 + m.put("fgs", c.getFgsname());
  208 + m.put("date", c.getDate());
  209 + m.put("line", c.getXlName());
  210 + m.put("bcs", c.getJhszfcs());
  211 + m.put("zdbcs", c.getSjszfczds());
  212 + m.put("zdlv", c.getSzfczdl()+"%");
  213 + m.put("ddzdbcs", c.getSjszddzds());
  214 + m.put("ddzdlv", c.getSzddzdl()+"%");
  215 + tempList.add(m);
  216 + }
  217 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  218 + Map<String, Object> m = new HashMap<String, Object>();
  219 + m.put("date", date);
  220 + m.put("endDate", endDate);
  221 + ReportUtils ee = new ReportUtils();
  222 + try {
  223 + listI.add(tempList.iterator());
  224 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  225 + ee.excelReplace(listI, new Object[]{m}, path + "mould/" + "calcSheetList1.xls",
  226 + path + "export/发车到站准点率"+date.replaceAll("-", "")+"-"+endDate.replaceAll("-", "")+".xls");
  227 + } catch (Exception e) {
  228 + // TODO: handle exception
  229 + e.printStackTrace();
  230 + }
  231 + }
  232 + return list;
  233 + }
  234 + @Override
  235 + public List<Sheet> calcSheet(Map<String, Object> map) {
  236 + // TODO Auto-generated method stub
  237 + System.out.println();
  238 + String line=map.get("line").toString();
  239 + String date=map.get("date").toString();
  240 + String dir =map.get("dir").toString();
  241 + List<ScheduleRealInfo> list=scheduleRealInfoRepository.scheduleDaily(line, date);
  242 + Line l =lineRepository.findByLineCode(line);
  243 + List<Sheet> listSheet=new ArrayList<Sheet>();
  244 + if(list.size()>0){
  245 + if(dir.equals("1")){
  246 + listSheet=calcSheetFcZdl(list, list.get(0).getXlBm(),l.getStartStationName(),l.getEndStationName());
  247 + }else{
  248 + listSheet=calcSheetDdZdl(list, list.get(0).getXlBm(),l.getStartStationName(),l.getEndStationName());
  249 + }
  250 + if(map.get("type").equals("export")){
  251 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  252 + Map<String, Object> m = new HashMap<String, Object>();
  253 + ReportUtils ee = new ReportUtils();
  254 + try {
  255 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  256 + for(int i = 0; i < listSheet.size(); i++){
  257 + Map<String, Object> temp = new HashMap<String, Object>();
  258 + Sheet s = listSheet.get(i);
  259 + temp.put("id", i+1);
  260 + temp.put("date", s.getDate());
  261 + temp.put("line", s.getLine());
  262 + temp.put("zdname", s.getZdname());
  263 + temp.put("jhsj", s.getJhsj());
  264 + temp.put("sjsj", s.getSjsj());
  265 + temp.put("sfzd", s.getSfzd());
  266 + tempList.add(temp);
  267 + }
  268 + listI.add(tempList.iterator());
  269 + m.put("date", date);
  270 + String fileName="";
  271 + if(dir.equals("1")){
  272 + fileName="发车准点率"+date;
  273 + }else{
  274 + fileName="到站准点率"+date;
  275 + }
  276 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  277 + ee.excelReplace(listI, new Object[]{m}, path + "mould/sheetList2.xls",
  278 + path + "export/"+fileName+".xls");
  279 + } catch (Exception e) {
  280 + // TODO: handle exception
  281 + e.printStackTrace();
  282 + }
  283 +
  284 + }
  285 + }
  286 + return listSheet;
  287 + }
  288 +
  289 + private List<Sheet> calcSheetFcZdl(List<ScheduleRealInfo> lists,String line,String qdz,String zdz) {
  290 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
  291 + SimpleDateFormat sdf_ = new SimpleDateFormat("yyyy-MM-dd");
  292 + DecimalFormat df = new DecimalFormat("0.00");
  293 + List<Sheet> listSheet=new ArrayList<Sheet>();
  294 + List<ScheduleRealInfo> listjh0 = new ArrayList<ScheduleRealInfo>();
  295 + List<ScheduleRealInfo> listjh1 = new ArrayList<ScheduleRealInfo>();
  296 + List<ScheduleRealInfo> listsj0 = new ArrayList<ScheduleRealInfo>();
  297 + List<ScheduleRealInfo> listsj1 = new ArrayList<ScheduleRealInfo>();
  298 + long minFcsj = minFcsj(line);
  299 + for (int j = 0; j < lists.size(); j++) {
  300 + ScheduleRealInfo s = lists.get(j);
  301 + boolean fage=true;
  302 + if(s.getBcType().equals("region")){
  303 + if(s.getXlDir().equals("0")){
  304 + if(!s.getQdzName().equals(qdz))
  305 + fage=false;
  306 + }else{
  307 + if(!s.getQdzName().equals(zdz))
  308 + fage=false;
  309 + }
  310 + }
  311 + if (!isInOut(s) && fage) {
  312 + String[] fcsj = s.getFcsj().split(":");
  313 + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]);
  314 + Long fcsjT = 0L;
  315 + if (fcsjL < minFcsj) {
  316 + Calendar calendar = new GregorianCalendar();
  317 + calendar.setTime(s.getScheduleDate());
  318 + calendar.add(calendar.DATE, 1);
  319 + Date date = calendar.getTime();
  320 + try {
  321 + fcsjT = sdf.parse(sdf_.format(date) + " " + s.getFcsj()).getTime();
  322 + } catch (ParseException e) {
  323 + // TODO Auto-generated catch block
  324 + e.printStackTrace();
  325 + }
  326 + } else {
  327 + try {
  328 + fcsjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime();
  329 + } catch (ParseException e) {
  330 + // TODO Auto-generated catch block
  331 + e.printStackTrace();
  332 + }
  333 + }
  334 + Long fcsjAcual = 0L;
  335 + if (StringUtils.isEmpty(s.getFcsjActual())) {
  336 + s.setFcsjActualTime(0L);
  337 + s.setFcsjT(fcsjT);
  338 + } else {
  339 + try {
  340 + fcsjAcual = sdf.parse(s.getRealExecDate() + " " + s.getFcsjActual()).getTime();
  341 + s.setFcsjActualTime(fcsjAcual);
  342 + s.setFcsjT(fcsjT);
  343 + } catch (ParseException e) {
  344 + // TODO Auto-generated catch block
  345 + e.printStackTrace();
  346 + }
  347 + }
  348 + if (s.isSflj()) {
  349 + if (s.getXlDir().equals("0")) {
  350 + listsj0.add(s);
  351 + } else {
  352 + listsj1.add(s);
  353 + }
  354 + } else {
  355 + if (s.getXlDir().equals("0")) {
  356 + listsj0.add(s);
  357 + listjh0.add(s);
  358 + } else {
  359 + listsj1.add(s);
  360 + listjh1.add(s);
  361 + }
  362 + }
  363 + }
  364 + }
  365 + Collections.sort(listjh0, new ComparableReal());
  366 + Collections.sort(listjh1, new ComparableReal());
  367 + Collections.sort(listsj0, new ComparableAcual());
  368 + Collections.sort(listsj1, new ComparableAcual());
  369 + Map<String, Object> mjh = new HashMap<String, Object>();
  370 + Map<String, Object> msj = new HashMap<String, Object>();
  371 + Sheet sheet;
  372 + //获取上行所有准点班次
  373 + for (int k = 0; k < listjh0.size(); k++) {
  374 + ScheduleRealInfo sJh = listjh0.get(k);
  375 + for (int j = 0; j < listsj0.size(); j++) {
  376 + ScheduleRealInfo sSj = listsj0.get(j);
  377 + long sjc = sSj.getFcsjActualTime() - sJh.getFcsjT();
  378 + if (sjc >= -1 * 60 * 1000 && sjc <= 3 * 60 * 1000) {
  379 + if (mjh.get(String.valueOf(sJh.getId())) == null && msj.get(String.valueOf(sSj.getId())) == null) {
  380 + sheet = new Sheet();
  381 + sheet.setDate(sJh.getScheduleDateStr());
  382 + sheet.setRealDate(sSj.getRealExecDate());
  383 + sheet.setLine(sJh.getXlName());
  384 + sheet.setZdname(sJh.getQdzName());
  385 + sheet.setJhsj(sJh.getFcsj());
  386 + sheet.setSjsj(sSj.getFcsjActual());
  387 + sheet.setSfzd("准点");
  388 + sheet.setXlDir("0");
  389 + listSheet.add(sheet);
  390 + mjh.put(String.valueOf(sJh.getId()), sJh.getId());
  391 + msj.put(String.valueOf(sSj.getId()), sSj.getId());
  392 + }
  393 + }
  394 + }
  395 + }
  396 + // 获取上行所有不准点班次
  397 +
  398 + for (int k = 0; k < listjh0.size(); k++) {
  399 + ScheduleRealInfo sJh = listjh0.get(k);
  400 + for (int j = 0; j < listsj0.size(); j++) {
  401 + ScheduleRealInfo sSj = listsj0.get(j);
  402 + if (mjh.get(String.valueOf(sJh.getId())) == null&&msj.get(String.valueOf(sSj.getId())) == null) {
  403 + sheet = new Sheet();
  404 + sheet.setDate(sJh.getScheduleDateStr());
  405 + sheet.setRealDate(sSj.getRealExecDate());
  406 + sheet.setLine(sJh.getXlName());
  407 + sheet.setZdname(sJh.getQdzName());
  408 + sheet.setJhsj(sJh.getFcsj());
  409 + sheet.setSjsj(sSj.getFcsjActual()==null?"烂班":sSj.getFcsjActual());
  410 + sheet.setSfzd("不准点");
  411 + sheet.setXlDir("0");
  412 + listSheet.add(sheet);
  413 + mjh.put(String.valueOf(sJh.getId()), sJh.getId());
  414 + msj.put(String.valueOf(sSj.getId()), sSj.getId());
  415 + }
  416 +
  417 + }
  418 + }
  419 + // 获取下行所有准点班次
  420 + for (int k = 0; k < listjh1.size(); k++) {
  421 + ScheduleRealInfo sJh = listjh1.get(k);
  422 + for (int j = 0; j < listsj1.size(); j++) {
  423 + ScheduleRealInfo sSj = listsj1.get(j);
  424 + long sjc = sSj.getFcsjActualTime() - sJh.getFcsjT();
  425 + if (sjc >= -1 * 60 * 1000 && sjc <= 3 * 60 * 1000) {
  426 + if (mjh.get(String.valueOf(sJh.getId())) == null && msj.get(String.valueOf(sSj.getId())) == null) {
  427 + sheet = new Sheet();
  428 + sheet.setDate(sJh.getScheduleDateStr());
  429 + sheet.setRealDate(sSj.getRealExecDate());
  430 + sheet.setLine(sJh.getXlName());
  431 + sheet.setZdname(sJh.getQdzName());
  432 + sheet.setJhsj(sJh.getFcsj());
  433 + sheet.setSjsj(sSj.getFcsjActual());
  434 + sheet.setSfzd("准点");
  435 + sheet.setXlDir("1");
  436 + listSheet.add(sheet);
  437 + mjh.put(String.valueOf(sJh.getId()), sJh.getId());
  438 + msj.put(String.valueOf(sSj.getId()), sSj.getId());
  439 + }
  440 + }
  441 + }
  442 + }
  443 +
  444 + // 获取下行所有不准点班次
  445 +
  446 + for (int k = 0; k < listjh1.size(); k++) {
  447 + ScheduleRealInfo sJh = listjh1.get(k);
  448 + for (int j = 0; j < listsj1.size(); j++) {
  449 + ScheduleRealInfo sSj = listsj1.get(j);
  450 + if (mjh.get(String.valueOf(sJh.getId())) == null&&msj.get(String.valueOf(sSj.getId())) == null) {
  451 + sheet = new Sheet();
  452 + sheet.setDate(sJh.getScheduleDateStr());
  453 + sheet.setRealDate(sSj.getRealExecDate());
  454 + sheet.setLine(sJh.getXlName());
  455 + sheet.setZdname(sJh.getQdzName());
  456 + sheet.setJhsj(sJh.getFcsj());
  457 + sheet.setSjsj(sSj.getFcsjActual()==null?"烂班":sSj.getFcsjActual());
  458 + sheet.setSfzd("不准点");
  459 + sheet.setXlDir("1");
  460 + listSheet.add(sheet);
  461 + mjh.put(String.valueOf(sJh.getId()), sJh.getId());
  462 + msj.put(String.valueOf(sSj.getId()), sSj.getId());
  463 + }
  464 +
  465 + }
  466 + }
  467 +
  468 + Collections.sort(listSheet, new ComparableSheet());
  469 + return listSheet;
  470 + }
  471 +
  472 +
  473 + private List<Sheet> calcSheetDdZdl(List<ScheduleRealInfo> lists,String line,String qdz,String zdz) {
  474 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
  475 + SimpleDateFormat sdf_ = new SimpleDateFormat("yyyy-MM-dd");
  476 + DecimalFormat df = new DecimalFormat("0.00");
  477 + List<Sheet> listSheet=new ArrayList<Sheet>();
  478 + List<ScheduleRealInfo> listjh0 = new ArrayList<ScheduleRealInfo>();
  479 + List<ScheduleRealInfo> listjh1 = new ArrayList<ScheduleRealInfo>();
  480 + List<ScheduleRealInfo> listsj0 = new ArrayList<ScheduleRealInfo>();
  481 + List<ScheduleRealInfo> listsj1 = new ArrayList<ScheduleRealInfo>();
  482 + long minFcsj = minFcsj(line);
  483 + for (int j = 0; j < lists.size(); j++) {
  484 + ScheduleRealInfo s = lists.get(j);
  485 + boolean fage=true;
  486 + if(s.getBcType().equals("region")){
  487 + if(s.getXlDir().equals("0")){
  488 + if(!s.getQdzName().equals(qdz))
  489 + fage=false;
  490 + }else{
  491 + if(!s.getQdzName().equals(zdz))
  492 + fage=false;
  493 + }
  494 + }
  495 + if (!isInOut(s) && fage) {
  496 + String[] fcsj = s.getFcsj().split(":");
  497 + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]);
  498 + Long fcsjT = 0L;
  499 + if (fcsjL < minFcsj) {
  500 + Calendar calendar = new GregorianCalendar();
  501 + calendar.setTime(s.getScheduleDate());
  502 + calendar.add(calendar.DATE, 1);
  503 + Date date = calendar.getTime();
  504 + try {
  505 + fcsjT = sdf.parse(sdf_.format(date) + " " + s.getFcsj()).getTime();
  506 + } catch (ParseException e) {
  507 + // TODO Auto-generated catch block
  508 + e.printStackTrace();
  509 + }
  510 + } else {
  511 + try {
  512 + fcsjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime();
  513 + } catch (ParseException e) {
  514 + // TODO Auto-generated catch block
  515 + e.printStackTrace();
  516 + }
  517 + }
  518 + //计划达到时间
  519 + Long ddsjT=0L;
  520 + try {
  521 + ddsjT = sdf.parse(s.getRealExecDate()+" "+s.getZdsj()).getTime();
  522 + } catch (ParseException e1) {
  523 + // TODO Auto-generated catch block
  524 + e1.printStackTrace();
  525 + }
  526 +
  527 + Long fcsjAcual = 0L;
  528 + if (StringUtils.isEmpty(s.getFcsjActual())) {
  529 + s.setFcsjActualTime(0L);
  530 + s.setFcsjT(fcsjT);
  531 + } else {
  532 + try {
  533 + fcsjAcual = sdf.parse(s.getRealExecDate() + " " + s.getFcsjActual()).getTime();
  534 + s.setFcsjActualTime(fcsjAcual);
  535 + s.setFcsjT(fcsjT);
  536 + } catch (ParseException e) {
  537 + // TODO Auto-generated catch block
  538 + e.printStackTrace();
  539 + }
  540 + }
  541 + if(fcsjT.longValue()>ddsjT.longValue()){
  542 + ddsjT=ddsjT+24*60*60*1000;
  543 + }
  544 + s.setZdsjT(ddsjT);
  545 + if(StringUtils.isEmpty(s.getZdsjActual())){
  546 + s.setZdsjActualTime(0L);
  547 + }else{
  548 + try {
  549 + Long ddsjActualT = sdf.parse(s.getRealExecDate()+" "+s.getZdsjActual()).getTime();
  550 + if(Math.abs(ddsjActualT-ddsjT)/60000>1000){
  551 + if(ddsjActualT.longValue()>ddsjT.longValue()){
  552 + ddsjActualT=ddsjActualT-24*60*60*1000;
  553 + }else{
  554 + ddsjActualT=ddsjActualT+24*60*60*1000;
  555 + }
  556 + }
  557 + s.setZdsjActualTime(ddsjActualT);
  558 + } catch (ParseException e) {
  559 + // TODO Auto-generated catch block
  560 + e.printStackTrace();
  561 + }
  562 + }
  563 + if (s.isSflj()) {
  564 + if (s.getXlDir().equals("0")) {
  565 + listsj0.add(s);
  566 + } else {
  567 + listsj1.add(s);
  568 + }
  569 + } else {
  570 + if (s.getXlDir().equals("0")) {
  571 + listsj0.add(s);
  572 + listjh0.add(s);
  573 + } else {
  574 + listsj1.add(s);
  575 + listjh1.add(s);
  576 + }
  577 + }
  578 + }
  579 + }
  580 + Collections.sort(listjh0, new ComparableJhZd());
  581 + Collections.sort(listjh1, new ComparableJhZd());
  582 + Collections.sort(listsj0, new ComparableZdAcual());
  583 + Collections.sort(listsj1, new ComparableZdAcual());
  584 + Map<String, Object> mjh = new HashMap<String, Object>();
  585 + Map<String, Object> msj = new HashMap<String, Object>();
  586 + Sheet sheet;
  587 + //获取上行所有准点班次
  588 + for (int k = 0; k < listjh0.size(); k++) {
  589 + ScheduleRealInfo sJh = listjh0.get(k);
  590 + for (int j = 0; j < listsj0.size(); j++) {
  591 + ScheduleRealInfo sSj = listsj0.get(j);
  592 + long sjc = sSj.getZdsjActualTime() - sJh.getZdsjT();
  593 + if (sjc >= -1 * 60 * 1000 && sjc <= 3 * 60 * 1000) {
  594 + if (mjh.get(String.valueOf(sJh.getId())) == null && msj.get(String.valueOf(sSj.getId())) == null) {
  595 + sheet = new Sheet();
  596 + sheet.setDate(sJh.getScheduleDateStr());
  597 + try {
  598 + long abs=Math.abs(sdf.parse(sJh.getRealExecDate()+" "+sJh.getFcsj()).getTime()-
  599 + sdf.parse(sJh.getRealExecDate()+" "+sJh.getZdsj()).getTime())/60000;
  600 + if(abs>1000){
  601 + Calendar calendar = new GregorianCalendar();
  602 + calendar.setTime(sdf_.parse(sJh.getRealExecDate()));
  603 + calendar.add(calendar.DATE, 1);
  604 + Date date = calendar.getTime();
  605 + sheet.setRealDate(sdf_.format(date));
  606 + }else{
  607 + sheet.setRealDate(sJh.getRealExecDate());
  608 + }
  609 + } catch (ParseException e) {
  610 + // TODO Auto-generated catch block
  611 + e.printStackTrace();
  612 + }
  613 + sheet.setLine(sJh.getXlName());
  614 + sheet.setZdname(sJh.getQdzName());
  615 + sheet.setJhsj(sJh.getZdsj());
  616 + sheet.setSjsj(sSj.getZdsjActual());
  617 + sheet.setSfzd("准点");
  618 + sheet.setXlDir("0");
  619 + listSheet.add(sheet);
  620 + mjh.put(String.valueOf(sJh.getId()), sJh.getId());
  621 + msj.put(String.valueOf(sSj.getId()), sSj.getId());
  622 + }
  623 + }
  624 + }
  625 + }
  626 + // 获取上行所有不准点班次
  627 + for (int k = 0; k < listjh0.size(); k++) {
  628 + ScheduleRealInfo sJh = listjh0.get(k);
  629 + for (int j = 0; j < listsj0.size(); j++) {
  630 + ScheduleRealInfo sSj = listsj0.get(j);
  631 + if (mjh.get(String.valueOf(sJh.getId())) == null&&msj.get(String.valueOf(sSj.getId())) == null) {
  632 + sheet = new Sheet();
  633 + sheet.setDate(sJh.getScheduleDateStr());
  634 + try {
  635 + long abs=Math.abs(sdf.parse(sJh.getRealExecDate()+" "+sJh.getFcsj()).getTime()-
  636 + sdf.parse(sJh.getRealExecDate()+" "+sJh.getZdsj()).getTime())/60000;
  637 + if(abs>1000){
  638 + Calendar calendar = new GregorianCalendar();
  639 + calendar.setTime(sdf_.parse(sJh.getRealExecDate()));
  640 + calendar.add(calendar.DATE, 1);
  641 + Date date = calendar.getTime();
  642 + sheet.setRealDate(sdf_.format(date));
  643 + }else{
  644 + sheet.setRealDate(sJh.getRealExecDate());
  645 + }
  646 + } catch (ParseException e) {
  647 + // TODO Auto-generated catch block
  648 + e.printStackTrace();
  649 + }
  650 + sheet.setLine(sJh.getXlName());
  651 + sheet.setZdname(sJh.getQdzName());
  652 + sheet.setJhsj(sJh.getZdsj());
  653 + sheet.setSjsj(sSj.getZdsjActual()==null?"烂班":sSj.getZdsjActual());
  654 + sheet.setSfzd("不准点");
  655 + sheet.setXlDir("0");
  656 + listSheet.add(sheet);
  657 + mjh.put(String.valueOf(sJh.getId()), sJh.getId());
  658 + msj.put(String.valueOf(sSj.getId()), sSj.getId());
  659 + }
  660 +
  661 + }
  662 + }
  663 + // 获取下行所有准点班次
  664 + for (int k = 0; k < listjh1.size(); k++) {
  665 + ScheduleRealInfo sJh = listjh1.get(k);
  666 + for (int j = 0; j < listsj1.size(); j++) {
  667 + ScheduleRealInfo sSj = listsj1.get(j);
  668 + long sjc = sSj.getZdsjActualTime() - sJh.getZdsjT();
  669 + if (sjc >= -1 * 60 * 1000 && sjc <= 3 * 60 * 1000) {
  670 + if (mjh.get(String.valueOf(sJh.getId())) == null && msj.get(String.valueOf(sSj.getId())) == null) {
  671 + sheet = new Sheet();
  672 + sheet.setDate(sJh.getScheduleDateStr());
  673 + try {
  674 + long abs=Math.abs(sdf.parse(sJh.getRealExecDate()+" "+sJh.getFcsj()).getTime()-
  675 + sdf.parse(sJh.getRealExecDate()+" "+sJh.getZdsj()).getTime())/60000;
  676 + if(abs>1000){
  677 + Calendar calendar = new GregorianCalendar();
  678 + calendar.setTime(sdf_.parse(sJh.getRealExecDate()));
  679 + calendar.add(calendar.DATE, 1);
  680 + Date date = calendar.getTime();
  681 + sheet.setRealDate(sdf_.format(date));
  682 + }else{
  683 + sheet.setRealDate(sJh.getRealExecDate());
  684 + }
  685 + } catch (ParseException e) {
  686 + // TODO Auto-generated catch block
  687 + e.printStackTrace();
  688 + }
  689 +
  690 + sheet.setLine(sJh.getXlName());
  691 + sheet.setZdname(sJh.getQdzName());
  692 + sheet.setJhsj(sJh.getZdsj());
  693 + sheet.setSjsj(sSj.getZdsjActual());
  694 + sheet.setSfzd("准点");
  695 + sheet.setXlDir("1");
  696 + listSheet.add(sheet);
  697 + mjh.put(String.valueOf(sJh.getId()), sJh.getId());
  698 + msj.put(String.valueOf(sSj.getId()), sSj.getId());
  699 + }
  700 + }
  701 + }
  702 + }
  703 +
  704 + // 获取下行所有不准点班次
  705 + for (int k = 0; k < listjh1.size(); k++) {
  706 + ScheduleRealInfo sJh = listjh1.get(k);
  707 + for (int j = 0; j < listsj1.size(); j++) {
  708 + ScheduleRealInfo sSj = listsj1.get(j);
  709 + if (mjh.get(String.valueOf(sJh.getId())) == null&&msj.get(String.valueOf(sSj.getId())) == null) {
  710 + sheet = new Sheet();
  711 + sheet.setDate(sJh.getScheduleDateStr());
  712 + try {
  713 + long abs=Math.abs(sdf.parse(sJh.getRealExecDate()+" "+sJh.getFcsj()).getTime()-
  714 + sdf.parse(sJh.getRealExecDate()+" "+sJh.getZdsj()).getTime())/60000;
  715 + if(abs>1000){
  716 + Calendar calendar = new GregorianCalendar();
  717 + calendar.setTime(sdf_.parse(sJh.getRealExecDate()));
  718 + calendar.add(calendar.DATE, 1);
  719 + Date date = calendar.getTime();
  720 + sheet.setRealDate(sdf_.format(date));
  721 + }else{
  722 + sheet.setRealDate(sJh.getRealExecDate());
  723 + }
  724 + } catch (ParseException e) {
  725 + // TODO Auto-generated catch block
  726 + e.printStackTrace();
  727 + }
  728 + sheet.setLine(sJh.getXlName());
  729 + sheet.setZdname(sJh.getQdzName());
  730 + sheet.setJhsj(sJh.getZdsj());
  731 + sheet.setSjsj(sSj.getZdsjActual()==null?"烂班":sSj.getZdsjActual());
  732 + sheet.setSfzd("不准点");
  733 + sheet.setXlDir("1");
  734 + listSheet.add(sheet);
  735 + mjh.put(String.valueOf(sJh.getId()), sJh.getId());
  736 + msj.put(String.valueOf(sSj.getId()), sSj.getId());
  737 + }
  738 +
  739 + }
  740 + }
  741 +
  742 + Collections.sort(listSheet, new ComparableSheet());
  743 + return listSheet;
  744 + }
  745 + private Long minFcsj(String line){
  746 + String minfcsj="02:00";
  747 + List<Line> lineList=lineRepository.findLineByCode(line);
  748 + if(lineList.size()>0){
  749 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  750 + + " id = ("
  751 + + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'"
  752 + + ")";
  753 + minfcsj= jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  754 + }
  755 + String[] minSjs = minfcsj.split(":");
  756 + //车辆最早发车时间 用了过滤超第二天0点的数据
  757 + Long minSj=Long.parseLong(minSjs[0])*60+Long.parseLong(minSjs[1]);
  758 + return minSj;
  759 + }
  760 +
  761 + private static boolean isInOut(ScheduleRealInfo s){
  762 + boolean fage=false;
  763 + if(s.getBcType().equals("in")){
  764 + fage=true;
  765 + }
  766 + if(s.getBcType().equals("out")){
  767 + fage=true;
  768 + }
  769 + if(s.getBcType().equals("ldks")){
  770 + fage=true;
  771 + }
  772 + if(s.isCcService()){
  773 + fage=true;
  774 + }
  775 + return fage;
  776 + }
  777 + @Override
  778 + public List<Map<String, Object>> calcTurnoutrate(Map<String, Object> map) {
  779 + final DecimalFormat df = new DecimalFormat("0.00");
  780 + String line="";
  781 + if(map.get("line")!=null){
  782 + line =map.get("line").toString().trim();
  783 + }
  784 + String gs="";
  785 + if(map.get("gsdmTurn")!=null){
  786 + gs=map.get("gsdmTurn").toString().trim();
  787 + }
  788 + String fgs="";
  789 + if(map.get("fgsdmTurn")!=null){
  790 + fgs=map.get("fgsdmTurn").toString().trim();
  791 + }
  792 + String nature="0";
  793 + if(map.get("nature")!=null){
  794 + nature=map.get("nature").toString();
  795 + }
  796 + Map<String, Boolean> lineMap=lineService.lineNature();
  797 +
  798 + String startDate=map.get("startDate").toString();
  799 + String endDate=map.get("endDate").toString();
  800 + String date=startDate+"-"+endDate;
  801 + if(startDate.equals(endDate)){
  802 + date=startDate;
  803 + }else{
  804 + date=startDate+"-"+endDate;
  805 + }
  806 + String type=map.get("type").toString();
  807 + final String dates=date;
  808 + String sql_="";
  809 + if(line.equals("")){
  810 + sql_= " and gsdm ='"+gs+"' and fgsdm like '%"+fgs+"%'";
  811 + }else{
  812 + sql_=" and xl='"+line+"'";
  813 + }
  814 + String sql="select t.*,y.warrant_car as qzpcs from ("
  815 + + " select gsdm,fgsdm,xl,xl_name,sum(jhcc) as jhcc,sum(sjcc) as sjcc,"
  816 + + " sum(sjcczgf) as sjcczgf,sum(jhbcs) as jhbcs,sum(sjbcs) as sjbcs "
  817 + + " from bsth_c_calc_sheet where date >='"+startDate+"' and date <='"+endDate+"'"
  818 + + sql_
  819 + + " group by gsdm,fgsdm,xl,xl_name ) "
  820 + + " t LEFT JOIN bsth_c_line y "
  821 + + " on t.xl=y.line_code order by fgsdm,xl_name";
  822 + List<Map<String, Object>> lists=jdbcTemplate.query(sql,
  823 + new RowMapper<Map<String, Object>>(){
  824 + @Override
  825 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  826 + Map<String, Object> s=new HashMap<String,Object>();
  827 + s.put("rq",dates);
  828 + s.put("gsdm", rs.getString("gsdm"));
  829 + s.put("fgsdm", rs.getString("fgsdm"));
  830 + s.put("gsName", BasicData.businessCodeNameMap.get(rs.getString("gsdm")));
  831 + s.put("fgsName", BasicData.businessFgsCodeNameMap.get(rs.getString("fgsdm")+"_"+rs.getString("gsdm")));
  832 + s.put("xl", rs.getString("xl"));
  833 + s.put("xlName", rs.getString("xl_name"));
  834 + s.put("jhcc", rs.getInt("jhcc"));
  835 + s.put("sjcc", rs.getInt("sjcc"));
  836 + s.put("qzpcs",rs.getInt("qzpcs"));
  837 + s.put("sjcczgf", rs.getInt("sjcczgf"));
  838 + if(rs.getInt("jhcc")>0){
  839 + s.put("ccl",df.format((float)rs.getInt("sjcc")/rs.getInt("jhcc")*100)+"%");
  840 + s.put("cclzgf", df.format((float)rs.getInt("sjcczgf")/rs.getInt("jhcc")*100)+"%");
  841 + }else{
  842 + s.put("ccl", "0.00%");
  843 + s.put("cclzgf","0.00%");
  844 + }
  845 + s.put("jhbc", rs.getInt("jhbcs"));
  846 + s.put("sjbc", rs.getInt("sjbcs"));
  847 + if(rs.getInt("jhbcs")>0){
  848 + s.put("zxl", df.format((float)rs.getInt("sjbcs")/rs.getInt("jhbcs")*100)+"%");
  849 + }else{
  850 + s.put("zxl", "0.00%");
  851 + }
  852 + s.put("sm", "");
  853 + return s;
  854 + }
  855 + });
  856 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  857 +
  858 + List<Map<String, Object>> list=new ArrayList<Map<String,Object>>();
  859 + int jhcc = 0, sjcc = 0,sjcczgf=0;;
  860 + int jhbc = 0, sjbc = 0;
  861 + int qz = 0;
  862 + int count=0;
  863 + Map<String, String> xlMap=new HashMap<String,String>();
  864 + for(Map<String, Object> m : lists){
  865 + if(nature.equals("0")){
  866 + list.add(m);
  867 + jhcc += Integer.valueOf(m.get("jhcc").toString());
  868 + sjcc += Integer.valueOf(m.get("sjcc").toString());
  869 + jhbc += Integer.valueOf(m.get("jhbc").toString());
  870 + sjbc += Integer.valueOf(m.get("sjbc").toString());
  871 + sjcczgf +=Integer.valueOf(m.get("sjcczgf").toString());
  872 + qz += Integer.valueOf(m.get("qzpcs").toString());
  873 + if(xlMap.get(m.get("xl").toString())==null){
  874 + count++;
  875 + xlMap.put(m.get("xl").toString(), m.get("xl").toString());
  876 + }
  877 + }else if(nature.equals("1")){
  878 + if(lineMap.get(m.get("xl").toString())){
  879 + list.add(m);
  880 + jhcc += Integer.valueOf(m.get("jhcc").toString());
  881 + sjcc += Integer.valueOf(m.get("sjcc").toString());
  882 + jhbc += Integer.valueOf(m.get("jhbc").toString());
  883 + sjbc += Integer.valueOf(m.get("sjbc").toString());
  884 + sjcczgf +=Integer.valueOf(m.get("sjcczgf").toString());
  885 + qz += Integer.valueOf(m.get("qzpcs").toString());
  886 + if(xlMap.get(m.get("xl").toString())==null){
  887 + count++;
  888 + xlMap.put(m.get("xl").toString(), m.get("xl").toString());
  889 + }
  890 + }
  891 + }else{
  892 + if(!lineMap.get(m.get("xl").toString())){
  893 + list.add(m);
  894 + jhcc += Integer.valueOf(m.get("jhcc").toString());
  895 + sjcc += Integer.valueOf(m.get("sjcc").toString());
  896 + jhbc += Integer.valueOf(m.get("jhbc").toString());
  897 + sjbc += Integer.valueOf(m.get("sjbc").toString());
  898 + sjcczgf +=Integer.valueOf(m.get("sjcczgf").toString());
  899 + qz += Integer.valueOf(m.get("qzpcs").toString());
  900 + if(xlMap.get(m.get("xl").toString())==null){
  901 + count++;
  902 + xlMap.put(m.get("xl").toString(), m.get("xl").toString());
  903 + }
  904 + }
  905 + }
  906 +
  907 + }
  908 +
  909 + Map<String, Object> tempMap=new HashMap<String,Object>();
  910 + tempMap.put("rq", "分类汇总");
  911 + tempMap.put("line_", "共" + list.size() + "条线路");
  912 + tempMap.put("xlName", "共" +count + "条线路");
  913 + tempMap.put("jhcc", jhcc);
  914 + tempMap.put("sjcc", sjcc);
  915 + tempMap.put("sjcczgf", sjcczgf);
  916 + tempMap.put("jhbc", jhbc);
  917 + tempMap.put("sjbc", sjbc);
  918 + tempMap.put("qzpcs", qz);
  919 + tempMap.put("sm", "");
  920 + if(jhcc != 0 && sjcc != 0){
  921 + tempMap.put("ccl", df.format(((float)sjcc / jhcc)*100)+"%");
  922 + tempMap.put("cclzgf", df.format(((float)sjcczgf / jhcc)*100)+"%");
  923 + }else{
  924 + tempMap.put("ccl", "0.00%");
  925 + tempMap.put("cclzgf", "0.00%");
  926 + }
  927 + if(jhbc != 0 && sjbc != 0){
  928 + tempMap.put("zxl", df.format(((float)sjbc / jhbc)*100)+"%");
  929 + }else{
  930 + tempMap.put("zxl", "0.00%");
  931 + }
  932 + if (type.equals("export")) {
  933 + String lineName=map.get("lineName").toString();
  934 + ReportUtils ee = new ReportUtils();
  935 + listI.add(list.iterator());
  936 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  937 + ee.excelReplace(listI, new Object[] { tempMap }, path + "mould/calcTurnoutrate.xls", path + "export/"
  938 + + dates + "-" + lineName + "-营运线路出车率统计表.xls");
  939 + }
  940 + list.add(tempMap);
  941 + return list;
  942 + }
  943 +}
  944 +
  945 +class ComparableSheet implements Comparator<Sheet>{
  946 + @Override
  947 + public int compare(Sheet o1, Sheet o2) {
  948 + // TODO Auto-generated method stub
  949 + return (o1.getXlDir()+o1.getRealDate()+o1.getJhsj()).compareTo((o2.getXlDir()+o2.getRealDate()+o2.getJhsj()));
  950 + }
  951 +}
  952 +
  953 +class ComparableZdAcual implements Comparator<ScheduleRealInfo>{
  954 + @Override
  955 + public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) {
  956 + // TODO Auto-generated method stub
  957 + return o1.getZdsjActualTime().compareTo(o2.getZdsjActualTime());
  958 + }
  959 +}
  960 +
  961 +class ComparableJhZd implements Comparator<ScheduleRealInfo>{
  962 + @Override
  963 + public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) {
  964 + // TODO Auto-generated method stub
  965 + return o1.getZdsjT().compareTo(o2.getZdsjT());
  966 + }
  967 +}
src/main/java/com/bsth/service/report/impl/CulateMileageServiceImpl.java
@@ -1084,14 +1084,21 @@ public class CulateMileageServiceImpl implements CulateMileageService{ @@ -1084,14 +1084,21 @@ public class CulateMileageServiceImpl implements CulateMileageService{
1084 while (it.hasNext()) { 1084 while (it.hasNext()) {
1085 ChildTaskPlan childTaskPlan = it.next(); 1085 ChildTaskPlan childTaskPlan = it.next();
1086 if(!childTaskPlan.isDestroy()){ 1086 if(!childTaskPlan.isDestroy()){
1087 - if(childTaskPlan.getMileageType().equals("service")){  
1088 - ljyy =Arith.add(ljyy,childTaskPlan.getMileage());  
1089 - }  
1090 - if(childTaskPlan.getMileageType().equals("empty")){  
1091 - if(childTaskPlan.getType2().equals("2")||childTaskPlan.getType2().equals("3")){  
1092 - ljjcc =Arith.add(ljjcc, childTaskPlan.getMileage());  
1093 - }  
1094 - } 1087 + if(childTaskPlan.getCcId()==null){
  1088 + if(childTaskPlan.getMileageType().equals("service")){
  1089 + ljyy =Arith.add(ljyy,childTaskPlan.getMileage());
  1090 + }
  1091 + if(childTaskPlan.getMileageType().equals("empty")){
  1092 + if(childTaskPlan.getType2().equals("2")||childTaskPlan.getType2().equals("3")){
  1093 + ljjcc =Arith.add(ljjcc, childTaskPlan.getMileage());
  1094 + }
  1095 + }
  1096 + if(childTaskPlan.getMileageType().equals("empty")){
  1097 + if(childTaskPlan.getType2().equals("1")){
  1098 + ljkfks =Arith.add(ljkfks, childTaskPlan.getMileage());
  1099 + }
  1100 + }
  1101 + }
1095 } 1102 }
1096 } 1103 }
1097 } 1104 }
@@ -1211,7 +1218,8 @@ public class CulateMileageServiceImpl implements CulateMileageService{ @@ -1211,7 +1218,8 @@ public class CulateMileageServiceImpl implements CulateMileageService{
1211 // }else{ 1218 // }else{
1212 if(childTaskPlan.getType2().equals("2")||childTaskPlan.getType2().equals("3")){ 1219 if(childTaskPlan.getType2().equals("2")||childTaskPlan.getType2().equals("3")){
1213 if (!childTaskPlan.isDestroy()) { 1220 if (!childTaskPlan.isDestroy()) {
1214 - if(childTaskPlan.getReason().equals(item)){ 1221 + String reason=childTaskPlan.getReason()==null?"":childTaskPlan.getReason();
  1222 + if(reason.equals(item)){
1215 zrwjcclc=Arith.add(zrwjcclc,childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage()); 1223 zrwjcclc=Arith.add(zrwjcclc,childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage());
1216 } 1224 }
1217 } 1225 }
@@ -1607,5 +1615,55 @@ public class CulateMileageServiceImpl implements CulateMileageService{ @@ -1607,5 +1615,55 @@ public class CulateMileageServiceImpl implements CulateMileageService{
1607 } 1615 }
1608 return ljgl; 1616 return ljgl;
1609 } 1617 }
  1618 +
  1619 + @Override
  1620 + public double culateLjksgl(List<ScheduleRealInfo> lists) {
  1621 + double ljks=0.0;
  1622 + for (int i = 0; i < lists.size(); i++) {
  1623 + ScheduleRealInfo t=lists.get(i);
  1624 + if(t.isSflj()){
  1625 + if(isInOut(t)){
  1626 + Set<ChildTaskPlan> childTaskPlans = t.getcTasks();
  1627 + if(childTaskPlans.isEmpty()){
  1628 + if(!t.isDestroy()){
  1629 + ljks =Arith.add(ljks, t.getJhlc());
  1630 + }
  1631 +
  1632 + }
  1633 + }else{
  1634 + Set<ChildTaskPlan> childTaskPlans = t.getcTasks();
  1635 + if(!childTaskPlans.isEmpty()){
  1636 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1637 + while (it.hasNext()) {
  1638 + ChildTaskPlan childTaskPlan = it.next();
  1639 + if(!childTaskPlan.isDestroy()){
  1640 + if(childTaskPlan.getMileageType().equals("empty") && childTaskPlan.getCcId()==null){
  1641 + ljks =Arith.add(ljks, childTaskPlan.getMileage());
  1642 + }
  1643 + }
  1644 + }
  1645 + }
  1646 + }
  1647 + }else{
  1648 + Set<ChildTaskPlan> childTaskPlans = t.getcTasks();
  1649 + if(!childTaskPlans.isEmpty()){
  1650 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1651 + while (it.hasNext()) {
  1652 + ChildTaskPlan childTaskPlan = it.next();
  1653 + if(childTaskPlan.getCcId()==null){
  1654 + if("empty".equals(childTaskPlan.getMileageType())&&"临加".equals(childTaskPlan.getType1())){
  1655 + if (!childTaskPlan.isDestroy()) {
  1656 + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  1657 + ljks=Arith.add(ljks,jhgl);
  1658 + }
  1659 + }
  1660 + }
  1661 + }
  1662 + }
  1663 +
  1664 + }
  1665 + }
  1666 + return ljks;
  1667 + }
1610 1668
1611 } 1669 }
src/main/java/com/bsth/service/schedule/EmployeeConfigInfoService.java
@@ -7,8 +7,14 @@ import com.bsth.service.schedule.exception.ScheduleException; @@ -7,8 +7,14 @@ import com.bsth.service.schedule.exception.ScheduleException;
7 * Created by xu on 16/5/10. 7 * Created by xu on 16/5/10.
8 */ 8 */
9 public interface EmployeeConfigInfoService extends BService<EmployeeConfigInfo, Long> { 9 public interface EmployeeConfigInfoService extends BService<EmployeeConfigInfo, Long> {
  10 + // 验证驾驶员配置是否重复配置
10 void validate_jsy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException; 11 void validate_jsy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException;
  12 + // 验证售票员配置是否重复配置
11 void validate_spy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException; 13 void validate_spy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException;
  14 + // 验证驾驶员是否配置在指定线路
  15 + void validate_jsy_config(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException;
  16 + // 验证售票员是否配置在指定线路
  17 + void validate_spy_config(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException;
12 void toggleCancel(Long id) throws ScheduleException; 18 void toggleCancel(Long id) throws ScheduleException;
13 Long getMaxDbbm(Integer xlId); 19 Long getMaxDbbm(Integer xlId);
14 } 20 }