Commit 4fbb34d89e667066e2d69b288115a7c3133cbf48

Authored by 潘钊
2 parents 8ecfd352 48436fa4

Merge branch 'minhang' into jiading

Showing 28 changed files with 1842 additions and 784 deletions

Too many changes to show.

To preserve performance only 28 of 92 files are displayed.

src/main/java/com/bsth/controller/realcontrol/RealMapController.java
1 1 package com.bsth.controller.realcontrol;
2 2  
  3 +import com.bsth.data.gpsdata.arrival.GeoCacheData;
  4 +import com.bsth.data.gpsdata.arrival.entity.TimedEnableStationRoute;
3 5 import com.bsth.service.realcontrol.RealMapService;
4 6 import org.springframework.beans.factory.annotation.Autowired;
5 7 import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
6 9 import org.springframework.web.bind.annotation.RequestParam;
7 10 import org.springframework.web.bind.annotation.RestController;
8 11  
... ... @@ -74,4 +77,9 @@ public class RealMapController {
74 77 public Map<String, Object> multiSectionRoute(@RequestParam String codeIdx){
75 78 return realMapService.multiSectionRoute(codeIdx);
76 79 }
  80 +
  81 + @RequestMapping(value = "/lockAndFlxedTimeEnabled", method = RequestMethod.POST)
  82 + public void lockAndFlxedTimeEnabled(TimedEnableStationRoute tes){
  83 + GeoCacheData.tesMap.put(tes.getLineCode(), tes);
  84 + }
77 85 }
... ...
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
... ... @@ -417,6 +417,70 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
417 417 }
418 418 return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type);
419 419 }
  420 +
  421 + /*
  422 + * 公里修正报表
  423 + */
  424 + @RequestMapping(value="/mileageReportTj")
  425 + public List<Map<String,Object>> mileageReport(@RequestParam Map<String, Object> map){
  426 + String gsdm="";
  427 + if(map.get("gsdm")!=null){
  428 + gsdm=map.get("gsdm").toString();
  429 + }
  430 + String fgsdm="";
  431 + if(map.get("fgsdm")!=null){
  432 + fgsdm=map.get("fgsdm").toString();
  433 + }
  434 + String line="";
  435 + if(map.get("line")!=null){
  436 + line=map.get("line").toString();
  437 + }
  438 + String date="";
  439 + if(map.get("date")!=null){
  440 + date=map.get("date").toString();
  441 + }
  442 + String date2="";
  443 + if(map.get("date2")!=null){
  444 + date2=map.get("date2").toString();
  445 + }
  446 + String xlName="";
  447 + if(map.get("xlName")!=null){
  448 + xlName=map.get("xlName").toString();
  449 + }
  450 + return scheduleRealInfoService.mileageReport(gsdm,fgsdm,line, date,date2);
  451 + }
  452 +
  453 + /*
  454 + * 班次修正报表
  455 + */
  456 + @RequestMapping(value="/scheduleCorrectionReport")
  457 + public List<Map<String,Object>> scheduleCorrectionReport(@RequestParam Map<String, Object> map){
  458 + String gsdm="";
  459 + if(map.get("gsdm")!=null){
  460 + gsdm=map.get("gsdm").toString();
  461 + }
  462 + String fgsdm="";
  463 + if(map.get("fgsdm")!=null){
  464 + fgsdm=map.get("fgsdm").toString();
  465 + }
  466 + String line="";
  467 + if(map.get("line")!=null){
  468 + line=map.get("line").toString();
  469 + }
  470 + String date="";
  471 + if(map.get("date")!=null){
  472 + date=map.get("date").toString();
  473 + }
  474 + String date2="";
  475 + if(map.get("date2")!=null){
  476 + date2=map.get("date2").toString();
  477 + }
  478 + String xlName="";
  479 + if(map.get("xlName")!=null){
  480 + xlName=map.get("xlName").toString();
  481 + }
  482 + return scheduleRealInfoService.scheduleCorrectionReport(gsdm,fgsdm,line, date,date2);
  483 + }
420 484  
421 485 @RequestMapping(value="/MapById",method = RequestMethod.GET)
422 486 public Map<String, Object> MapById(@RequestParam("id") Long id){
... ...
src/main/java/com/bsth/controller/realcontrol/anomalyCheckController.java
... ... @@ -95,4 +95,14 @@ public class anomalyCheckController {
95 95 public void updateCacheBuff(){
96 96 geoCacheData.loadData();
97 97 }
  98 +
  99 + @RequestMapping(value = "/reCalcLpSch")
  100 + public void reCalcLpSch(){
  101 + dayOfSchedule._test_reCalcLpSch();
  102 + }
  103 +
  104 + @RequestMapping(value = "/findSchByLpName")
  105 + public List<ScheduleRealInfo> findSchByLpName(@RequestParam String lpName){
  106 + return dayOfSchedule.getLpScheduleMap().get(lpName);
  107 + }
98 108 }
... ...
src/main/java/com/bsth/controller/report/ReportController.java
... ... @@ -84,12 +84,19 @@ public class ReportController {
84 84 @RequestParam int zd){
85 85 return service.queryStrinon(line,zd);
86 86 }
  87 + //根据排班查到离站
87 88 @RequestMapping(value="/queryInOutStrtion" ,method = RequestMethod.GET)
88 89 public List<Map<String, Object>> queryInOutStrtion(@RequestParam String line,
89 90 @RequestParam String date,@RequestParam int zd,@RequestParam String lzsj){
90 91 return service.queryInOutStrtion(line,date,zd,lzsj);
91 92 }
92 93  
  94 + //根据GPS数据查到离站
  95 + @RequestMapping(value="/queryInOutStrtions" ,method = RequestMethod.GET)
  96 + public List<Map<String, Object>> queryInOutStrtions(@RequestParam String line,
  97 + @RequestParam String date,@RequestParam int zd,@RequestParam String lzsj){
  98 + return service.queryInOutStrtions(line,date,zd,lzsj);
  99 + }
93 100 @RequestMapping(value="/queryListClzd" ,method = RequestMethod.GET)
94 101 public List<ArrivalInfo> queryListClzd(@RequestParam String zd,@RequestParam String line,
95 102 @RequestParam String zdlx,@RequestParam String fcsj,@RequestParam String ddsj){
... ...
src/main/java/com/bsth/data/car_out_info/CarOutInfoHandler.java
... ... @@ -54,27 +54,19 @@ public class CarOutInfoHandler {
54 54 * 全量更新发车信息表
55 55 */
56 56 public void updateAll() {
57   - Set<String> ks = BasicData.lineCode2NameMap.keySet();
58   - for (String lineCode : ks) {
59   - update(lineCode);
60   - }
61   - }
62   -
63   - public void update(String lineCode) {
64   - try {
65   - ArrayListMultimap<String, ScheduleRealInfo> lpScheduleMap = dayOfSchedule.getLpScheduleMap();
66   - List<ScheduleRealInfo> list = new ArrayList<>();
  57 + try{
  58 + //将班次按线路分组
  59 + List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll());
  60 + ArrayListMultimap<String, ScheduleRealInfo> xlMaps = ArrayListMultimap.create();
  61 + for(ScheduleRealInfo sch : all){
  62 + xlMaps.put(sch.getXlBm(), sch);
  63 + }
67 64  
68   - Set<String> ks = lpScheduleMap.keySet();
69   - String prefix = lineCode + "_";
  65 + Set<String> ks = xlMaps.keySet();
70 66 for (String k : ks) {
71   - if (k.startsWith(prefix)) {
72   - list.addAll(lpScheduleMap.get(k));
73   - }
  67 + update(xlMaps.get(k));
74 68 }
75   -
76   - update(list);
77   - } catch (Exception e) {
  69 + }catch (Exception e){
78 70 logger.error("", e);
79 71 }
80 72 }
... ...
src/main/java/com/bsth/data/gpsdata/arrival/GeoCacheData.java
... ... @@ -2,6 +2,7 @@ package com.bsth.data.gpsdata.arrival;
2 2  
3 3 import com.bsth.data.gpsdata.GpsEntity;
4 4 import com.bsth.data.gpsdata.arrival.entity.StationRoute;
  5 +import com.bsth.data.gpsdata.arrival.entity.TimedEnableStationRoute;
5 6 import com.bsth.data.gpsdata.arrival.utils.CircleQueue;
6 7 import com.bsth.data.gpsdata.arrival.utils.StationRouteComp;
7 8 import com.google.common.collect.ArrayListMultimap;
... ... @@ -53,6 +54,10 @@ public class GeoCacheData {
53 54 //线路限速信息
54 55 private static Map<String, Double> speedLimitMap;
55 56  
  57 + //需要定时刷新的站点路由
  58 + public static Map<String, TimedEnableStationRoute> tesMap = new HashMap<>();
  59 + //TimedEnableStationRoute
  60 +
56 61 @Autowired
57 62 JdbcTemplate jdbcTemplate;
58 63  
... ... @@ -282,6 +287,28 @@ public class GeoCacheData {
282 287 connectStationRoute(tempMap.get(key));
283 288 }
284 289  
  290 + //定时启用的站点走向
  291 + if(tesMap.size() > 0){
  292 + List<String> rems = new ArrayList<>();
  293 + long t = System.currentTimeMillis();
  294 + for(TimedEnableStationRoute tes : tesMap.values()){
  295 + if(tes.getEnableTime() > t){
  296 + logger.info("锁住站点路由," + tes.getLineCode());
  297 + tempMap.replaceValues(tes.getLineCode() + "_0", stationCacheMap.get(tes.getLineCode() + "_0"));
  298 + tempMap.replaceValues(tes.getLineCode() + "_1", stationCacheMap.get(tes.getLineCode() + "_1"));
  299 + }
  300 + else
  301 + rems.add(tes.getLineCode());
  302 + }
  303 +
  304 + //remove
  305 + if(rems.size() > 0){
  306 + for(String lineCode : rems){
  307 + logger.info("启用路由," + lineCode);
  308 + tesMap.remove(lineCode);
  309 + }
  310 + }
  311 + }
285 312 stationCacheMap = tempMap;
286 313 routeCodeMap = codeMap;
287 314 }
... ...
src/main/java/com/bsth/data/gpsdata/arrival/entity/TimedEnableStationRoute.java 0 → 100644
  1 +package com.bsth.data.gpsdata.arrival.entity;
  2 +
  3 +/**
  4 + * 定时启用站点路由
  5 + * Created by panzhao on 2017/8/28.
  6 + */
  7 +public class TimedEnableStationRoute {
  8 +
  9 + private String lineCode;
  10 +
  11 + private Long enableTime;
  12 +
  13 + public String getLineCode() {
  14 + return lineCode;
  15 + }
  16 +
  17 + public void setLineCode(String lineCode) {
  18 + this.lineCode = lineCode;
  19 + }
  20 +
  21 + public Long getEnableTime() {
  22 + return enableTime;
  23 + }
  24 +
  25 + public void setEnableTime(Long enableTime) {
  26 + this.enableTime = enableTime;
  27 + }
  28 +}
... ...
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
... ... @@ -338,6 +338,9 @@ public class InOutStationSignalHandle extends SignalHandle{
338 338 if(lpNext != null){
339 339 lpNext.setQdzArrDatesj(sch.getZdsjActual());
340 340 }
  341 + else{
  342 + logger.info(sch.getClZbh() + " 到终点,无下一班");
  343 + }
341 344  
342 345 //通知客户端
343 346 sendUtils.sendZdsj(sch, lpNext, doneSum);
... ...
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
... ... @@ -278,12 +278,14 @@ public class DayOfSchedule {
278 278 List<String> lprms = new ArrayList<>();
279 279 Set<String> lps = lpScheduleMap.keySet();
280 280 for (String lp : lps) {
281   - if (lp.indexOf(lineCode + "_") != -1)
  281 + if (lp.startsWith(lineCode + "_"))
282 282 lprms.add(lp);
283 283 }
284 284  
285   - for (String lp : lprms)
  285 + for (String lp : lprms){
  286 + logger.info("清理路牌映射 " + lp);
286 287 lpScheduleMap.removeAll(lp);
  288 + }
287 289  
288 290 logger.info(lineCode + "排班清理 " + count);
289 291 }
... ... @@ -1137,4 +1139,16 @@ public class DayOfSchedule {
1137 1139 public ArrayListMultimap<String, ScheduleRealInfo> getLpScheduleMap() {
1138 1140 return lpScheduleMap;
1139 1141 }
  1142 +
  1143 + /**
  1144 + * 重新全量计算路牌下的班次关联性
  1145 + * 临时性的函数
  1146 + */
  1147 + public void _test_reCalcLpSch() {
  1148 + Map<String ,Collection<ScheduleRealInfo>> map = lpScheduleMap.asMap();
  1149 + Set<String> ks = map.keySet();
  1150 + for(String k : ks){
  1151 + schAttrCalculator.calcQdzTimePlan(new ArrayList<ScheduleRealInfo>(map.get(k)));
  1152 + }
  1153 + }
1140 1154 }
1141 1155 \ No newline at end of file
... ...
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
... ... @@ -117,8 +117,7 @@ public class SchAttrCalculator {
117 117 for(int i = 1; i < len; i ++){
118 118 curr = list.get(i);
119 119  
120   - if(prve.getZdzName().equals(curr.getQdzName())
121   - || prve.getZdzCode().equals(curr.getQdzCode())){
  120 + if(isJoin(prve, curr)){
122 121 curr.setQdzArrDatejh(prve.getZdsj());
123 122 if(StringUtils.isNotEmpty(prve.getZdsjActual()))
124 123 curr.setQdzArrDatesj(prve.getZdsjActual());
... ... @@ -126,6 +125,13 @@ public class SchAttrCalculator {
126 125 prve = curr;
127 126 }
128 127 }
  128 +
  129 + private boolean isJoin(ScheduleRealInfo prve, ScheduleRealInfo curr) {
  130 + return prve.getZdzName().equals(curr.getQdzName())//名称相等
  131 + || prve.getZdzCode().equals(curr.getQdzCode())//编码相等
  132 + || prve.getZdzName().startsWith(curr.getQdzName())//起始包括
  133 + || curr.getQdzName().startsWith(prve.getZdzName());//起始包括
  134 + }
129 135  
130 136 /**
131 137 *
... ...
src/main/java/com/bsth/data/schedule/signal/SchSiginUpdateDBThread.java
1   -package com.bsth.data.schedule.signal;
2   -
3   -import org.slf4j.Logger;
4   -import org.slf4j.LoggerFactory;
5   -import org.springframework.beans.factory.annotation.Autowired;
6   -import org.springframework.stereotype.Component;
7   -
8   -/**
9   - * Created by panzhao on 2017/8/14.
10   - */
11   -@Component
12   -public class SchSiginUpdateDBThread extends Thread{
13   -
14   - @Autowired
15   - SignalComplateHandler signalComplateHandler;
16   -
17   - Logger logger = LoggerFactory.getLogger(this.getClass());
18   -
19   - @Override
20   - public void run() {
21   - try{
22   - signalComplateHandler.handler();
23   - }catch (Exception e){
24   - logger.error("", e);
25   - }
26   - }
27   -}
  1 +package com.bsth.data.schedule.signal;
  2 +
  3 +import org.slf4j.Logger;
  4 +import org.slf4j.LoggerFactory;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.stereotype.Component;
  7 +
  8 +/**
  9 + * Created by panzhao on 2017/8/14.
  10 + */
  11 +@Component
  12 +public class SchSiginUpdateDBThread extends Thread{
  13 +
  14 + @Autowired
  15 + SignalComplateHandler signalComplateHandler;
  16 +
  17 + Logger logger = LoggerFactory.getLogger(this.getClass());
  18 +
  19 + @Override
  20 + public void run() {
  21 + try{
  22 + signalComplateHandler.handler();
  23 + }catch (Exception e){
  24 + logger.error("", e);
  25 + }
  26 + }
  27 +}
... ...
src/main/java/com/bsth/data/schedule/signal/SignalComplateHandler.java
1   -package com.bsth.data.schedule.signal;
2   -
3   -import com.bsth.data.schedule.DayOfSchedule;
4   -import com.bsth.data.schedule.signal.entity.SchSiginCompate;
5   -import com.bsth.entity.realcontrol.ScheduleRealInfo;
6   -import com.bsth.util.db.DBUtils_MS;
7   -import org.apache.commons.lang3.StringUtils;
8   -import org.slf4j.Logger;
9   -import org.slf4j.LoggerFactory;
10   -import org.springframework.beans.factory.annotation.Autowired;
11   -import org.springframework.jdbc.core.BatchPreparedStatementSetter;
12   -import org.springframework.jdbc.core.JdbcTemplate;
13   -import org.springframework.jdbc.datasource.DataSourceTransactionManager;
14   -import org.springframework.stereotype.Component;
15   -import org.springframework.transaction.TransactionDefinition;
16   -import org.springframework.transaction.TransactionStatus;
17   -import org.springframework.transaction.support.DefaultTransactionDefinition;
18   -
19   -import java.sql.PreparedStatement;
20   -import java.sql.SQLException;
21   -import java.util.ArrayList;
22   -import java.util.Collection;
23   -import java.util.Date;
24   -import java.util.List;
25   -
26   -/**
27   - * 班次信号补全(写入数据库,网关以补发的形式提交运管处)
28   - * Created by panzhao on 2017/8/13.
29   - */
30   -@Component
31   -public class SignalComplateHandler {
32   -
33   - @Autowired
34   - DayOfSchedule dayOfSchedule;
35   -
36   - Logger log = LoggerFactory.getLogger(this.getClass());
37   -
38   - public void handler(){
39   - Collection<ScheduleRealInfo> all = dayOfSchedule.findAll();
40   - List<SchSiginCompate> list = new ArrayList<>();
41   -
42   - SchSiginCompate siginCompate;
43   - Date d = new Date();
44   - long et = System.currentTimeMillis() - (1000 * 60 * 60 * 2),
45   - st = et - (1000 * 60 * 60 * 2);
46   - for(ScheduleRealInfo sch : all){
47   - if(sch.getDfsjT() > et || sch.getDfsjT() < st)
48   - continue;
49   -
50   - //能自动完成的
51   - if(sch.getSiginCompate() >= 2)
52   - continue;
53   -
54   - //烂班
55   - if(sch.isDestroy())
56   - continue;
57   -
58   - //空驶任务
59   - if(dayOfSchedule.emptyService(sch))
60   - continue;
61   -
62   - siginCompate = new SchSiginCompate(sch);
63   - if(siginCompate == null || StringUtils.isEmpty(siginCompate.getDeciveId()))
64   - continue;
65   -
66   - //标记已经补发
67   - sch.setSiginCompate(3);
68   - //标记入库
69   - dayOfSchedule.save(sch);
70   - siginCompate.setCreateDate(d);
71   - list.add(siginCompate);
72   - }
73   -
74   - put(list);
75   - }
76   -
77   - public void put(final List<SchSiginCompate> list){
78   - if(null == list || list.size() == 0)
79   - return;
80   -
81   - JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_MS.getDataSource());
82   - //编程式事务
83   - DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemp.getDataSource());
84   - DefaultTransactionDefinition def = new DefaultTransactionDefinition();
85   - def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
86   - TransactionStatus status = tran.getTransaction(def);
87   -
88   - try{
89   - jdbcTemp.batchUpdate("insert into bsth_t_sigin_complate(id, rq, line_code, decive_id, up_down, s_code, e_code, st, et, create_date, status) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", new BatchPreparedStatementSetter() {
90   - @Override
91   - public void setValues(PreparedStatement ps, int i) throws SQLException {
92   - SchSiginCompate sc = list.get(i);
93   - ps.setLong(1, sc.getId());
94   - ps.setString(2, sc.getRq());
95   - ps.setString(3, sc.getLineCode());
96   - ps.setString(4, sc.getDeciveId());
97   - ps.setInt(5, sc.getUpDown());
98   - ps.setString(6, sc.getsCode());
99   - ps.setString(7, sc.geteCode());
100   - ps.setLong(8, sc.getSt());
101   - ps.setLong(9, sc.getEt());
102   - ps.setDate(10, new java.sql.Date(sc.getCreateDate().getTime()));
103   - ps.setInt(11, sc.getStatus());
104   - }
105   -
106   - @Override
107   - public int getBatchSize() {
108   - return list.size();
109   - }
110   - });
111   -
112   - tran.commit(status);
113   - log.info("补信号班次入库," + list.size());
114   - }catch (Exception e){
115   - log.error("", e);
116   - tran.rollback(status);
117   - }
118   - }
119   -
120   -
121   -}
  1 +package com.bsth.data.schedule.signal;
  2 +
  3 +import com.bsth.data.schedule.DayOfSchedule;
  4 +import com.bsth.data.schedule.signal.entity.SchSiginCompate;
  5 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  6 +import com.bsth.util.db.DBUtils_MS;
  7 +import org.apache.commons.lang3.StringUtils;
  8 +import org.slf4j.Logger;
  9 +import org.slf4j.LoggerFactory;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.jdbc.core.BatchPreparedStatementSetter;
  12 +import org.springframework.jdbc.core.JdbcTemplate;
  13 +import org.springframework.jdbc.datasource.DataSourceTransactionManager;
  14 +import org.springframework.stereotype.Component;
  15 +import org.springframework.transaction.TransactionDefinition;
  16 +import org.springframework.transaction.TransactionStatus;
  17 +import org.springframework.transaction.support.DefaultTransactionDefinition;
  18 +
  19 +import java.sql.PreparedStatement;
  20 +import java.sql.SQLException;
  21 +import java.util.ArrayList;
  22 +import java.util.Collection;
  23 +import java.util.Date;
  24 +import java.util.List;
  25 +
  26 +/**
  27 + * 班次信号补全(写入数据库,网关以补发的形式提交运管处)
  28 + * Created by panzhao on 2017/8/13.
  29 + */
  30 +@Component
  31 +public class SignalComplateHandler {
  32 +
  33 + @Autowired
  34 + DayOfSchedule dayOfSchedule;
  35 +
  36 + Logger log = LoggerFactory.getLogger(this.getClass());
  37 +
  38 + public void handler(){
  39 + Collection<ScheduleRealInfo> all = dayOfSchedule.findAll();
  40 + List<SchSiginCompate> list = new ArrayList<>();
  41 +
  42 + SchSiginCompate siginCompate;
  43 + Date d = new Date();
  44 + long et = System.currentTimeMillis() - (1000 * 60 * 60 * 2),
  45 + st = et - (1000 * 60 * 60 * 2);
  46 + for(ScheduleRealInfo sch : all){
  47 + if(sch.getDfsjT() > et || sch.getDfsjT() < st)
  48 + continue;
  49 +
  50 + //能自动完成的
  51 + if(sch.getSiginCompate() >= 2)
  52 + continue;
  53 +
  54 + //烂班
  55 + if(sch.isDestroy())
  56 + continue;
  57 +
  58 + //空驶任务
  59 + if(dayOfSchedule.emptyService(sch))
  60 + continue;
  61 +
  62 + siginCompate = new SchSiginCompate(sch);
  63 + if(siginCompate == null || StringUtils.isEmpty(siginCompate.getDeciveId()))
  64 + continue;
  65 +
  66 + //标记已经补发
  67 + sch.setSiginCompate(3);
  68 + //标记入库
  69 + dayOfSchedule.save(sch);
  70 + siginCompate.setCreateDate(d);
  71 + list.add(siginCompate);
  72 + }
  73 +
  74 + put(list);
  75 + }
  76 +
  77 + public void put(final List<SchSiginCompate> list){
  78 + if(null == list || list.size() == 0)
  79 + return;
  80 +
  81 + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_MS.getDataSource());
  82 + //编程式事务
  83 + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemp.getDataSource());
  84 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
  85 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
  86 + TransactionStatus status = tran.getTransaction(def);
  87 +
  88 + try{
  89 + jdbcTemp.batchUpdate("insert into bsth_t_sigin_complate(id, rq, line_code, device_id, up_down, s_code, e_code, st, et, create_date, status) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", new BatchPreparedStatementSetter() {
  90 + @Override
  91 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  92 + SchSiginCompate sc = list.get(i);
  93 + ps.setLong(1, sc.getId());
  94 + ps.setString(2, sc.getRq());
  95 + ps.setString(3, sc.getLineCode());
  96 + ps.setString(4, sc.getDeciveId());
  97 + ps.setInt(5, sc.getUpDown());
  98 + ps.setString(6, sc.getsCode());
  99 + ps.setString(7, sc.geteCode());
  100 + ps.setLong(8, sc.getSt());
  101 + ps.setLong(9, sc.getEt());
  102 + ps.setDate(10, new java.sql.Date(sc.getCreateDate().getTime()));
  103 + ps.setInt(11, sc.getStatus());
  104 + }
  105 +
  106 + @Override
  107 + public int getBatchSize() {
  108 + return list.size();
  109 + }
  110 + });
  111 +
  112 + tran.commit(status);
  113 + log.info("补信号班次入库," + list.size());
  114 + }catch (Exception e){
  115 + log.error("", e);
  116 + tran.rollback(status);
  117 + }
  118 + }
  119 +
  120 +
  121 +}
... ...
src/main/java/com/bsth/data/schedule/signal/entity/SchSiginCompate.java
1   -package com.bsth.data.schedule.signal.entity;
2   -
3   -import com.bsth.data.BasicData;
4   -import com.bsth.entity.realcontrol.ScheduleRealInfo;
5   -
6   -import java.util.Date;
7   -
8   -/**
9   - * 班次信号补偿
10   - * Created by panzhao on 2017/8/13.
11   - */
12   -public class SchSiginCompate {
13   -
14   - /** 实际班次ID */
15   - private long id;
16   -
17   - /** 班次日期 */
18   - private String rq;
19   -
20   - /** 线路编码 */
21   - private String lineCode;
22   -
23   - /** 设备号 */
24   - private String deciveId;
25   -
26   - /** 上下行 */
27   - private int upDown;
28   -
29   - /** 起始站编码 */
30   - private String sCode;
31   -
32   - /** 终点站编码 */
33   - private String eCode;
34   -
35   - /** 开始时间戳 */
36   - private long st;
37   -
38   - /** 结束时间戳 */
39   - private long et;
40   -
41   - /** 入库时间 */
42   - private Date createDate;
43   -
44   - private int status = 0;
45   -
46   - public SchSiginCompate(ScheduleRealInfo sch) {
47   - this.id = sch.getId();
48   - this.rq = sch.getScheduleDateStr();
49   - this.lineCode = sch.getXlBm();
50   - this.upDown = Integer.parseInt(sch.getXlDir());
51   - this.deciveId = BasicData.deviceId2NbbmMap.inverse().get(sch.getClZbh());
52   - this.sCode = sch.getQdzCode();
53   - this.eCode = sch.getZdzCode();
54   - this.st = sch.getDfsjT();
55   - this.et = sch.getZdsjT();
56   -
57   - if(sch.getFcsjActualTime() != null)
58   - this.st = sch.getFcsjActualTime();
59   - if(sch.getZdsjActualTime() != null)
60   - this.et = sch.getZdsjActualTime();
61   - }
62   -
63   - public long getId() {
64   - return id;
65   - }
66   -
67   - public void setId(long id) {
68   - this.id = id;
69   - }
70   -
71   - public String getRq() {
72   - return rq;
73   - }
74   -
75   - public void setRq(String rq) {
76   - this.rq = rq;
77   - }
78   -
79   - public String getLineCode() {
80   - return lineCode;
81   - }
82   -
83   - public void setLineCode(String lineCode) {
84   - this.lineCode = lineCode;
85   - }
86   -
87   - public String getDeciveId() {
88   - return deciveId;
89   - }
90   -
91   - public void setDeciveId(String deciveId) {
92   - this.deciveId = deciveId;
93   - }
94   -
95   - public int getUpDown() {
96   - return upDown;
97   - }
98   -
99   - public void setUpDown(int upDown) {
100   - this.upDown = upDown;
101   - }
102   -
103   - public String getsCode() {
104   - return sCode;
105   - }
106   -
107   - public void setsCode(String sCode) {
108   - this.sCode = sCode;
109   - }
110   -
111   - public String geteCode() {
112   - return eCode;
113   - }
114   -
115   - public void seteCode(String eCode) {
116   - this.eCode = eCode;
117   - }
118   -
119   - public long getSt() {
120   - return st;
121   - }
122   -
123   - public void setSt(long st) {
124   - this.st = st;
125   - }
126   -
127   - public long getEt() {
128   - return et;
129   - }
130   -
131   - public void setEt(long et) {
132   - this.et = et;
133   - }
134   -
135   - public Date getCreateDate() {
136   - return createDate;
137   - }
138   -
139   - public void setCreateDate(Date createDate) {
140   - this.createDate = createDate;
141   - }
142   -
143   - public int getStatus() {
144   - return status;
145   - }
146   -
147   - public void setStatus(int status) {
148   - this.status = status;
149   - }
150   -}
  1 +package com.bsth.data.schedule.signal.entity;
  2 +
  3 +import com.bsth.data.BasicData;
  4 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  5 +
  6 +import java.util.Date;
  7 +
  8 +/**
  9 + * 班次信号补偿
  10 + * Created by panzhao on 2017/8/13.
  11 + */
  12 +public class SchSiginCompate {
  13 +
  14 + /** 实际班次ID */
  15 + private long id;
  16 +
  17 + /** 班次日期 */
  18 + private String rq;
  19 +
  20 + /** 线路编码 */
  21 + private String lineCode;
  22 +
  23 + /** 设备号 */
  24 + private String deciveId;
  25 +
  26 + /** 上下行 */
  27 + private int upDown;
  28 +
  29 + /** 起始站编码 */
  30 + private String sCode;
  31 +
  32 + /** 终点站编码 */
  33 + private String eCode;
  34 +
  35 + /** 开始时间戳 */
  36 + private long st;
  37 +
  38 + /** 结束时间戳 */
  39 + private long et;
  40 +
  41 + /** 入库时间 */
  42 + private Date createDate;
  43 +
  44 + private int status = 0;
  45 +
  46 + public SchSiginCompate(ScheduleRealInfo sch) {
  47 + this.id = sch.getId();
  48 + this.rq = sch.getScheduleDateStr();
  49 + this.lineCode = sch.getXlBm();
  50 + this.upDown = Integer.parseInt(sch.getXlDir());
  51 + this.deciveId = BasicData.deviceId2NbbmMap.inverse().get(sch.getClZbh());
  52 + this.sCode = sch.getQdzCode();
  53 + this.eCode = sch.getZdzCode();
  54 + this.st = sch.getDfsjT();
  55 + this.et = sch.getZdsjT();
  56 +
  57 + if(sch.getFcsjActualTime() != null)
  58 + this.st = sch.getFcsjActualTime();
  59 + if(sch.getZdsjActualTime() != null)
  60 + this.et = sch.getZdsjActualTime();
  61 + }
  62 +
  63 + public long getId() {
  64 + return id;
  65 + }
  66 +
  67 + public void setId(long id) {
  68 + this.id = id;
  69 + }
  70 +
  71 + public String getRq() {
  72 + return rq;
  73 + }
  74 +
  75 + public void setRq(String rq) {
  76 + this.rq = rq;
  77 + }
  78 +
  79 + public String getLineCode() {
  80 + return lineCode;
  81 + }
  82 +
  83 + public void setLineCode(String lineCode) {
  84 + this.lineCode = lineCode;
  85 + }
  86 +
  87 + public String getDeciveId() {
  88 + return deciveId;
  89 + }
  90 +
  91 + public void setDeciveId(String deciveId) {
  92 + this.deciveId = deciveId;
  93 + }
  94 +
  95 + public int getUpDown() {
  96 + return upDown;
  97 + }
  98 +
  99 + public void setUpDown(int upDown) {
  100 + this.upDown = upDown;
  101 + }
  102 +
  103 + public String getsCode() {
  104 + return sCode;
  105 + }
  106 +
  107 + public void setsCode(String sCode) {
  108 + this.sCode = sCode;
  109 + }
  110 +
  111 + public String geteCode() {
  112 + return eCode;
  113 + }
  114 +
  115 + public void seteCode(String eCode) {
  116 + this.eCode = eCode;
  117 + }
  118 +
  119 + public long getSt() {
  120 + return st;
  121 + }
  122 +
  123 + public void setSt(long st) {
  124 + this.st = st;
  125 + }
  126 +
  127 + public long getEt() {
  128 + return et;
  129 + }
  130 +
  131 + public void setEt(long et) {
  132 + this.et = et;
  133 + }
  134 +
  135 + public Date getCreateDate() {
  136 + return createDate;
  137 + }
  138 +
  139 + public void setCreateDate(Date createDate) {
  140 + this.createDate = createDate;
  141 + }
  142 +
  143 + public int getStatus() {
  144 + return status;
  145 + }
  146 +
  147 + public void setStatus(int status) {
  148 + this.status = status;
  149 + }
  150 +}
... ...
src/main/java/com/bsth/entity/excep/ArrivalInfo.java
... ... @@ -61,11 +61,12 @@ public class ArrivalInfo {
61 61 private String jzsj;
62 62 /** -1 则信号有效,但程序标记为不使用 */
63 63 private int flag = 0;
64   -
  64 + private Date dates;
  65 + private int route;
65 66 public ArrivalInfo(){}
66 67  
67 68 public ArrivalInfo(String deviceId, long ts, String lineCode, int upDown, String stopNo, int inOut, long createDate,
68   - int weeksYear, String stopName) {
  69 + int weeksYear, String stopName,Date dates,int route) {
69 70  
70 71 this.deviceId = deviceId;
71 72 this.ts = ts;
... ... @@ -75,6 +76,8 @@ public class ArrivalInfo {
75 76 this.stopName = stopName;
76 77 this.inOut = inOut;
77 78 this.createDate = createDate;
  79 + this.dates=dates;
  80 + this.route=route;
78 81 }
79 82  
80 83 /* @Override
... ... @@ -253,6 +256,22 @@ public class ArrivalInfo {
253 256 public void setPzh(String pzh) {
254 257 this.pzh = pzh;
255 258 }
  259 +
  260 + public Date getDates() {
  261 + return dates;
  262 + }
  263 +
  264 + public void setDates(Date dates) {
  265 + this.dates = dates;
  266 + }
  267 +
  268 + public int getRoute() {
  269 + return route;
  270 + }
  271 +
  272 + public void setRoute(int route) {
  273 + this.route = route;
  274 + }
256 275  
257 276  
258 277  
... ...
src/main/java/com/bsth/entity/report/MileageReport.java 0 → 100644
  1 +package com.bsth.entity.report;
  2 +
  3 +import java.util.Date;
  4 +
  5 +/**
  6 + * @ClassName: MileageReport.java
  7 + * @Description: TODO(营运里程修正报表)
  8 + * @author: YouRuiFeng
  9 + * @date: 2017-8-14 上午11:09:19
  10 + *
  11 + */
  12 +public class MileageReport {
  13 + /** 公司编码 */
  14 + private String companyId;
  15 +
  16 + /** 分公司编码 */
  17 + private String subCompanyId;
  18 +
  19 + /** 公司名称 */
  20 + private String companyName;
  21 +
  22 + /** 分公司名称 */
  23 + private String subCompanyName;
  24 +
  25 + /** 线路编码 */
  26 + private String lineCode;
  27 +
  28 + /** 线路名称 */
  29 + private String lineName;
  30 +
  31 + /** 总营运公里 */
  32 + private double zgl;
  33 +
  34 + /** 实际运营公里 */
  35 + private double sjyygl;
  36 +
  37 + /** 实际空驶公里 */
  38 + private double sjksgl;
  39 +
  40 + /** 手动待发公里 */
  41 + private double sddfgl;
  42 +
  43 + /** 自动代发公里 */
  44 + private double zddfgl;
  45 +
  46 + /** 完全无Gps信号公里 */
  47 + private double wqwxhgl;
  48 +
  49 + /** 部分无Gps公里 */
  50 + private double bfwxhgl;
  51 +
  52 + /** 漂移公里 */
  53 + private double pygl;
  54 +
  55 + /** 临加公里 */
  56 + private double ljgl;
  57 +
  58 + /** 子任务 */
  59 + private double zrwgl;
  60 +
  61 + /** 其他*/
  62 + private String other;
  63 +
  64 + /** 备注 */
  65 + private String remarks;
  66 +
  67 + /** 日期 (班次日期) */
  68 + private String rq;
  69 +
  70 + private Date createDate;
  71 +
  72 +
  73 + public String getCompanyId() {
  74 + return companyId;
  75 + }
  76 +
  77 + public void setCompanyId(String companyId) {
  78 + this.companyId = companyId;
  79 + }
  80 +
  81 + public String getSubCompanyId() {
  82 + return subCompanyId;
  83 + }
  84 +
  85 + public void setSubCompanyId(String subCompanyId) {
  86 + this.subCompanyId = subCompanyId;
  87 + }
  88 +
  89 + public String getCompanyName() {
  90 + return companyName;
  91 + }
  92 +
  93 + public void setCompanyName(String companyName) {
  94 + this.companyName = companyName;
  95 + }
  96 +
  97 + public String getSubCompanyName() {
  98 + return subCompanyName;
  99 + }
  100 +
  101 + public void setSubCompanyName(String subCompanyName) {
  102 + this.subCompanyName = subCompanyName;
  103 + }
  104 +
  105 + public String getLineCode() {
  106 + return lineCode;
  107 + }
  108 +
  109 + public void setLineCode(String lineCode) {
  110 + this.lineCode = lineCode;
  111 + }
  112 +
  113 + public String getLineName() {
  114 + return lineName;
  115 + }
  116 +
  117 + public void setLineName(String lineName) {
  118 + this.lineName = lineName;
  119 + }
  120 +
  121 + public double getZgl() {
  122 + return zgl;
  123 + }
  124 +
  125 + public void setZgl(double zgl) {
  126 + this.zgl = zgl;
  127 + }
  128 +
  129 + public double getSjyygl() {
  130 + return sjyygl;
  131 + }
  132 +
  133 + public void setSjyygl(double sjyygl) {
  134 + this.sjyygl = sjyygl;
  135 + }
  136 +
  137 + public double getSjksgl() {
  138 + return sjksgl;
  139 + }
  140 +
  141 + public void setSjksgl(double sjksgl) {
  142 + this.sjksgl = sjksgl;
  143 + }
  144 +
  145 + public double getSddfgl() {
  146 + return sddfgl;
  147 + }
  148 +
  149 + public void setSddfgl(double sddfgl) {
  150 + this.sddfgl = sddfgl;
  151 + }
  152 +
  153 + public double getZddfgl() {
  154 + return zddfgl;
  155 + }
  156 +
  157 + public void setZddfgl(double zddfgl) {
  158 + this.zddfgl = zddfgl;
  159 + }
  160 +
  161 + public double getWqwxhgl() {
  162 + return wqwxhgl;
  163 + }
  164 +
  165 + public void setWqwxhgl(double wqwxhgl) {
  166 + this.wqwxhgl = wqwxhgl;
  167 + }
  168 +
  169 + public double getBfwxhgl() {
  170 + return bfwxhgl;
  171 + }
  172 +
  173 + public void setBfwxhgl(double bfwxhgl) {
  174 + this.bfwxhgl = bfwxhgl;
  175 + }
  176 +
  177 + public double getPygl() {
  178 + return pygl;
  179 + }
  180 +
  181 + public void setPygl(double pygl) {
  182 + this.pygl = pygl;
  183 + }
  184 +
  185 + public double getLjgl() {
  186 + return ljgl;
  187 + }
  188 +
  189 + public void setLjgl(double ljgl) {
  190 + this.ljgl = ljgl;
  191 + }
  192 +
  193 + public double getZrwgl() {
  194 + return zrwgl;
  195 + }
  196 +
  197 + public void setZrwgl(double zrwgl) {
  198 + this.zrwgl = zrwgl;
  199 + }
  200 +
  201 + public String getOther() {
  202 + return other;
  203 + }
  204 +
  205 + public void setOther(String other) {
  206 + this.other = other;
  207 + }
  208 +
  209 + public String getRemarks() {
  210 + return remarks;
  211 + }
  212 +
  213 + public void setRemarks(String remarks) {
  214 + this.remarks = remarks;
  215 + }
  216 +
  217 + public String getRq() {
  218 + return rq;
  219 + }
  220 +
  221 + public void setRq(String rq) {
  222 + this.rq = rq;
  223 + }
  224 +
  225 + public Date getCreateDate() {
  226 + return createDate;
  227 + }
  228 +
  229 + public void setCreateDate(Date createDate) {
  230 + this.createDate = createDate;
  231 + }
  232 +
  233 +
  234 +}
... ...
src/main/java/com/bsth/entity/report/ScheduleCorrectionReport.java 0 → 100644
  1 +package com.bsth.entity.report;
  2 +
  3 +import java.util.Date;
  4 +
  5 +/**
  6 + * @ClassName: MileageReport.java
  7 + * @Description: TODO(营运里程修正报表)
  8 + * @author: YouRuiFeng
  9 + * @date: 2017-8-14 上午11:09:19
  10 + *
  11 + */
  12 +public class ScheduleCorrectionReport {
  13 + /** 公司编码 */
  14 + private String companyId;
  15 +
  16 + /** 分公司编码 */
  17 + private String subCompanyId;
  18 +
  19 + /** 公司名称 */
  20 + private String companyName;
  21 +
  22 + /** 分公司名称 */
  23 + private String subCompanyName;
  24 +
  25 + /** 线路编码 */
  26 + private String lineCode;
  27 +
  28 + /** 线路名称 */
  29 + private String lineName;
  30 +
  31 + /** 总营运班次 */
  32 + private int zbc;
  33 +
  34 + /** 实际运营班次 */
  35 + private int sjyybc;
  36 +
  37 + /** 实际空驶班次 */
  38 + private int sjksbc;
  39 +
  40 + /** 手动待发班次 */
  41 + private int sddfbc;
  42 +
  43 + /** 自动代发班次 */
  44 + private int zddfbc;
  45 +
  46 + /** 完全无Gps信号班次 */
  47 + private int wqwxhbc;
  48 +
  49 + /** 部分无Gps班次 */
  50 + private int bfwxhbc;
  51 +
  52 + /** 漂移班次 */
  53 + private int pybc;
  54 +
  55 + /** 临加班次 */
  56 + private int ljbc;
  57 +
  58 + /** 子任务 */
  59 + private int zrwbc;
  60 +
  61 + /** 其他*/
  62 + private String other;
  63 +
  64 + /** 备注 */
  65 + private String remarks;
  66 +
  67 + /** 日期 (班次日期) */
  68 + private String rq;
  69 +
  70 + private Date createDate;
  71 +
  72 + public String getCompanyId() {
  73 + return companyId;
  74 + }
  75 +
  76 + public void setCompanyId(String companyId) {
  77 + this.companyId = companyId;
  78 + }
  79 +
  80 + public String getSubCompanyId() {
  81 + return subCompanyId;
  82 + }
  83 +
  84 + public void setSubCompanyId(String subCompanyId) {
  85 + this.subCompanyId = subCompanyId;
  86 + }
  87 +
  88 + public String getCompanyName() {
  89 + return companyName;
  90 + }
  91 +
  92 + public void setCompanyName(String companyName) {
  93 + this.companyName = companyName;
  94 + }
  95 +
  96 + public String getSubCompanyName() {
  97 + return subCompanyName;
  98 + }
  99 +
  100 + public void setSubCompanyName(String subCompanyName) {
  101 + this.subCompanyName = subCompanyName;
  102 + }
  103 +
  104 + public String getLineCode() {
  105 + return lineCode;
  106 + }
  107 +
  108 + public void setLineCode(String lineCode) {
  109 + this.lineCode = lineCode;
  110 + }
  111 +
  112 + public String getLineName() {
  113 + return lineName;
  114 + }
  115 +
  116 + public void setLineName(String lineName) {
  117 + this.lineName = lineName;
  118 + }
  119 +
  120 + public int getZbc() {
  121 + return zbc;
  122 + }
  123 +
  124 + public void setZbc(int zbc) {
  125 + this.zbc = zbc;
  126 + }
  127 +
  128 + public int getSjyybc() {
  129 + return sjyybc;
  130 + }
  131 +
  132 + public void setSjyybc(int sjyybc) {
  133 + this.sjyybc = sjyybc;
  134 + }
  135 +
  136 + public int getSjksbc() {
  137 + return sjksbc;
  138 + }
  139 +
  140 + public void setSjksbc(int sjksbc) {
  141 + this.sjksbc = sjksbc;
  142 + }
  143 +
  144 + public int getSddfbc() {
  145 + return sddfbc;
  146 + }
  147 +
  148 + public void setSddfbc(int sddfbc) {
  149 + this.sddfbc = sddfbc;
  150 + }
  151 +
  152 + public int getZddfbc() {
  153 + return zddfbc;
  154 + }
  155 +
  156 + public void setZddfbc(int zddfbc) {
  157 + this.zddfbc = zddfbc;
  158 + }
  159 +
  160 + public int getWqwxhbc() {
  161 + return wqwxhbc;
  162 + }
  163 +
  164 + public void setWqwxhbc(int wqwxhbc) {
  165 + this.wqwxhbc = wqwxhbc;
  166 + }
  167 +
  168 + public int getBfwxhbc() {
  169 + return bfwxhbc;
  170 + }
  171 +
  172 + public void setBfwxhbc(int bfwxhbc) {
  173 + this.bfwxhbc = bfwxhbc;
  174 + }
  175 +
  176 + public int getPybc() {
  177 + return pybc;
  178 + }
  179 +
  180 + public void setPybc(int pybc) {
  181 + this.pybc = pybc;
  182 + }
  183 +
  184 + public int getLjbc() {
  185 + return ljbc;
  186 + }
  187 +
  188 + public void setLjbc(int ljbc) {
  189 + this.ljbc = ljbc;
  190 + }
  191 +
  192 + public int getZrwbc() {
  193 + return zrwbc;
  194 + }
  195 +
  196 + public void setZrwbc(int zrwbc) {
  197 + this.zrwbc = zrwbc;
  198 + }
  199 +
  200 + public String getOther() {
  201 + return other;
  202 + }
  203 +
  204 + public void setOther(String other) {
  205 + this.other = other;
  206 + }
  207 +
  208 + public String getRemarks() {
  209 + return remarks;
  210 + }
  211 +
  212 + public void setRemarks(String remarks) {
  213 + this.remarks = remarks;
  214 + }
  215 +
  216 + public String getRq() {
  217 + return rq;
  218 + }
  219 +
  220 + public void setRq(String rq) {
  221 + this.rq = rq;
  222 + }
  223 +
  224 + public Date getCreateDate() {
  225 + return createDate;
  226 + }
  227 +
  228 + public void setCreateDate(Date createDate) {
  229 + this.createDate = createDate;
  230 + }
  231 +
  232 +}
... ...
src/main/java/com/bsth/repository/oil/DlbRepository.java
... ... @@ -53,7 +53,7 @@ public interface DlbRepository extends BaseRepository&lt;Dlb, Integer&gt;{
53 53 + " ssgsdm like %?2% "
54 54 + " and fgsdm like %?3%"
55 55 + " and xlbm like %?4% and nbbm like %?5% "
56   - + " group by nbbm,rq,ssgsdm,fgsdm,xlbm",nativeQuery=true)
  56 + + " group by nbbm,rq,ssgsdm,fgsdm",nativeQuery=true)
57 57 List<Object[]> checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm);
58 58  
59 59 @Query(value="select nbbm,sum(cdl*100) as cdl ,sum(zlc*100) as zlc from bsth_c_dlb where to_days(?1)=to_days(rq) and "
... ...
src/main/java/com/bsth/repository/oil/JdlRepository.java
... ... @@ -17,25 +17,25 @@ public interface JdlRepository extends BaseRepository&lt;Jdl, Integer&gt;{
17 17 @Transactional
18 18 @Modifying
19 19 @Query(value="INSERT INTO bsth_c_jdl("+
20   - "gs_bm, gs_name, fgs_bm, fgs_name, rq, nbbm, jdl, jdz, remarks, creater_date,jsy)" +
  20 + "gs_bm, gs_name, fgs_bm, fgs_name, rq, nbbm, jdl, jdz, remarks, creater_date)" +
21 21 " VALUES(" +
22   - "?1,?2,?3,?4,str_to_date(?5,'%Y-%m-%d'),?6,?7,?8,?9,str_to_date(?10,'%Y-%m-%d %H:%i:%s'),?11)", nativeQuery=true)
23   - void insertData(String gsbm, String gsName, String fgsbm, String fgsName, String rq, String nbbm, String jdl, String jdz, String remarks, String createrDate,String jsy);
  22 + "?1,?2,?3,?4,str_to_date(?5,'%Y-%m-%d'),?6,?7,?8,?9,str_to_date(?10,'%Y-%m-%d %H:%i:%s'))", nativeQuery=true)
  23 + void insertData(String gsbm, String gsName, String fgsbm, String fgsName, String rq, String nbbm, String jdl, String jdz, String remarks, String createrDate);
24 24  
25   - @Query(value="SELECT * FROM bsth_c_jdl where gs_bm = ?1 and fgs_bm = ?2 and rq = ?3 and nbbm like %?4% and jsy like %?5%" ,nativeQuery=true)
26   - List<Jdl> query(String gsbm, String fgsbm, String rq, String nbbm,String jsy);
  25 + @Query(value="SELECT * FROM bsth_c_jdl where gs_bm = ?1 and fgs_bm = ?2 and rq = ?3 and nbbm like %?4% " ,nativeQuery=true)
  26 + List<Jdl> query(String gsbm, String fgsbm, String rq, String nbbm);
27 27  
28 28  
29 29 @Query(value="SELECT * FROM bsth_c_jdl where rq = ?",nativeQuery=true)
30 30 List<Jdl> JdlList( String rq);
31 31  
32   - @Query(value="SELECT jdl FROM bsth_c_jdl where gs_bm = ?1 and fgs_bm = ?2 and rq = ?3 and nbbm = ?4 and jsy = ?5 ",nativeQuery=true)
33   - List<Double> queryBySame(String gsbm, String fgsbm, String rq, String nbbm, String jsy);
  32 + @Query(value="SELECT jdl FROM bsth_c_jdl where gs_bm = ?1 and fgs_bm = ?2 and rq = ?3 and nbbm = ?4 ",nativeQuery=true)
  33 + List<Double> queryBySame(String gsbm, String fgsbm, String rq, String nbbm);
34 34  
35 35  
36 36 @Transactional
37 37 @Modifying
38   - @Query(value="UPDATE bsth_c_jdl set jdl = ?1 where gs_bm = ?2 and fgs_bm = ?3 and rq = ?4 and nbbm = ?5 and jsy = ?6",nativeQuery=true)
39   - void UpdateJdl(String jdl, String gsbm, String fgsbm, String rq, String nbbm, String jsy);
  38 + @Query(value="UPDATE bsth_c_jdl set jdl = ?1 where gs_bm = ?2 and fgs_bm = ?3 and rq = ?4 and nbbm = ?5",nativeQuery=true)
  39 + void UpdateJdl(String jdl, String gsbm, String fgsbm, String rq, String nbbm);
40 40  
41 41 }
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -139,19 +139,19 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
139 139  
140 140 //去掉了 xlBm is not null
141 141 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
142   - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.xlDir,s.realExecDate,s.dfsj, (s.lpName+1)")
  142 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.xlDir,s.realExecDate,s.fcsj, lpName")
143 143 List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date);
144 144  
145 145 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
146   - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm =?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by (s.lpName+1), s.realExecDate,s.dfsj")
  146 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm =?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.lpName, s.realExecDate,s.fcsj")
147 147 List<ScheduleRealInfo> scheduleByDateAndLineQp(String line,String date);
148 148  
149 149 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
150   - @Query(value="select DISTINCT s from ScheduleRealInfo s where gsBm like %?1% and fgsBm like %?2% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?3 and s.bcType not in ('in','out','ldks') order by s.xlDir,s.realExecDate,s.dfsj, (s.lpName+1)")
  150 + @Query(value="select DISTINCT s from ScheduleRealInfo s where gsBm like %?1% and fgsBm like %?2% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?3 and s.bcType not in ('in','out','ldks') order by s.xlDir,s.realExecDate,s.fcsj, s.lpName")
151 151 List<ScheduleRealInfo> scheduleByDateAndLineByGs(String gsdm,String fgsdm,String date);
152 152  
153 153 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
154   - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.xlDir,s.realExecDate,s.dfsj, (s.lpName+1)")
  154 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.xlDir,s.realExecDate,s.fcsj, s.lpName")
155 155 List<ScheduleRealInfo> scheduleByDateAndLineQp2(String line,String date);
156 156  
157 157 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
... ...
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
... ... @@ -141,7 +141,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
141 141 long dfsj = Long.valueOf(split0[0]) * 60 + Long.valueOf(split0[1]);
142 142 if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate())&&dfsj<23*60)
143 143 dfsj += 1440l;
144   - schedule.setDfsj(dfsj/60 + ":" + dfsj%60);
  144 + schedule.setDfsj((dfsj/60>9?"":"0")+dfsj/60+ ":" +(dfsj%60>9?"":"0")+dfsj%60);
145 145 schedule.setDfsjT(dfsj);
146 146 }
147 147 if(schedule.getFcsjActual() != null){
... ... @@ -149,7 +149,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
149 149 long fcsjA = Long.valueOf(split2[0]) * 60 + Long.valueOf(split2[1]);
150 150 if(!schedule.getScheduleDateStr().equals(schedule.getRealExecDate())&&fcsjA<23*60)
151 151 fcsjA += 1440l;
152   - schedule.setFcsjActual(fcsjA/60 + ":" + fcsjA%60);
  152 + schedule.setFcsjActual((fcsjA/60>9?"":"0")+fcsjA/60+ ":" +(fcsjA%60>9?"":"0")+fcsjA%60);
153 153 schedule.setFcsjActualTime(fcsjA);
154 154 }
155 155 if(schedule.getZdsjActual() != null){
... ... @@ -159,11 +159,11 @@ public class BusIntervalServiceImpl implements BusIntervalService {
159 159 zdsjA += 1440l;
160 160 if(schedule.getFcsjActualTime() != null && zdsjA < schedule.getFcsjActualTime())
161 161 zdsjA += 1440l;
162   - schedule.setZdsjActual(zdsjA/60 + ":" + zdsjA%60);
  162 + schedule.setZdsjActual((zdsjA/60>9?"":"0")+zdsjA/60+ ":" +(zdsjA%60>9?"":"0")+zdsjA%60);
163 163 schedule.setZdsjActualTime(zdsjA);
164 164 }
165   - schedule.setFcsj((fcsj/60<10?"0"+fcsj/60:fcsj/60) + ":" + (fcsj%60<10?"0"+fcsj%60:fcsj%60));
166   - schedule.setZdsj((zdsj/60<10?"0"+zdsj/60:zdsj/60) + ":" + (zdsj%60<10?"0"+zdsj%60:zdsj%60));
  165 + schedule.setFcsj((fcsj/60<10?"0"+fcsj/60:fcsj/60)+ ":" +(fcsj%60<10?"0"+fcsj%60:fcsj%60));
  166 + schedule.setZdsj((zdsj/60<10?"0"+zdsj/60:zdsj/60)+ ":" +(zdsj%60<10?"0"+zdsj%60:zdsj%60));
167 167 schedule.setFcsjT(fcsj);
168 168 schedule.setZdsjT(zdsj);
169 169 return schedule;
... ... @@ -673,9 +673,10 @@ public class BusIntervalServiceImpl implements BusIntervalService {
673 673 if(sfqr == 1){
674 674 where += " and zdsj >= '"+times1+"' and fcsj <= '"+times2+"'";
675 675 }
676   - where += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'";
  676 +// where += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'";
  677 + where += " and bc_type != 'ldks'";
677 678  
678   - String sql = "select id, schedule_date_Str, real_exec_date, xl_name, lp_name, bcs, bcsj, jhlc,"
  679 + String sql = "select id, schedule_date_Str, real_exec_date, xl_name, lp_name, bcs, bcsj, jhlc, bc_type,"
679 680 + " fcsj, fcsj_actual, zdsj, zdsj_actual, qdz_name, zdz_name, xl_dir, status, remarks, gs_name, fgs_name, sp_id"
680 681 + " from bsth_c_s_sp_info_real where DATE_FORMAT(schedule_date,'%Y-%m-%d') >= '"+startDate+"'"
681 682 + " and DATE_FORMAT(schedule_date,'%Y-%m-%d') <= '"+endDate+"'"+where+"";
... ... @@ -699,6 +700,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
699 700 schedule.setZdsjActual(rs.getString("zdsj_actual"));
700 701 schedule.setQdzName(rs.getString("qdz_name"));
701 702 schedule.setZdzName(rs.getString("zdz_name"));
  703 + schedule.setBcType(rs.getString("bc_type"));
702 704 schedule.setXlDir(rs.getString("xl_dir"));
703 705 schedule.setStatus(rs.getInt("status"));
704 706 schedule.setRemarks(rs.getString("remarks"));
... ... @@ -832,7 +834,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
832 834 if(model.length() != 0){
833 835 sql = "select sp.id from "
834 836 + "(select id, tt_info, xl_bm, lp, fcsj from bsth_c_s_sp_info where schedule_date >= '"+startDate+"' and schedule_date <= '"+endDate+"'"
835   - + " and tt_info = '" + model + "' and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks') sp"
  837 + + " and tt_info = '" + model + "' and bc_type != 'ldks') sp"
836 838 + " left join bsth_c_s_ttinfo_detail tt on sp.tt_info = tt.ttinfo and sp.xl_bm = tt.xl and sp.lp = tt.lp and sp.fcsj = tt.fcsj";
837 839  
838 840 ttList = jdbcTemplate.query(sql,
... ... @@ -915,6 +917,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
915 917 for(String key : keyMap.keySet()){
916 918 Map<String, Object> tempMap = new HashMap<String, Object>();
917 919 Map<Long, ScheduleRealInfo> sortMap = new HashMap<Long, ScheduleRealInfo>();
  920 + Map<Long, Map<String, Object>> sortMap1 = new HashMap<Long, Map<String, Object>>();
918 921 List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
919 922 List<Long> keyList = new ArrayList<Long>();
920 923 List<Long> keyList2 = new ArrayList<Long>();
... ... @@ -946,30 +949,25 @@ public class BusIntervalServiceImpl implements BusIntervalService {
946 949 for(int i = 1; i < keyList.size(); i++){
947 950 ScheduleRealInfo schedule1 = sortMap.get(keyList.get(i - 1));
948 951 ScheduleRealInfo schedule2 = sortMap.get(keyList.get(i));
949   - if(!tsSet.contains(schedule1.getId())){
950   - if(sfqr == 1 && time1 > schedule1.getFcsjT()){
951   - jhyysj += schedule2.getFcsjT() - time1;
952   - }else if(sfqr == 1 && time2 < schedule2.getFcsjT()){
953   - jhyysj += time2 - schedule1.getFcsjT();
  952 + if(!tsSet.contains(schedule1.getId()) && !schedule1.getBcType().toString().equals("in") && !schedule1.getBcType().toString().equals("out")){
  953 + long fcsj1 = schedule1.getFcsjT();
  954 + long fcsj2 = schedule2.getFcsjT();
  955 + if(tsSet.contains(schedule2.getId()) || schedule2.getBcType().toString().equals("in") || schedule2.getBcType().toString().equals("out")){
  956 + fcsj2 = schedule1.getZdsjT();
  957 + }
  958 + if(sfqr == 1 && time1 > fcsj1){
  959 + jhyysj += fcsj2 - time1;
  960 + }else if(sfqr == 1 && time2 < fcsj2){
  961 + jhyysj += time2 - fcsj1;
954 962 }else{
955   - jhyysj += schedule2.getFcsjT() - schedule1.getFcsjT();
  963 + jhyysj += fcsj2 - fcsj1;
956 964 }
957   - jhyysj1 += schedule2.getFcsjT() - schedule1.getFcsjT();
958   - }
959   - long zdsj2 = schedule2.getZdsjT();
960   - long fcsj2 = schedule2.getFcsjT();
961   - if(fcsj2 > zdsj2)
962   - zdsj2 += 1440l;
963   - if(sfqr == 1 && time1 > fcsj2){
964   - jhyssj += zdsj2 - time1;
965   - }else if(sfqr == 1 && time2 < zdsj2){
966   - jhyssj += time2 - fcsj2;
967   - }else{
968   - jhyssj += zdsj2 - fcsj2;
  965 + if(jhyysj < 0){
  966 + System.out.println(fcsj2 + " - " + fcsj1);
  967 + }
  968 + jhyysj1 += fcsj2 - fcsj1;
969 969 }
970   - jhyssj1 += zdsj2 - fcsj2;
971   - jhlc += schedule2.getJhlc()==null?0:schedule2.getJhlc();
972   - if(i == 1){
  970 + if(i == 1 && schedule1.getBcType().toString().equals("normal")){
973 971 long zdsj1 = schedule1.getZdsjT();
974 972 long fcsj1 = schedule1.getFcsjT();
975 973 if(fcsj1 > zdsj1)
... ... @@ -984,12 +982,27 @@ public class BusIntervalServiceImpl implements BusIntervalService {
984 982 jhyssj1 += zdsj1 - fcsj1;
985 983 jhlc += schedule1.getJhlc()==null?0:schedule1.getJhlc();
986 984 }
  985 + if(schedule2.getBcType().toString().equals("normal")){
  986 + long zdsj2 = schedule2.getZdsjT();
  987 + long fcsj2 = schedule2.getFcsjT();
  988 + if(fcsj2 > zdsj2)
  989 + zdsj2 += 1440l;
  990 + if(sfqr == 1 && time1 > fcsj2){
  991 + jhyssj += zdsj2 - time1;
  992 + }else if(sfqr == 1 && time2 < zdsj2){
  993 + jhyssj += time2 - fcsj2;
  994 + }else{
  995 + jhyssj += zdsj2 - fcsj2;
  996 + }
  997 + jhyssj1 += zdsj2 - fcsj2;
  998 + jhlc += schedule2.getJhlc()==null?0:schedule2.getJhlc();
  999 + }
987 1000 }
988 1001  
989 1002 for(int i = 0; i < keyList.size(); i++){
990 1003 Map<String, Object> m = new HashMap<String, Object>();
991 1004 ScheduleRealInfo schedule = sortMap.get(keyList.get(i));
992   -
  1005 +
993 1006 if(cMap.containsKey(schedule.getId())){
994 1007 List<ChildTaskPlan> cTasks = cMap.get(schedule.getId());
995 1008 for(ChildTaskPlan childTaskPlan : cTasks){
... ... @@ -1012,6 +1025,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1012 1025 temp.put("fcsj", null);
1013 1026 }
1014 1027 }
  1028 + temp.put("bcType", schedule.getBcType());
1015 1029 mapList.add(temp);
1016 1030 }
1017 1031 }else{
... ... @@ -1029,6 +1043,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1029 1043 m.put("zdsj", null);
1030 1044 m.put("fcsj", null);
1031 1045 }
  1046 + m.put("bcType", schedule.getBcType());
1032 1047 mapList.add(m);
1033 1048 }
1034 1049 }
... ... @@ -1036,6 +1051,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1036 1051 for(Map<String, Object> m : mapList){
1037 1052 if(m.get("fcsj") != null && m.get("fcsj").toString().trim().length()!=0){
1038 1053 keyList2.add(Long.valueOf(m.get("fcsj").toString()));
  1054 + sortMap1.put(Long.valueOf(m.get("fcsj").toString()), m);
1039 1055 }
1040 1056 }
1041 1057 Collections.sort(keyList2);
... ... @@ -1043,36 +1059,31 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1043 1059 for(int i = 1; i < keyList2.size(); i++){
1044 1060 long fcsj1 = keyList2.get(i - 1);
1045 1061 long fcsj2 = keyList2.get(i);
1046   - if(fcsj2 - fcsj1 < 90){
1047   - if(sfqr == 1 && time1 > fcsj1){
1048   - sjyysj += fcsj2 - time1;
1049   - }else if(sfqr == 1 && time2 < fcsj2){
1050   - sjyysj += time2 - fcsj1;
1051   - }else{
1052   - sjyysj += fcsj2 - fcsj1;
1053   - }
1054   - sjyysj1 += fcsj2 - fcsj1;
  1062 + Map<String, Object> m1 = sortMap1.get(fcsj1);
  1063 + Map<String, Object> m2 = sortMap1.get(fcsj2);
  1064 + if(m1.get("bcType").toString().equals("in") || m1.get("bcType").toString().equals("out"))
  1065 + continue;
  1066 + if(m2.get("bcType").toString().equals("in") || m2.get("bcType").toString().equals("out")){
  1067 + fcsj2 = Long.valueOf(m1.get("zdsj").toString());
  1068 + } else if(i == keyList.size() - 1){
  1069 + fcsj2 = Long.valueOf(m2.get("zdsj").toString());
  1070 + }
  1071 + if(sfqr == 1 && time1 > fcsj1){
  1072 + sjyysj += fcsj2 - time1;
  1073 + }else if(sfqr == 1 && time2 < fcsj2){
  1074 + sjyysj += time2 - fcsj1;
  1075 + }else{
  1076 + sjyysj += fcsj2 - fcsj1;
1055 1077 }
  1078 + sjyysj1 += fcsj2 - fcsj1;
1056 1079 }
1057 1080  
1058   - for(int i = 1; i < mapList.size(); i++){
1059   - Map<String, Object> m1 = mapList.get(i - 1);
1060   - Map<String, Object> m2 = mapList.get(i);
1061   -// if(m1.get("fcsj") != null && m2.get("fcsj") != null){
1062   -// long fcsj2 = Long.valueOf(m2.get("fcsj").toString());
1063   -// long fcsj1 = Long.valueOf(m1.get("fcsj").toString());
1064   -// if(sfqr == 1 && time1 > fcsj1){
1065   -// sjyysj += fcsj2 - time1;
1066   -// }else if(sfqr == 1 && time2 < fcsj2){
1067   -// sjyysj += time2 - fcsj1;
1068   -// }else{
1069   -// sjyysj += fcsj2 - fcsj1;
1070   -// }
1071   -// sjyysj1 += fcsj2 - fcsj1;
1072   -// }
1073   - if(m2.get("fcsj") != null && m2.get("zdsj") != null){
1074   - long zdsj = Long.valueOf(m2.get("zdsj").toString());
1075   - long fcsj = Long.valueOf(m2.get("fcsj").toString());
  1081 + for(int i = 0; i < mapList.size(); i++){
  1082 + Map<String, Object> m = mapList.get(i);
  1083 + if(m.get("fcsj") != null && m.get("zdsj") != null &&
  1084 + !m.get("bcType").toString().equals("in") && !m.get("bcType").toString().equals("out")){
  1085 + long zdsj = Long.valueOf(m.get("zdsj").toString());
  1086 + long fcsj = Long.valueOf(m.get("fcsj").toString());
1076 1087 if(fcsj > zdsj)
1077 1088 zdsj += 1440l;
1078 1089 if(sfqr == 1 && time1 > fcsj){
... ... @@ -1083,22 +1094,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1083 1094 sjyssj += zdsj - fcsj;
1084 1095 }
1085 1096 sjyssj1 += zdsj - fcsj;
1086   - sjlc += Double.valueOf(m2.get("lc").toString());
1087   - }
1088   - if(i == 1 && m1.get("fcsj") != null && m1.get("zdsj") != null){
1089   - long zdsj = Long.valueOf(m1.get("zdsj").toString());
1090   - long fcsj = Long.valueOf(m1.get("fcsj").toString());
1091   - if(fcsj > zdsj)
1092   - zdsj += 1440l;
1093   - if(sfqr == 1 && time1 > fcsj){
1094   - sjyssj += zdsj - time1;
1095   - }else if(sfqr == 1 && time2 < zdsj){
1096   - sjyssj += time2 - fcsj;
1097   - }else{
1098   - sjyssj += zdsj - fcsj;
1099   - }
1100   - sjyssj1 += zdsj - fcsj;
1101   - sjlc += Double.valueOf(m1.get("lc").toString());
  1097 + sjlc += Double.valueOf(m.get("lc").toString());
1102 1098 }
1103 1099 }
1104 1100 tempMap.put("company", companyName);
... ... @@ -1383,249 +1379,214 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1383 1379 times = "05:00-23:00";
1384 1380 }
1385 1381  
1386   - list = getSchedule(company, subCompany, line, startDate, endDate, model, times, true);
  1382 + list = getSchedule(company, subCompany, line, startDate, endDate, model, times, false);
1387 1383  
1388 1384 String[] date1 = startDate.split("-");
1389 1385 String[] date2 = endDate.split("-");
1390 1386 startDate = date1[0] + "年" + date1[1] + "月" + date1[2] + "日";
1391 1387 endDate = date2[0] + "年" + date2[1] + "月" + date2[2] + "日";
  1388 + String date = startDate + "-" + endDate;
  1389 + if(startDate.equals(endDate)){
  1390 + date = startDate;
  1391 + }
1392 1392  
1393 1393 String[] split = times.split("-");
1394 1394 int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]);
1395 1395 int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]);
1396 1396  
1397   - for(ScheduleRealInfo schedule : list){
1398   - if(qdzName.length() != 0 && !qdzName.equals(schedule.getQdzName())){
1399   - continue;
1400   - }
1401   - Long fcsj = schedule.getFcsjT();
1402   - if(!(endTime!=0?fcsj>=startTime&&fcsj<endTime:fcsj>=startTime)){
1403   - continue;
1404   - }
1405   - String key = schedule.getScheduleDateStr() + "/" + schedule.getXlName() + "/" + schedule.getLpName() + "/" + schedule.getFcsj() + "/" + schedule.getQdzName();
  1397 + for(ScheduleRealInfo s : list){
  1398 + String key = s.getScheduleDateStr() + "/" + s.getLpName();
1406 1399 if(!keyMap.containsKey(key))
1407 1400 keyMap.put(key, new ArrayList<ScheduleRealInfo>());
1408   - keyMap.get(key).add(schedule);
  1401 + keyMap.get(key).add(s);
1409 1402 }
  1403 +
1410 1404 for(String key : keyMap.keySet()){
1411   - Map<String, Object> tempMap = new HashMap<String, Object>();
1412   - int jhbc = 0, sjbc = 0, wdfz = 0;
1413   - long jhdf = 0l, sjdf = 0l, wddf1 = 0l, wddf2 = 0l;
1414   - long jhfc = 0l, sjfc = 0l, wdfc1 = 0l, wdfc2 = 0l;
1415   - long jhys = 0l, sjys = 0l, yssjMax = 0l, yssjMin = 0l;
1416   - long jhtz = 0l, sjtz = 0l, tzsjMax = 0l, tzsjMin = 0l;
1417   - String companyName = "", subCompanyName = "";
1418   - for(ScheduleRealInfo schedule : keyMap.get(key)){
1419   - if(schedule.getGsName() != null && companyName.length() == 0)
1420   - companyName = schedule.getGsName();
1421   - if(schedule.getFgsName() != null && subCompanyName.length() == 0)
1422   - subCompanyName = schedule.getFgsName();
1423   - long tzsj = 0l;
1424   - long yssj = 0l;
1425   - jhbc++;
1426   - if(schedule.getDfsj() != null){
1427   - jhtz += schedule.getFcsjT() - schedule.getDfsjT();
  1405 + List<ScheduleRealInfo> list1 = keyMap.get(key);
  1406 + Map<String, List<ScheduleRealInfo>> keyMap_ = new HashMap<String, List<ScheduleRealInfo>>();
  1407 + for(ScheduleRealInfo s : list1){
  1408 + String dateStr = s.getScheduleDateStr();
  1409 + if(!keyMap_.containsKey(dateStr))
  1410 + keyMap_.put(dateStr, new ArrayList<ScheduleRealInfo>());
  1411 + keyMap_.get(dateStr).add(s);
  1412 + }
  1413 +
  1414 + Set<String> keySet1 = keyMap_.keySet();
  1415 + Map<Long, String> Map = new HashMap<Long, String>();
  1416 + for(String key1 : keySet1){
  1417 + Map.put(Long.valueOf(key1.replaceAll("-", "")), key1);
  1418 + }
  1419 + Set<Long> keySet2 = Map.keySet();
  1420 +
  1421 + for(Long l : keySet2){
  1422 + List<ScheduleRealInfo> list2 = keyMap_.get(Map.get(l));
  1423 + List<ScheduleRealInfo> list3 = new ArrayList<ScheduleRealInfo>();
  1424 + List<Long> fcsjs = new ArrayList<Long>();
  1425 + List<Long> zdsjs = new ArrayList<Long>();
  1426 + List<Long> fcsjAs = new ArrayList<Long>();
  1427 + List<Long> zdsjAs = new ArrayList<Long>();
  1428 + Map<Long, ScheduleRealInfo> fcsjMap = new HashMap<Long, ScheduleRealInfo>();
  1429 + Map<Long, ScheduleRealInfo> zdsjMap = new HashMap<Long, ScheduleRealInfo>();
  1430 + Map<Long, ScheduleRealInfo> fcsjAMap = new HashMap<Long, ScheduleRealInfo>();
  1431 + Map<Long, ScheduleRealInfo> zdsjAMap = new HashMap<Long, ScheduleRealInfo>();
  1432 + for(ScheduleRealInfo schedule : list2){
  1433 + if(schedule.getStatus() != -1){
  1434 + if(schedule.getFcsj()!=null&&schedule.getFcsjActual()!=null&&
  1435 + schedule.getZdsj()!=null&&schedule.getZdsjActual()!=null){
  1436 + Long fcsj = schedule.getFcsjT();
  1437 + Long zdsj = schedule.getZdsjT();
  1438 + Long fcsjA = schedule.getFcsjActualTime();
  1439 + Long zdsjA = schedule.getZdsjActualTime();
  1440 + fcsjs.add(fcsj);
  1441 + zdsjs.add(zdsj);
  1442 + fcsjAs.add(fcsjA);
  1443 + zdsjAs.add(zdsjA);
  1444 + fcsjMap.put(fcsj, schedule);
  1445 + zdsjMap.put(zdsj, schedule);
  1446 + fcsjAMap.put(fcsjA, schedule);
  1447 + zdsjAMap.put(zdsjA, schedule);
  1448 + }
  1449 + }
  1450 + }
  1451 + Collections.sort(fcsjs);
  1452 + Collections.sort(zdsjs);
  1453 + Collections.sort(fcsjAs);
  1454 + Collections.sort(zdsjAs);
  1455 + for(int i = 0; i < fcsjs.size(); i++){
  1456 + Long fcsj = fcsjs.get(i);
  1457 + Long zdsj = zdsjs.get(i);
  1458 + Long fcsjA = fcsjAs.get(i);
  1459 + Long zdsjA = zdsjAs.get(i);
  1460 + ScheduleRealInfo s = fcsjMap.get(fcsj);
  1461 + s.setFcsjActual(fcsjAMap.get(fcsjA).getFcsjActual());
  1462 + s.setFcsjActualTime(fcsjAMap.get(fcsjA).getFcsjActualTime());
  1463 + s.setZdsjActual(zdsjAMap.get(zdsjA).getZdsjActual());
  1464 + s.setZdsjActualTime(zdsjAMap.get(zdsjA).getZdsjActualTime());
  1465 + list3.add(s);
1428 1466 }
1429   - jhys += schedule.getZdsjT() - schedule.getFcsjT();
1430 1467  
1431   - if(schedule.getFcsjActual() != null && schedule.getZdsjActual() != null){
1432   - sjbc++;
1433   - sjfc += schedule.getFcsjActualTime();
1434   - yssj += schedule.getZdsjActualTime() - schedule.getFcsjActualTime();
1435   - if(schedule.getFcsjActualTime() - schedule.getFcsjT() < 0){
1436   - wdfc1 += schedule.getFcsjT() - schedule.getFcsjActualTime();
1437   -// kbc++;
1438   - } else if(schedule.getFcsjActualTime() - schedule.getFcsjT() > 0){
1439   - wdfc2 += schedule.getFcsjActualTime() - schedule.getFcsjT();
1440   -// mbc++;
1441   - }
1442   -
1443   - if(schedule.getDfsj() != null){
1444   - sjdf += schedule.getDfsjT();
1445   - tzsj += schedule.getFcsjActualTime() - schedule.getDfsjT();
1446   - if(schedule.getDfsjT() - schedule.getFcsjT() < 0)
1447   - wddf1 += schedule.getFcsjT() - schedule.getDfsjT();
1448   - else
1449   - wddf2 += schedule.getDfsjT() - schedule.getFcsjT();
1450   - } else {
1451   - sjdf += schedule.getFcsjT();
1452   - tzsj += schedule.getFcsjActualTime() - schedule.getFcsjT();
  1468 + for(int i = 0; i < list3.size(); i++){
  1469 + ScheduleRealInfo s = list3.get(i);
  1470 + long fcwd = s.getFcsjActualTime() - s.getFcsjT();
  1471 + long jhys = s.getBcsj();
  1472 + long sjys = s.getZdsjActualTime() - s.getFcsjActualTime();
  1473 + if(i > 0){
  1474 + ScheduleRealInfo s1 = list3.get(i - 1);
  1475 + long ddwd = s1.getZdsjActualTime() - s1.getZdsjT();
  1476 + long jhtz = s.getFcsjT() - s1.getZdsjT();
  1477 + long sjtz = s.getFcsjActualTime() - s1.getZdsjActualTime();
  1478 +
  1479 + if(s.getBcType().equals("normal")){
  1480 + Map<String, Object> tempMap = new HashMap<String, Object>();
  1481 + tempMap.put("dates", date);
  1482 + tempMap.put("line", s.getXlName());
  1483 + tempMap.put("lp", s.getLpName());
  1484 + tempMap.put("station", s.getQdzName());
  1485 + tempMap.put("date", s.getScheduleDateStr());
  1486 + tempMap.put("jhdd", s1.getZdsj());
  1487 + tempMap.put("sjdd", s1.getZdsjActual());
  1488 + tempMap.put("ddwd", ddwd);
  1489 + tempMap.put("jhfc", s.getFcsj());
  1490 + tempMap.put("sjfc", s.getFcsjActual());
  1491 + tempMap.put("fcwd", fcwd);
  1492 + tempMap.put("jhys", jhys);
  1493 + tempMap.put("sjys", sjys);
  1494 + tempMap.put("jhtz", jhtz);
  1495 + tempMap.put("sjtz", sjtz);
  1496 +
  1497 + String key0 = s.getLpName() + "/" + s.getQdzName();
  1498 + if(!keyMap0.containsKey(key0))
  1499 + keyMap0.put(key0, new ArrayList<Map<String, Object>>());
  1500 + keyMap0.get(key0).add(tempMap);
  1501 + }
1453 1502 }
1454 1503 }
1455   -
1456   - sjys += yssj;
1457   - if(yssj > yssjMax || yssjMax == 0l)
1458   - yssjMax = yssj;
1459   - if(yssj < yssjMin || yssjMin == 0l)
1460   - yssjMin = yssj;
1461   -
1462   - sjtz += tzsj;
1463   - if(tzsj > tzsjMax || tzsjMax == 0l)
1464   - tzsjMax = tzsj;
1465   - if(tzsj < tzsjMin || tzsjMin == 0l)
1466   - tzsjMin = tzsj;
1467 1504 }
1468   - String[] keys = key.split("/");
1469   - tempMap.put("date", keys[0]);
1470   - tempMap.put("line", keys[1]);
1471   - tempMap.put("lp", keys[2]);
1472   - tempMap.put("jhdf", keys[3]);
1473   - tempMap.put("jhfc", keys[3]);
1474   - tempMap.put("station", keys[4]);
1475   - tempMap.put("times", times);
1476   - tempMap.put("company", companyName);
1477   - tempMap.put("subCompany", subCompanyName);
1478   - if(startDate.equals(endDate))
1479   - tempMap.put("dates", startDate);
1480   - else
1481   - tempMap.put("dates", startDate + "--" + endDate);
1482   - tempMap.put("jhbc", jhbc);
1483   - tempMap.put("sjbc", sjbc);
1484   - if(sjbc != 0){
1485   - tempMap.put("sjdf", ((sjdf/sjbc)/60<10?"0"+(sjdf/sjbc)/60:(sjdf/sjbc)/60) + ":" + ((sjdf/sjbc)%60<10?"0"+(sjdf/sjbc)%60:(sjdf/sjbc)%60));
1486   - tempMap.put("wddf1", wddf1 / sjbc + "分");
1487   - tempMap.put("wddf2", wddf2 / sjbc + "分");
1488   - tempMap.put("sjfc", ((sjfc/sjbc)/60<10?"0"+(sjfc/sjbc)/60:(sjfc/sjbc)/60) + ":" + ((sjfc/sjbc)%60<10?"0"+(sjfc/sjbc)%60:(sjfc/sjbc)%60));
1489   - tempMap.put("wdfc1", wdfc1 / sjbc + "分");
1490   - tempMap.put("wdfc2", wdfc2 / sjbc + "分");
1491   -// tempMap.put("kbc", df.format((((double) kbc)/sjbc)*100)+"%");
1492   -// tempMap.put("mbc", df.format((((double) mbc)/sjbc)*100)+"%");
1493   - tempMap.put("pjys", sjys / sjbc + "分");
1494   - tempMap.put("pjtz", sjtz / sjbc + "分");
1495   - } else {
1496   - tempMap.put("sjdf", "/");
1497   - tempMap.put("wddf1", "0分");
1498   - tempMap.put("wddf2", "0分");
1499   - tempMap.put("sjfc", "/");
1500   - tempMap.put("wdfc1", "0分");
1501   - tempMap.put("wdfc2", "0分");
1502   -// tempMap.put("kbc", "0%");
1503   -// tempMap.put("mbc", "0%");
1504   - tempMap.put("pjys", "0分");
1505   - tempMap.put("pjtz", "0分");
1506   - }
1507   -// tempMap.put("kbc", kbc);
1508   -// tempMap.put("mbc", mbc);
1509   - if(!tempMap.get("jhfc").toString().equals("/") && !tempMap.get("sjfc").toString().equals("/")){
1510   - String[] temp1 = tempMap.get("jhfc").toString().split(":");
1511   - String[] temp2 = tempMap.get("sjfc").toString().split(":");
1512   - tempMap.put("wdfz", (Integer.valueOf(temp2[0])*60 + Integer.valueOf(temp2[1]))
1513   - - (Integer.valueOf(temp1[0])*60 + Integer.valueOf(temp1[1])));
1514   - }else{
1515   - tempMap.put("wdfz", "/");
1516   - }
1517   - tempMap.put("jhys", jhys);
1518   - tempMap.put("sjys", sjys);
1519   - tempMap.put("yssjMin", yssjMin);
1520   - tempMap.put("yssjMax", yssjMax);
1521   - tempMap.put("jhtz", jhtz);
1522   - tempMap.put("sjtz", sjtz);
1523   - tempMap.put("tzsjMax", tzsjMax);
1524   - tempMap.put("tzsjMin", tzsjMin);
1525   - list0.add(tempMap);
1526 1505 }
1527 1506  
1528   - Collections.sort(list0, new Comparator<Map<String, Object>>() {
1529   -
1530   - public int compare(Map<String, Object> o1, Map<String, Object> o2) {
1531   -
1532   - String[] split1 = o1.get("date").toString().split("-");
1533   - String[] split2 = o2.get("date").toString().split("-");
1534   - Long a = Long.valueOf(split1[0])*10000 + Long.valueOf(split1[1])*100 + Long.valueOf(split1[2]);
1535   - Long b = Long.valueOf(split2[0])*10000 + Long.valueOf(split2[1])*100 + Long.valueOf(split2[2]);
1536   -
1537   - // 升序
1538   - return a.compareTo(b);
1539   - }
1540   - });
1541 1507  
1542   - for(Map<String, Object> m : list0){
1543   - String key = m.get("line").toString() + "/" + m.get("lp").toString() + "/" + m.get("station").toString();
1544   - if(!keyMap0.containsKey(key))
1545   - keyMap0.put(key, new ArrayList<Map<String, Object>>());
1546   - keyMap0.get(key).add(m);
1547   - }
1548   - for(String key : keyMap0.keySet()){
1549   - Map<String, Object> tempMap = new HashMap<String, Object>();
1550   - int jhbc = 0;
1551   - int sjbc = 0;
1552   - int wddf1 = 0;
1553   - int wddf2 = 0;
1554   - int wdfc1 = 0;
1555   - int wdfc2 = 0;
1556   - int ys = 0;
1557   - int tz = 0;
1558   - String companyName = "", subCompanyName = "";
1559   - for(Map<String, Object> m : keyMap0.get(key)){
1560   - if(m.containsKey("company") && companyName.length() == 0)
1561   - companyName = m.get("company").toString();
1562   - if(m.containsKey("subCompany") && subCompanyName.length() == 0)
1563   - subCompanyName = m.get("subCompany").toString();
1564   - jhbc += Integer.valueOf(m.get("jhbc").toString());
1565   - sjbc += Integer.valueOf(m.get("sjbc").toString());
1566   - wddf1 += Integer.valueOf(m.get("wddf1").toString().substring(0, m.get("wddf1").toString().length() - 1));
1567   - wddf2 += Integer.valueOf(m.get("wddf2").toString().substring(0, m.get("wddf2").toString().length() - 1));
1568   - wdfc1 += Integer.valueOf(m.get("wdfc1").toString().substring(0, m.get("wdfc1").toString().length() - 1));
1569   - wdfc2 += Integer.valueOf(m.get("wdfc2").toString().substring(0, m.get("wdfc2").toString().length() - 1));
1570   - ys += Integer.valueOf(m.get("pjys").toString().substring(0, m.get("pjys").toString().length() - 1));
1571   - tz += Integer.valueOf(m.get("pjtz").toString().substring(0, m.get("pjtz").toString().length() - 1));
1572   - }
1573   - if(startDate.equals(endDate))
1574   - tempMap.put("dates", startDate);
1575   - else
1576   - tempMap.put("dates", startDate + "--" + endDate);
1577   - tempMap.put("company", companyName);
1578   - tempMap.put("subCompany", subCompanyName);
1579   - String[] keys = key.split("/");
1580   - tempMap.put("line", keys[0]);
1581   - tempMap.put("lp", keys[1]);
1582   - tempMap.put("station", keys[2]);
1583   - tempMap.put("times", times);
1584   - tempMap.put("jhbc", jhbc);
1585   - tempMap.put("sjbc", sjbc);
1586   - tempMap.put("wddf1", wddf1/keyMap0.get(key).size()+"分");
1587   - tempMap.put("wddf2", wddf2/keyMap0.get(key).size()+"分");
1588   - tempMap.put("wdfc1", wdfc1/keyMap0.get(key).size()+"分");
1589   - tempMap.put("wdfc2", wdfc2/keyMap0.get(key).size()+"分");
1590   - tempMap.put("pjys", ys/keyMap0.get(key).size()+"分");
1591   - tempMap.put("pjtz", tz/keyMap0.get(key).size()+"分");
1592   - tempMap.put("workList", keyMap0.get(key));
1593   -
1594   - String key1 = tempMap.get("line").toString();
1595   - if(!keyMap1.containsKey(key1))
1596   - keyMap1.put(key1, new ArrayList<Map<String, Object>>());
1597   - keyMap1.get(key1).add(tempMap);
1598   - }
1599 1508  
1600   - for(String key : keyMap1.keySet()){
1601   - Collections.sort(keyMap1.get(key), new Comparator<Map<String, Object>>() {
  1509 + if(keyMap0.keySet().size() > 0){
  1510 + Set<String> keySet = keyMap0.keySet();
  1511 + List<String> keyList = new ArrayList<String>();
  1512 + keyList.addAll(keySet);
  1513 + Collections.sort(keyList, new Comparator<String>() {
1602 1514  
1603   - public int compare(Map<String, Object> o1, Map<String, Object> o2) {
  1515 + public int compare(String o1, String o2) {
1604 1516 Long a;
1605 1517 Long b;
1606   - String lp1 = o1.get("lp").toString();
1607   - String lp2 = o2.get("lp").toString();
  1518 + o1 = o1.split("/")[0];
  1519 + o2 = o2.split("/")[0];
1608 1520 String str1 = "";
1609 1521 String str2 = "";
1610   - for(int i = 0; i < lp1.length(); i++){
1611   - str1 += (int)lp1.charAt(i);
  1522 + for(int i = 0; i < o1.length(); i++){
  1523 + str1 += (int)o1.charAt(i);
1612 1524 }
1613   - for(int i = 0; i < lp2.length(); i++){
1614   - str2 += (int)lp2.charAt(i);
  1525 + for(int i = 0; i < o2.length(); i++){
  1526 + str2 += (int)o2.charAt(i);
1615 1527 }
1616 1528  
1617 1529 a = Long.valueOf(str1);
1618 1530 b = Long.valueOf(str2);
1619   -
  1531 +
1620 1532 // 升序
1621 1533 return a.compareTo(b);
1622 1534 }
1623 1535 });
1624 1536  
1625   - resList.addAll(keyMap1.get(key));
  1537 + for(String key : keyList){
  1538 + List<Map<String, Object>> mapList = keyMap0.get(key);
  1539 + Map<String, Object> tempMap = new HashMap<String, Object>();
  1540 + int ddtq_ = 0, ddtqs = 0, ddyw_ = 0, ddyws = 0;
  1541 + int fctq_ = 0, fctqs = 0, fcyw_ = 0, fcyws = 0;
  1542 + int yssj_ = 0, yssjs = 0, tzsj_ = 0, tzsjs = 0;
  1543 + for(Map<String, Object> m : mapList){
  1544 + int ddwd = Integer.valueOf(m.get("ddwd").toString());
  1545 + if(ddwd < 0){
  1546 + ddtq_ += 0 - ddwd;
  1547 + ++ddtqs;
  1548 + } else if(ddwd > 0){
  1549 + ddyw_ += ddwd;
  1550 + ++ddyws;
  1551 + }
  1552 + int fcwd = Integer.valueOf(m.get("fcwd").toString());
  1553 + if(fcwd < 0){
  1554 + fctq_ += 0 - fcwd;
  1555 + ++fctqs;
  1556 + } else if(fcwd > 0){
  1557 + fcyw_ += fcwd;
  1558 + ++fcyws;
  1559 + }
  1560 + int sjys = Integer.valueOf(m.get("sjys").toString());
  1561 + yssj_ += sjys;
  1562 + ++yssjs;
  1563 + int sjtz = Integer.valueOf(m.get("sjtz").toString());
  1564 + tzsj_ += sjtz;
  1565 + ++tzsjs;
  1566 + }
  1567 + tempMap.put("ddwd1", (ddtqs!=0?ddtq_/ddtqs:0) + "分");
  1568 + tempMap.put("ddwd2", (ddyws!=0?ddyw_/ddyws:0) + "分");
  1569 + tempMap.put("wdfc1", (fctqs!=0?fctq_/fctqs:0) + "分");
  1570 + tempMap.put("wdfc2", (fcyws!=0?fcyw_/fcyws:0) + "分");
  1571 + tempMap.put("pjys", (yssjs!=0?yssj_/yssjs:0) + "分");
  1572 + tempMap.put("pjtz", (tzsjs!=0?tzsj_/tzsjs:0) + "分");
  1573 +
  1574 + Map<String, Object> m = mapList.get(0);
  1575 + tempMap.put("dates", date);
  1576 + tempMap.put("times", times);
  1577 + tempMap.put("line", m.get("line"));
  1578 + tempMap.put("lp", m.get("lp"));
  1579 + tempMap.put("station", m.get("station"));
  1580 + tempMap.put("bcs", mapList.size());
  1581 + tempMap.put("workList", mapList);
  1582 + if(qdzName != null && qdzName.trim().length() != 0){
  1583 + if(!tempMap.get("station").equals(qdzName)){
  1584 + continue;
  1585 + }
  1586 + }
  1587 + resList.add(tempMap);
  1588 + }
1626 1589 }
1627   -
1628   -
1629 1590 return resList;
1630 1591 }
1631 1592  
... ...
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
... ... @@ -9,6 +9,8 @@ import java.text.ParseException;
9 9 import java.text.SimpleDateFormat;
10 10 import java.util.ArrayList;
11 11 import java.util.Calendar;
  12 +import java.util.Collections;
  13 +import java.util.Comparator;
12 14 import java.util.Date;
13 15 import java.util.HashMap;
14 16 import java.util.Iterator;
... ... @@ -428,13 +430,22 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
428 430 // repository.obtainYl(rq,gsbm,fgsbm,line,nbbm,"nbbm");
429 431 // 当天YLXXB信息
430 432 List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0,gsbm);
431   - // 前一天所有车辆最后进场班次信息
432   -// List<Ylb> ylListBe = repository.obtainYlbefore(rq, gsbm, fgsbm, line, nbbm);
433   -// List<Dlb> ylListBe =repository.listMaxRqJcsx(rq, gsbm, fgsbm, line, nbbm);
434   -// List<Cyl> clyList = cylRepository.obtainCyl(nbbm,gsbm);
435 433 // 从排班表中计算出行驶的总里程
436 434 List<Map<String, Object>> listpb =new ArrayList<Map<String, Object>>();
437 435 List<Map<String, Object>> listpbs=scheduleRealInfoService.yesterdayDataList(line, rq, gsbm, fgsbm, "", nbbm);
  436 + Map<String, Double> lcMap=new HashMap<String,Double>();
  437 + for (int i = 0; i < listpbs.size(); i++) {
  438 + String cl=listpbs.get(i).get("clZbh").toString();
  439 + Double lc= listpbs.get(i).get("totalKilometers") == null ? 0.0
  440 + : Double.parseDouble(listpbs.get(i).get("totalKilometers").toString());
  441 + if(lcMap.get(cl)==null){
  442 + lcMap.put(cl, lc);
  443 + }else{
  444 + Double lc_=lcMap.get(cl);
  445 + lcMap.remove(cl);
  446 + lcMap.put(cl, Arith.add(lc, lc_));
  447 + }
  448 + }
438 449 List<Jdl> jdlList=jdlRepository.JdlList(rq);
439 450 String sxtj=map2.get("sxtj").toString();
440 451 if(sxtj.equals("0")){
... ... @@ -470,126 +481,134 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
470 481 }
471 482 }
472 483 }
473   -
  484 + Map<String, Object> newMap_=new HashMap<String,Object>();
474 485 List<Dlb> addList = new ArrayList<Dlb>();
475 486 List<Dlb> updateList = new ArrayList<Dlb>();
476 487 String ins="";
477 488 Map<String, Object> ylMap=new HashMap<String, Object>();
478   - for (int x = 0; x < listpb.size(); x++) {
  489 + List<Map<String, Object>> listpb_=listpb;
  490 + Collections.sort(listpb,new NbbmJcsxMap());
  491 + for (int x = 0; x < listpb_.size(); x++) {
479 492 String type = "add";
480 493 boolean sfdc = false;
481   - Map<String, Object> map = listpb.get(x);
482   - if (carsMap.get(map.get("clZbh").toString()) != null) {
483   - sfdc = carsMap.get(map.get("clZbh").toString());
  494 + Map<String, Object> map_ = listpb_.get(x);
  495 + if (carsMap.get(map_.get("clZbh").toString()) != null) {
  496 + sfdc = carsMap.get(map_.get("clZbh").toString());
484 497 } else {
485 498 sfdc = false;
486 499 }
487 500 if (sfdc) {
488   - // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断)
489   - Dlb t = new Dlb();
490   - for (int k = 0; k < dlList.size(); k++) {
491   - Dlb t1 = dlList.get(k);
492   - if (t1.getNbbm().equals(map.get("clZbh").toString())
493   - && t1.getJsy().equals(map.get("jGh").toString())
494   - && t1.getXlbm().equals(map.get("xlBm").toString())) {
495   - t = t1;
496   - type = "update";
  501 + if(newMap_.get(map_.get("clZbh").toString())==null){
  502 + newMap_.put(map_.get("clZbh").toString(), map_.get("clZbh").toString());
  503 + //车辆总里程
  504 + double zlc =lcMap.get(map_.get("clZbh").toString());
  505 + //车辆总加电量
  506 + Double zjzl = 0.0;
  507 + for (int j = 0; j < ylxxList.size(); j++) {
  508 + Ylxxb ylxxb = ylxxList.get(j);
  509 + if (map_.get("clZbh").toString().equals(ylxxb.getNbbm())
  510 + && map_.get("company").toString().equals(ylxxb.getGsdm())) {
  511 + zjzl = Arith.add(zjzl, ylxxb.getJzl());
  512 + }
497 513 }
498   - }
499   -
500   - // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量
501   - /* if (map.get("seqNumber").toString().equals("1")) {
502   - boolean fage = true;
503   - for (int i = 0; i < ylListBe.size(); i++) {
504   - Ylb ylb = ylListBe.get(i);
505   - if (map.get("clZbh").toString().equals(ylb.getNbbm())) {
506   - if(ylb.getJzyl()>0){
507   - t.setCzyl(ylb.getJzyl());
508   - fage = false;
509   - break;
510   - }
511   -
  514 + for (int i = 0; i < jdlList.size(); i++) {
  515 + Jdl jdl=jdlList.get(i);
  516 + if(map_.get("clZbh").toString().equals(jdl.getNbbm())
  517 + &&map_.get("company").toString().equals(jdl.getGsBm())
  518 + &&map_.get("bCompany").toString().equals(jdl.getFgsBm())){
  519 + zjzl = Arith.add(zjzl,jdl.getJdl());
512 520 }
513 521 }
514   - if (fage) {
515   - for (int y = 0; y < clyList.size(); y++) {
516   - Cyl cyl = clyList.get(y);
517   - if (map.get("clZbh").toString().equals(cyl.getNbbm())) {
518   - if(cyl!=null){
519   - if(cyl.getCyl()>=0){
520   - t.setCzyl(cyl.getCyl());
521   - fage = false;
522   - break;
523   - }else {
524   - if(cyl.getCxrl()!=null){
525   - if(cyl.getCxrl()>0){
526   - t.setCzyl(cyl.getCxrl());
527   - fage = false;
528   - break;
529   - }
  522 +
  523 + Double nextJzyl = 0.0;
  524 + for (int i = 0; i < listpb.size(); i++) {
  525 + Map<String, Object> map = listpb.get(i);
  526 + if(map_.get("clZbh").toString().equals(map.get("clZbh").toString())){
  527 + // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断)
  528 + Dlb t = new Dlb();
  529 + for (int k = 0; k < dlList.size(); k++) {
  530 + Dlb t1 = dlList.get(k);
  531 + if (t1.getNbbm().equals(map.get("clZbh").toString())
  532 + && t1.getJsy().equals(map.get("jGh").toString())
  533 + && t1.getXlbm().equals(map.get("xlBm").toString())) {
  534 + t = t1;
  535 + type = "update";
  536 + }
  537 + }
  538 + Double lc= Double.parseDouble(map.get("totalKilometers").toString());
  539 + if(map.get("seqNumber").toString().equals("1")){
  540 + // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量
  541 + Double dh=0.0;
  542 + if(zlc>0){
  543 + dh = Double.parseDouble(df.format(zjzl * (lc / zlc)));
  544 + }
  545 + nextJzyl =Arith.sub(zjzl,dh);
  546 + if(zlc>0){
  547 + long l=Math.round(nextJzyl);
  548 + double ylxs=l*100/100;
  549 + dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs));
  550 + t.setHd(dh);
  551 + t.setCdl(dh);
  552 + nextJzyl=ylxs;
  553 + }else{
  554 + t.setHd(0.0);
  555 + t.setCdl(0.0);
  556 + }
  557 + }else{
  558 + Double dh=0.0;
  559 + if(zlc>0){
  560 + dh = Double.parseDouble(df.format(zjzl * (lc / zlc)));
  561 + }
  562 + nextJzyl =Arith.sub( nextJzyl,dh);
  563 + if(zlc>0){
  564 + long l=0l;
  565 + double ylxs=0.0;
  566 + if(i==listpb.size()-1){
  567 +// ylxs=czyl;
  568 + }else{
  569 + if(listpb.get(i+1).get("clZbh").toString().equals(map.get("clZbh").toString())){
  570 + l=Math.round(nextJzyl);
  571 + ylxs=l*100/100;
530 572 }
  573 +
531 574 }
  575 + dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs));
  576 + t.setHd(dh);
  577 + t.setCdl(dh);
  578 + nextJzyl=ylxs;
  579 + }else{
  580 + t.setHd(0.0);
  581 + t.setCdl(0.0);
532 582 }
533 583 }
  584 + t.setCzcd(100.0);
  585 + t.setJzcd(100.0);
  586 + t.setNbbm(map.get("clZbh").toString());
  587 + t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString());
  588 + t.setZlc(map.get("totalKilometers") == null ? 0.0
  589 + : Double.parseDouble(map.get("totalKilometers").toString()));
  590 + t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString());
  591 + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
  592 + t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString());
  593 + t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString());
  594 + t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString());
  595 + t.setRq(sdf.parse(rq));
  596 +
  597 + if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){
  598 + if(type.equals("add")){
  599 + t.setCreatetime(date);
  600 + addList.add(t);
  601 + }else{
  602 + t.setUpdatetime(date);
  603 + updateList.add(t);
  604 + ins += t.getId().toString()+",";
  605 + }
  606 + }
  607 +// repository.save(t);
  608 + newMap.put("status", ResponseCode.SUCCESS);
534 609 }
535 610 }
536   - if (fage) {
537   - t.setCzyl(0.0);
538   - }
539   - }
540   - */
541   - Double jzl = 0.0;
542   - //一人一车加注量只匹配一次
543   - if(ylMap.get(map.get("clZbh").toString()+"_"+ map.get("jGh").toString())!=null){
544   -
545   - }else{
546   - // 把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断)
547   - for (int j = 0; j < ylxxList.size(); j++) {
548   - Ylxxb ylxxb = ylxxList.get(j);
549   - if (map.get("clZbh").toString().equals(ylxxb.getNbbm())
550   - && map.get("jGh").toString().equals(ylxxb.getJsy())) {
551   - jzl +=Arith.add(jzl, ylxxb.getJzl());
552   - }
553   - }
554   - ylMap.put(map.get("clZbh").toString()+"_"+ map.get("jGh").toString(),map.get("xlBm") == null ? "" : map.get("xlBm").toString());
555 611 }
556   - for (int i = 0; i < jdlList.size(); i++) {
557   - Jdl jdl=jdlList.get(i);
558   - if(map.get("clZbh").toString().equals(jdl.getNbbm())
559   - &&map.get("jGh").toString().equals(jdl.getJsy())
560   - &&map.get("bCompany").toString().equals(jdl.getFgsBm())){
561   - jzl+=jdl.getJdl();
562   - }
563   - }
564   -
565   - t.setCdl(jzl);
566   - t.setCzcd(100.0);
567   - t.setJzcd(100.0);
568   - t.setHd(jzl);
569   - t.setNbbm(map.get("clZbh").toString());
570   - t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString());
571   - t.setZlc(map.get("totalKilometers") == null ? 0.0
572   - : Double.parseDouble(map.get("totalKilometers").toString()));
573   - t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString());
574   - t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
575   - t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString());
576   - t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString());
577   - t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString());
578   - t.setRq(sdf.parse(rq));
579   -
580   - if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){
581   - if(type.equals("add")){
582   - t.setCreatetime(date);
583   - addList.add(t);
584   - }else{
585   - t.setUpdatetime(date);
586   - updateList.add(t);
587   - ins += t.getId().toString()+",";
588   - }
589   - }
590   -// repository.save(t);
591   - newMap.put("status", ResponseCode.SUCCESS);
592   -
593 612 }
594 613 }
595 614 if(addList.size()>0){
... ... @@ -1014,3 +1033,11 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
1014 1033 return lists;
1015 1034 }
1016 1035 }
  1036 +
  1037 +class NbbmJcsxMap implements Comparator<Map<String, Object>>{
  1038 + @Override
  1039 + public int compare(Map<String, Object> o1, Map<String, Object> o2) {
  1040 + // TODO Auto-generated method stub
  1041 + return (o1.get("clZbh").toString()+o1.get("seqNumber").toString()).compareTo((o2.get("clZbh").toString()+o1.get("seqNumber").toString()));
  1042 + }
  1043 +}
... ...
src/main/java/com/bsth/service/oil/impl/JdlServiceImpl.java
... ... @@ -63,7 +63,7 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl
63 63 }
64 64 String[] split = (text+";").split(",");
65 65 String str = "";
66   - for(int j = 0; j < split.length && j < 6; j++){
  66 + for(int j = 0; j < split.length && j < 5; j++){
67 67 str += split[j];
68 68 }
69 69 if(str.trim().length() == 0)
... ... @@ -75,22 +75,22 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl
75 75 String[] split = text.split(",");
76 76 String rq = split[0].trim();
77 77 String nbbm = split[1].trim();
78   - String jsy= split[2].trim();
79   - double jdl = Double.valueOf(split[3].trim().length()!=0?split[3]:"0");
80   - String jdz = split[4].trim();
81   - String remarks = split[5].trim();
  78 +// String jsy= split[2].trim();
  79 + double jdl = Double.valueOf(split[2].trim().length()!=0?split[2]:"0");
  80 + String jdz = split[3].trim();
  81 + String remarks = split[4].trim();
82 82 if(rq.trim().length() == 0){
83 83 rq = sdf.format(new Date());
84 84 }
85 85  
86   - List<Double> jdl_ = repository.queryBySame(gsbm, fgsbm, rq, nbbm, jsy);
  86 + List<Double> jdl_ = repository.queryBySame(gsbm, fgsbm, rq, nbbm);
87 87  
88 88 if(jdl_.size() == 0){
89 89 repository.insertData(gsbm, gsName, fgsbm, fgsName, rq, nbbm,
90   - df.format(jdl), jdz, remarks, sd.format(new Date()),jsy);
  90 + df.format(jdl), jdz, remarks, sd.format(new Date()));
91 91 }else{
92 92 // jdl += jdl_.get(0);
93   - repository.UpdateJdl(df.format(jdl), gsbm, fgsbm, rq, nbbm, jsy);
  93 + repository.UpdateJdl(df.format(jdl), gsbm, fgsbm, rq, nbbm);
94 94 }
95 95 }
96 96 wb.close();
... ... @@ -112,9 +112,9 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl
112 112 String fgsbm = map.get("fgsbm").toString();
113 113 String rq = map.get("rq").toString();
114 114 String nbbm = map.get("nbbm").toString();
115   - String jsy =map.get("jsy").toString();
  115 +// String jsy =map.get("jsy").toString();
116 116 Integer page = Integer.valueOf(map.containsKey("page")?map.get("page").toString():"0");
117   - List<Jdl> query = repository.query(gsbm, fgsbm, rq, nbbm,jsy);
  117 + List<Jdl> query = repository.query(gsbm, fgsbm, rq, nbbm);
118 118  
119 119 if(!map.containsKey("type")){
120 120  
... ... @@ -133,7 +133,6 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl
133 133 m.put("nbbm", jdl.getNbbm());
134 134 m.put("jdl", jdl.getJdl());
135 135 m.put("jdz", jdl.getJdz());
136   - m.put("jsy", jdl.getJsy());
137 136 m.put("remarks", jdl.getRemarks());
138 137 list.add(m);
139 138 }
... ...
src/main/java/com/bsth/service/oil/impl/YlxxbServiceImpl.java
... ... @@ -45,23 +45,25 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
45 45 JdbcTemplate jdbcTemplate;
46 46 @Override
47 47 public PageObject<Ylxxb> Pagequery(Map<String, Object> map) {
48   -
  48 +
49 49 String rq=map.get("yyrq").toString();
50 50 String gsdm=map.get("gsdm_like").toString();
51 51 String fgsdm=map.get("fgsdm_like").toString();
52   -
53   - String sql=" select * from ("
54   - + "select *,CONCAT(nbbm,jsy) as nj "
55   - + " from bsth_c_ylxxb where yyrq='"+rq+"' "
56   - + " and gsdm ='"+gsdm+"') x where x.nj not in ("
57   - + " select CONCAT(nbbm,jsy) from bsth_c_ylb "
58   - + " where DATE_FORMAT(rq,'%Y-%m-%d')='"+rq+"'"
59   - + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"')"
60   - + " and x.nbbm in (select nbbm from bsth_c_ylb "
61   - + " where DATE_FORMAT(rq,'%Y-%m-%d')='"+rq+"'"
62   - + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"')";
63   -
64   -
  52 +
  53 + String sql=" select * from ("
  54 + + "select *,CONCAT(nbbm,jsy) as nj "
  55 + + " from bsth_c_ylxxb where yyrq='"+rq+"' "
  56 + + " and gsdm ='"+gsdm+"' and jylx ='0') x where x.nj not in ("
  57 + + " select CONCAT(nbbm,jsy) from bsth_c_ylb "
  58 + + " where rq='"+rq+"'"
  59 + + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"')"
  60 + + " and x.nbbm in (select nbbm from bsth_c_ylb "
  61 + + " where rq='"+rq+"'"
  62 + + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"') "
  63 + + " and x.nbbm not in (select nbbm from bsth_c_ylxxb"
  64 + + " where yyrq='"+rq+"' and gsdm ='"+gsdm+"' AND jylx ='1')";
  65 +
  66 +
65 67 /*String sql= "select v.*,u.jsy as ldgh from "
66 68 + " ( select * from bsth_c_ylxxb x where "
67 69 + " DATE_FORMAT(x.yyrq,'%Y-%m-%d')='"+rq+"' and x.gsdm='"+gsdm+"'"
... ... @@ -76,43 +78,43 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
76 78 + " where DATE_FORMAT(rq,'%Y-%m-%d')='"+rq+"'"
77 79 + " and ssgsdm='"+gsdm+"' and fgsdm='"+fgsdm+"' ) u "
78 80 + " on v.nbbm=u.nbbm ";*/
79   -
  81 +
80 82 //根具条件查询指定日期Ylxxb的数据
81 83 // List<Ylxxb> iterator=repository.checkYlxx(rq,gsdm);
82 84 /*if(map.get("gsdm_in")!=null){
83 85 map.put("ssgsdm_in", map.get("gsdm_in"));
84 86 map.remove("gsdm_in");
85   -
  87 +
86 88 }else{
87 89 map.put("ssgsdm_like", map.get("gsdm_like"));
88 90 map.remove("gsdm_like");
89 91 }*/
90   -
  92 +
91 93 //根具条件查询指定日期Ylb的数据
92 94 // List<Ylb> ylbIterator=ylbRepository.checkYl(rq,gsdm,fgsdm);
93   - List<Ylxxb> list=jdbcTemplate.query(sql,
94   - new RowMapper<Ylxxb>(){
95   - @Override
96   - public Ylxxb mapRow(ResultSet rs, int rowNum) throws SQLException {
97   - Ylxxb s = new Ylxxb();
98   - s.setId(rs.getInt("id"));
99   - s.setYyrq(rs.getDate("yyrq"));
100   - s.setNbbm(rs.getString("nbbm"));
101   - s.setGsdm(rs.getString("gsdm"));
102   - s.setFgsdm(rs.getString("fgsdm"));
103   - s.setJsy(rs.getString("jsy"));
104   - s.setJzl(rs.getDouble("jzl"));
105   - s.setStationid(rs.getString("stationid"));
106   - s.setNylx(rs.getInt("nylx"));
107   - s.setJyggh(rs.getString("jyggh"));
108   - s.setYj(rs.getDouble("yj"));
  95 + List<Ylxxb> list=jdbcTemplate.query(sql,
  96 + new RowMapper<Ylxxb>(){
  97 + @Override
  98 + public Ylxxb mapRow(ResultSet rs, int rowNum) throws SQLException {
  99 + Ylxxb s = new Ylxxb();
  100 + s.setId(rs.getInt("id"));
  101 + s.setYyrq(rs.getDate("yyrq"));
  102 + s.setNbbm(rs.getString("nbbm"));
  103 + s.setGsdm(rs.getString("gsdm"));
  104 + s.setFgsdm(rs.getString("fgsdm"));
  105 + s.setJsy(rs.getString("jsy"));
  106 + s.setJzl(rs.getDouble("jzl"));
  107 + s.setStationid(rs.getString("stationid"));
  108 + s.setNylx(rs.getInt("nylx"));
  109 + s.setJyggh(rs.getString("jyggh"));
  110 + s.setYj(rs.getDouble("yj"));
109 111 // s.setLdgh(rs.getString("ldgh"));
110   - s.setBz(rs.getString("bz"));
111   - return s;
112   - }
113   - });
114   -
115   -
  112 + s.setBz(rs.getString("bz"));
  113 + return s;
  114 + }
  115 + });
  116 +
  117 +
116 118 List<Ylb> listylb=ylbRepository.obtainYl(rq, gsdm, fgsdm, "", "", "nbbm");
117 119 for (int i = 0; i < list.size(); i++) {
118 120 String ldgh="";
... ... @@ -122,11 +124,11 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
122 124 if(ldgh.equals(""))
123 125 ldgh +=ylb.getJsy();
124 126 else
125   - ldgh += ","+ylb.getJsy();
  127 + ldgh += ","+ylb.getJsy();
126 128 }
127 129 }
128 130 list.get(i).setLdgh(ldgh);
129   -
  131 +
130 132 }
131 133 //正式使用用下面代码
132 134 // for (int i = 0; i < iterator.size(); i++) {
... ... @@ -147,16 +149,16 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
147 149 // list.add(y1);
148 150 // }
149 151 // }
150   -
151   -
152   -
  152 +
  153 +
  154 +
153 155 PageHelper pageHelper = new PageHelper(list.size(), map);
154 156 pageHelper.getMap();
155 157 PageObject<Ylxxb> pageObject = pageHelper.getPageObject();
156 158 pageObject.setDataList(list);
157 159 return pageObject;
158 160 }
159   - @Transactional
  161 + @Transactional
160 162 @Override
161 163 public Map<String, Object> checkJsy(Map<String, Object> map) throws Exception{
162 164 Map<String, Object> newMap=new HashMap<String,Object>();
... ... @@ -175,11 +177,13 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
175 177 Integer id =jsonObject.getInteger("id");
176 178 String jsy =jsonObject.getString("jsy");
177 179 Ylxxb ylxxb=repository.findOne(id);
178   - ylxxb.setJsy(jsy);
179   - ylxxb.setJylx(1);
180   - repository.save(ylxxb);
  180 + if(!ylxxb.getJsy().equals(jsy)){
  181 + ylxxb.setJsy(jsy);
  182 + ylxxb.setJylx(1);
  183 + repository.save(ylxxb);
  184 + }
181 185 }
182   - newMap.put("status", ResponseCode.SUCCESS);
  186 + newMap.put("status", ResponseCode.SUCCESS);
183 187 }catch(Exception e){
184 188 newMap.put("status", ResponseCode.ERROR);
185 189 logger.error("save erro.", e);
... ... @@ -188,4 +192,4 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
188 192 return newMap;
189 193 }
190 194  
191   -}
  195 +}
192 196 \ No newline at end of file
... ...
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
... ... @@ -180,4 +180,10 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
180 180 List<Map<String,Object>> statisticsDaily_mh_2(String line, String date, String xlName, String type);
181 181  
182 182 List<ScheduleRealInfo> realScheduleList_mh_2(String line, String date);
  183 +
  184 + List<Map<String, Object>> mileageReport(String gsdm, String fgsdm,
  185 + String line, String date, String date2);
  186 +
  187 + List<Map<String, Object>> scheduleCorrectionReport(String gsdm, String fgsdm,
  188 + String line, String date, String date2);
183 189 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -31,6 +31,8 @@ import com.bsth.entity.realcontrol.ChildTaskPlan;
31 31 import com.bsth.entity.realcontrol.LineConfig;
32 32 import com.bsth.entity.realcontrol.ScheduleRealInfo;
33 33 import com.bsth.entity.realcontrol.SvgAttribute;
  34 +import com.bsth.entity.report.MileageReport;
  35 +import com.bsth.entity.report.ScheduleCorrectionReport;
34 36 import com.bsth.entity.schedule.CarConfigInfo;
35 37 import com.bsth.entity.schedule.EmployeeConfigInfo;
36 38 import com.bsth.entity.schedule.GuideboardInfo;
... ... @@ -1837,7 +1839,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1837 1839 map = new HashMap<String, Object>();
1838 1840 map.put("num", i++);
1839 1841 map.put("xlName", xlName);
1840   - map.put("clZbh", BasicData.deviceId2NbbmMap.get(obj[2]));
  1842 + map.put("clZbh", BasicData.deviceId2NbbmMap.get(obj[2])==null?"":BasicData.deviceId2NbbmMap.get(obj[2]));
1841 1843 map.put("company",fgs);
1842 1844 map.put("requestType", "0x" + Integer.toHexString(Integer.parseInt(obj[0] + "")).toUpperCase());
1843 1845 map.put("requestTime", obj[1]);
... ... @@ -2324,10 +2326,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2324 2326 map.put("dtbc", 0);
2325 2327 map.put("dtbc_m", 0);
2326 2328 map.put("dtbc_a", 0);
2327   - map.put("djg", 0);
2328   - map.put("djg_m", 0);
2329   - map.put("djg_a", 0);
2330   - map.put("djg_time", 0);
  2329 + Map<String, Object> m=culateService.culateDjg(list_s, line);
  2330 + map.put("djg", m.get("djgcsq"));
  2331 + map.put("djg_m", m.get("djgcsz"));
  2332 + map.put("djg_a", m.get("djgcsw"));
  2333 + map.put("djg_time", m.get("djgsj"));
2331 2334 map.put("jls", Arith.sub(Arith.add(jhlc, ljgl), lbgl));
2332 2335 lMap.add(map);
2333 2336 return lMap;
... ... @@ -4637,6 +4640,195 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4637 4640 }
4638 4641 return rs;
4639 4642 }
  4643 +
  4644 +
  4645 + @Override
  4646 + public List<Map<String, Object>> mileageReport(String gsdm,
  4647 + String fgsdm, String line, String date, String date2) {
  4648 +
  4649 + String sql = "select * from calc_mileage where 1=1 " ;
  4650 + if (!line.equals(" ")) {
  4651 + sql = sql+" and line_code='"+ line+"' ";
  4652 + }
  4653 + sql = sql+" and DATE_FORMAT(rq,'%Y-%m-%d') between '"+ date+"' and '"+ date2+"'";
  4654 + if (!gsdm.equals(" ")) {
  4655 + sql = sql+" and company_id="+gsdm;
  4656 + }
  4657 + if (!gsdm.equals(" ")) {
  4658 + sql = sql+" and sub_company_id="+fgsdm;
  4659 + }
  4660 + sql = sql+" order by line_code";
  4661 + List<MileageReport> list = jdbcTemplate.query(sql,
  4662 + new RowMapper<MileageReport>() {
  4663 + @Override
  4664 + public MileageReport mapRow(ResultSet rs, int rowNum) throws SQLException {
  4665 + MileageReport mr = new MileageReport();
  4666 + mr.setCompanyName(rs.getString("company_name"));
  4667 + mr.setSubCompanyName(rs.getString("sub_company_name"));
  4668 + mr.setLineName(rs.getString("line_name"));
  4669 + mr.setSjyygl(rs.getDouble("sjyygl"));
  4670 + mr.setSjksgl(rs.getDouble("sjksgl"));
  4671 + mr.setZgl(rs.getDouble("zyygl"));
  4672 + mr.setZddfgl(rs.getDouble("zddfgl"));
  4673 + mr.setSddfgl(rs.getDouble("sddfgl"));
  4674 + mr.setWqwxhgl(rs.getDouble("wqwxhgl"));
  4675 + mr.setBfwxhgl(rs.getDouble("bfwxhgl"));
  4676 + mr.setPygl(rs.getDouble("pygl"));
  4677 + mr.setLjgl(rs.getDouble("ljgl"));
  4678 + mr.setZrwgl(rs.getDouble("zrwgl"));
  4679 + mr.setOther(rs.getString("other"));
  4680 + return mr;
  4681 + }
  4682 + });
  4683 + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
  4684 + double sjyygl = 0.0;
  4685 + double sjksgl = 0.0;
  4686 + double zgl = 0.0;
  4687 + double sddfgl = 0.0;
  4688 + double zddfgl = 0.0;
  4689 + double wqwxhgl = 0.0;
  4690 + double bfwxhgl = 0.0;
  4691 + double pygl = 0.0;
  4692 + double ljgl = 0.0;
  4693 + double zrwgl = 0.0;
  4694 + for(MileageReport mr:list) {
  4695 + Map<String, Object> resMap = new HashMap<String, Object>();
  4696 + resMap.put("gsName", mr.getCompanyName());
  4697 + resMap.put("fgsName", mr.getSubCompanyName());
  4698 + resMap.put("xlName", mr.getLineName());
  4699 + resMap.put("sjyygl", mr.getSjyygl());
  4700 + resMap.put("sjksgl", mr.getSjksgl());
  4701 + resMap.put("zgl", mr.getZgl());
  4702 + resMap.put("sddfgl", mr.getSddfgl());
  4703 + resMap.put("zddfgl", mr.getZddfgl());
  4704 + resMap.put("wqwxhgl", mr.getWqwxhgl());
  4705 + resMap.put("bfwxhgl", mr.getBfwxhgl());
  4706 + resMap.put("pygl", mr.getPygl());
  4707 + resMap.put("ljgl", mr.getLjgl());
  4708 + resMap.put("zrwgl", mr.getZrwgl());
  4709 + resMap.put("other", mr.getOther());
  4710 + lMap.add(resMap);
  4711 + sjyygl = Arith.add(sjyygl,mr.getSjyygl());
  4712 + sjksgl = Arith.add(sjksgl,mr.getSjksgl());
  4713 + zgl = Arith.add(zgl,mr.getZgl());
  4714 + sddfgl = Arith.add(sddfgl,mr.getSddfgl());
  4715 + zddfgl = Arith.add(zddfgl,mr.getZddfgl());
  4716 + wqwxhgl = Arith.add(wqwxhgl,mr.getWqwxhgl());
  4717 + bfwxhgl = Arith.add(bfwxhgl,mr.getBfwxhgl());
  4718 + pygl = Arith.add(pygl,mr.getPygl());
  4719 + ljgl = Arith.add(ljgl,mr.getLjgl());
  4720 + zrwgl = Arith.add(zrwgl,mr.getZrwgl());
  4721 + }
  4722 + Map<String, Object> resMap = new HashMap<String, Object>();
  4723 + resMap.put("xlName", "合计");
  4724 + resMap.put("sjyygl", sjyygl);
  4725 + resMap.put("sjksgl", sjksgl);
  4726 + resMap.put("zgl", zgl);
  4727 + resMap.put("sddfgl", sddfgl);
  4728 + resMap.put("zddfgl", zddfgl);
  4729 + resMap.put("wqwxhgl", wqwxhgl);
  4730 + resMap.put("bfwxhgl", bfwxhgl);
  4731 + resMap.put("pygl", pygl);
  4732 + resMap.put("ljgl", ljgl);
  4733 + resMap.put("zrwgl", zrwgl);
  4734 + resMap.put("other", null);
  4735 + lMap.add(resMap);
  4736 + return lMap;
  4737 + }
  4738 +
  4739 + @Override
  4740 + public List<Map<String, Object>> scheduleCorrectionReport(String gsdm,
  4741 + String fgsdm, String line, String date, String date2) {
  4742 +
  4743 + String sql = "select * from calc_schedule where 1=1 " ;
  4744 + if (!line.equals(" ")) {
  4745 + sql = sql+" and line_code='"+ line+"' ";
  4746 + }
  4747 + sql = sql+" and DATE_FORMAT(rq,'%Y-%m-%d') between '"+ date+"' and '"+ date2+"'";
  4748 + if (!gsdm.equals(" ")) {
  4749 + sql = sql+" and company_id="+gsdm;
  4750 + }
  4751 + if (!gsdm.equals(" ")) {
  4752 + sql = sql+" and sub_company_id="+fgsdm;
  4753 + }
  4754 + sql = sql+" order by line_code";
  4755 + List<ScheduleCorrectionReport> list = jdbcTemplate.query(sql,
  4756 + new RowMapper<ScheduleCorrectionReport>() {
  4757 + @Override
  4758 + public ScheduleCorrectionReport mapRow(ResultSet rs, int rowNum) throws SQLException {
  4759 + ScheduleCorrectionReport sReport = new ScheduleCorrectionReport();
  4760 + sReport.setCompanyName(rs.getString("company_name"));
  4761 + sReport.setSubCompanyName(rs.getString("sub_company_name"));
  4762 + sReport.setLineName(rs.getString("line_name"));
  4763 + sReport.setSjyybc(rs.getInt("sjyybc"));
  4764 + sReport.setSjksbc(rs.getInt("sjksbc"));
  4765 + sReport.setZbc(rs.getInt("zyybc"));
  4766 + sReport.setZddfbc(rs.getInt("zddfbc"));
  4767 + sReport.setSddfbc(rs.getInt("sddfbc"));
  4768 + sReport.setWqwxhbc(rs.getInt("wqwxhbc"));
  4769 + sReport.setBfwxhbc(rs.getInt("bfwxhbc"));
  4770 + sReport.setPybc(rs.getInt("pybc"));
  4771 + sReport.setLjbc(rs.getInt("ljbc"));
  4772 + sReport.setZrwbc(rs.getInt("zrwbc"));
  4773 + sReport.setOther(rs.getString("other"));
  4774 + return sReport;
  4775 + }
  4776 + });
  4777 + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
  4778 + int sjyybc = 0;
  4779 + int sjksbc = 0;
  4780 + int zbc = 0;
  4781 + int sddfbc = 0;
  4782 + int zddfbc = 0;
  4783 + int wqwxhbc = 0;
  4784 + int bfwxhbc = 0;
  4785 + int pybc = 0;
  4786 + int ljbc = 0;
  4787 + int zrwbc = 0;
  4788 + for(ScheduleCorrectionReport sReport:list) {
  4789 + Map<String, Object> resMap = new HashMap<String, Object>();
  4790 + resMap.put("gsName", sReport.getCompanyName());
  4791 + resMap.put("fgsName", sReport.getSubCompanyName());
  4792 + resMap.put("xlName", sReport.getLineName());
  4793 + resMap.put("sjyybc", sReport.getSjyybc());
  4794 + resMap.put("sjksbc", sReport.getSjksbc());
  4795 + resMap.put("zbc", sReport.getZbc());
  4796 + resMap.put("sddfbc", sReport.getSddfbc());
  4797 + resMap.put("zddfbc", sReport.getZddfbc());
  4798 + resMap.put("wqwxhbc", sReport.getWqwxhbc());
  4799 + resMap.put("bfwxhbc", sReport.getBfwxhbc());
  4800 + resMap.put("pybc", sReport.getPybc());
  4801 + resMap.put("ljbc", sReport.getLjbc());
  4802 + resMap.put("zrwbc", sReport.getZrwbc());
  4803 + resMap.put("other", sReport.getOther());
  4804 + lMap.add(resMap);
  4805 + sjyybc = sjyybc + sReport.getSjyybc();
  4806 + sjksbc = sjksbc + sReport.getSjksbc();
  4807 + zbc = zbc + sReport.getZbc();
  4808 + sddfbc = sddfbc + sReport.getSddfbc();
  4809 + zddfbc = zddfbc + sReport.getZddfbc();
  4810 + wqwxhbc = wqwxhbc + sReport.getWqwxhbc();
  4811 + bfwxhbc = bfwxhbc + sReport.getBfwxhbc();
  4812 + pybc = pybc + sReport.getPybc();
  4813 + ljbc = ljbc + sReport.getLjbc();
  4814 + zrwbc = zrwbc + sReport.getZrwbc();
  4815 + }
  4816 + Map<String, Object> resMap = new HashMap<String, Object>();
  4817 + resMap.put("xlName", "合计");
  4818 + resMap.put("sjyybc", sjyybc);
  4819 + resMap.put("sjksbc", sjksbc);
  4820 + resMap.put("zbc", zbc);
  4821 + resMap.put("sddfbc", sddfbc);
  4822 + resMap.put("zddfbc", zddfbc);
  4823 + resMap.put("wqwxhbc", wqwxhbc);
  4824 + resMap.put("bfwxhbc", bfwxhbc);
  4825 + resMap.put("pybc", pybc);
  4826 + resMap.put("ljbc", ljbc);
  4827 + resMap.put("zrwbc", zrwbc);
  4828 + resMap.put("other", null);
  4829 + lMap.add(resMap);
  4830 + return lMap;
  4831 + }
4640 4832 }
4641 4833  
4642 4834 class AccountMap implements Comparator<Map<String, Object>>{
... ...
src/main/java/com/bsth/service/report/CulateMileageService.java
... ... @@ -30,6 +30,8 @@ public interface CulateMileageService {
30 30  
31 31 int culateFzbc(List<ScheduleRealInfo> lists,String item);
32 32  
  33 + Map<String, Object> culateDjg(List<ScheduleRealInfo> lists,String line);
  34 +
33 35  
34 36  
35 37 //以下计算方法供新报表使用
... ...
src/main/java/com/bsth/service/report/ReportService.java
... ... @@ -17,6 +17,8 @@ public interface ReportService {
17 17 List<ArrivalInfo> queryListClzd(String line,String zd,String zdlx,String fcsj,String ddsj);
18 18 List<StationRoute> queryStrinon(String line,int zd);
19 19 List<Map<String, Object>> queryInOutStrtion(String line,String date,int zd,String lzsj);
  20 +
  21 + List<Map<String, Object>> queryInOutStrtions(String line,String date,int zd,String lzsj);
20 22 List<Map<String, String>> sreachZd(String line,int zdlx);
21 23  
22 24 List<Object[]> historyMessageCount(String line, String date, String code);
... ...
src/main/java/com/bsth/service/report/impl/CulateMileageServiceImpl.java
1 1 package com.bsth.service.report.impl;
2 2  
  3 +import java.sql.ResultSet;
  4 +import java.sql.SQLException;
  5 +import java.text.DecimalFormat;
  6 +import java.text.ParseException;
  7 +import java.text.SimpleDateFormat;
3 8 import java.util.ArrayList;
4 9 import java.util.Collections;
5 10 import java.util.HashMap;
... ... @@ -9,18 +14,26 @@ import java.util.Map;
9 14 import java.util.Set;
10 15  
11 16 import org.apache.commons.lang.StringUtils;
  17 +import org.springframework.beans.factory.annotation.Autowired;
  18 +import org.springframework.jdbc.core.JdbcTemplate;
  19 +import org.springframework.jdbc.core.RowMapper;
12 20 import org.springframework.stereotype.Service;
13 21  
  22 +import com.bsth.data.BasicData;
14 23 import com.bsth.entity.realcontrol.ChildTaskPlan;
15 24 import com.bsth.entity.realcontrol.ScheduleRealInfo;
  25 +import com.bsth.entity.sys.Interval;
16 26 import com.bsth.service.report.CulateMileageService;
17 27 import com.bsth.util.Arith;
  28 +import com.bsth.util.ComparableChild;
18 29 import com.bsth.util.ComparableJob;
  30 +import com.bsth.util.ReportUtils;
19 31 import com.google.common.util.concurrent.AbstractScheduledService.Scheduler;
20 32  
21 33 @Service
22 34 public class CulateMileageServiceImpl implements CulateMileageService{
23   -
  35 + @Autowired
  36 + JdbcTemplate jdbcTemplate;
24 37 private static long zgf1 = 6 * 60 + 31,
25 38 zgf2 = 8 * 60 + 30,
26 39 wgf1 = 16 * 60 + 1,
... ... @@ -943,6 +956,214 @@ public class CulateMileageServiceImpl implements CulateMileageService{
943 956 }
944 957 return kfks;
945 958 }
  959 +
  960 + @Override
  961 + public Map<String, Object> culateDjg(List<ScheduleRealInfo> lists, String line) {
  962 + // TODO Auto-generated method stub
  963 +
  964 +
  965 + // TODO Auto-generated method stub
  966 + List<ScheduleRealInfo> list=lists;
  967 + Map<String, Object> m=new HashMap<String,Object>();
  968 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
  969 +// Collections.sort(listInfo,new ComparableAcuals());
  970 + //查询所有线路
  971 + String xlSql="select line_code,spac_grade from bsth_c_line"
  972 + + " where line_code ='"+line+"'";
  973 +
  974 + List<Map<String, Object>> xlList=jdbcTemplate.query(xlSql, new RowMapper<Map<String, Object>>() {
  975 + @Override
  976 + public Map<String, Object> mapRow(ResultSet arg0, int arg1) throws SQLException {
  977 + Map<String, Object> map=new HashMap<String,Object>();
  978 + map.put("line",arg0.getString("line_code"));
  979 + map.put("grade", arg0.getString("spac_grade"));
  980 + return map;
  981 + }
  982 + });
  983 + //查询大间隔时间
  984 + String djgSql="select * from bsth_c_interval";
  985 + List<Interval> djgList=jdbcTemplate.query(djgSql, new RowMapper<Interval>() {
  986 + @Override
  987 + public Interval mapRow(ResultSet arg0, int arg1) throws SQLException {
  988 + Interval m=new Interval();
  989 + m.setLevel(arg0.getString("level"));
  990 + m.setPeak(arg0.getInt("peak"));
  991 + m.setTrough(arg0.getInt("trough"));
  992 + return m;
  993 + }
  994 + });
  995 +
  996 + for (int i = 0; i < xlList.size(); i++) {
  997 + String lineCode=xlList.get(i).get("line").toString();
  998 + String grade =xlList.get(i).get("grade")==null?"1":xlList.get(i).get("grade").toString();
  999 + int peak=0;
  1000 + int trough=0;
  1001 + for (int j = 0; j < djgList.size(); j++) {
  1002 + Interval il=djgList.get(j);
  1003 + if(il.getLevel().equals(grade)){
  1004 + peak=il.getPeak();
  1005 + trough=il.getTrough();
  1006 + continue;
  1007 + }
  1008 + }
  1009 + List<ScheduleRealInfo> listInfo=new ArrayList<ScheduleRealInfo>();
  1010 + for (int j = 0; j < list.size(); j++) {
  1011 + ScheduleRealInfo sinfo=list.get(j);
  1012 + try {
  1013 + if(sinfo.getXlBm().equals(lineCode)){
  1014 + ScheduleRealInfo s=checkBc(sinfo);
  1015 + String fcsj=s.getFcsjActual()==null?"":s.getFcsjActual();
  1016 + if(!fcsj.equals("")){
  1017 + Long fcsjAcual = sdf.parse(s.getRealExecDate() + " " + s.getFcsjActual()).getTime();
  1018 + s.setFcsjActualTime(fcsjAcual);
  1019 + s.setFcsjActual(fcsj);
  1020 + listInfo.add(s);
  1021 + }
  1022 +
  1023 + }
  1024 + } catch (ParseException e) {
  1025 + // TODO Auto-generated catch block
  1026 + e.printStackTrace();
  1027 + }
  1028 + }
  1029 +
  1030 + if(listInfo.size()>0){
  1031 + m=listDjg(peak,trough,listInfo,grade);
  1032 + }else{
  1033 + m.put("djgcsz", "0");
  1034 + m.put("djgcsw", "0");
  1035 + m.put("djgcsq", "0");
  1036 + m.put("djgsj", "0");
  1037 + }
  1038 + }
  1039 + return m;
  1040 +
  1041 + }
  1042 +
  1043 + public ScheduleRealInfo checkBc(ScheduleRealInfo s){
  1044 + //如果班次有子任务 且 子任务中有属于营运的。把该子任务的发车时间设置成班次的发车时间
  1045 + String fcsj=s.getFcsjActual()==null?"":s.getFcsjActual();
  1046 + if(fcsj.equals("")){
  1047 + Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
  1048 + if(!childTaskPlans.isEmpty()){
  1049 + List<ChildTaskPlan> listit=new ArrayList<ChildTaskPlan>(childTaskPlans);
  1050 + Collections.sort(listit, new ComparableChild());
  1051 + for (int i = 0; i < listit.size(); i++) {
  1052 + ChildTaskPlan c=listit.get(i);
  1053 + if(!c.isDestroy()){
  1054 + if(c.getMileageType().equals("service")){
  1055 + s.setFcsjActual(c.getStartDate());
  1056 + break;
  1057 + }
  1058 +
  1059 + }
  1060 + }
  1061 + }
  1062 + }
  1063 + return s;
  1064 + }
946 1065  
  1066 + public Map<String, Object> listDjg(int peak,int trough,List<ScheduleRealInfo> listInfo,String grade){
  1067 + DecimalFormat df = new DecimalFormat("#0.00");
  1068 + Collections.sort(listInfo,new ComparableAcuals());
  1069 + List<ScheduleRealInfo> listInfo0=new ArrayList<ScheduleRealInfo>();
  1070 + List<ScheduleRealInfo> listInfo1=new ArrayList<ScheduleRealInfo>();
  1071 + for (int i = 0; i < listInfo.size(); i++) {
  1072 + ScheduleRealInfo s=listInfo.get(i);
  1073 + if(s.getXlDir().equals("0")){
  1074 + listInfo0.add(s);
  1075 + }else{
  1076 + listInfo0.add(s);
  1077 + }
  1078 +
  1079 + }
  1080 + Map<String, Object> map=new HashMap<String,Object>();
  1081 + int djgcsz=0;
  1082 + int djgcsw=0;
  1083 + int djgcsq=0;
  1084 + long djcsj=0l;
  1085 + for (int i = 0; i < listInfo0.size(); i++) {
  1086 + ScheduleRealInfo s=listInfo.get(i);
  1087 + Long fcsjTime=s.getFcsjActualTime();
  1088 + String time=s.getFcsjActual();
  1089 + String[] fcsjStr = time.split(":");
  1090 + long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
  1091 + if(i<listInfo.size()-1){
  1092 + Long djg=0l;
  1093 + Long fscjNext=listInfo.get(i+1).getFcsjActualTime();
  1094 + if((fcsj>=zgf1&&fcsj<=zgf2)){
  1095 + djg = (long) (peak*60*1000);
  1096 + if(fscjNext-fcsjTime>djg){
  1097 + djgcsz ++;
  1098 + djgcsq ++;
  1099 + if(fscjNext-fcsjTime>djcsj){
  1100 + djcsj=(fscjNext-fcsjTime)/1000;
  1101 + }
  1102 + }
  1103 + }else if((fcsj>=wgf1&&fcsj<=wgf2)){
  1104 + djg = (long) (peak*60*1000);
  1105 + if(fscjNext-fcsjTime>djg){
  1106 + djgcsw ++;
  1107 + djgcsq ++;
  1108 + if(fscjNext-fcsjTime>djcsj){
  1109 + djcsj=(fscjNext-fcsjTime)/1000;
  1110 + }
  1111 + }
  1112 + }else{
  1113 + djg = (long) (trough*60*1000);
  1114 + if(fscjNext-fcsjTime>djg){
  1115 + djgcsq ++;
  1116 + if(fscjNext-fcsjTime>djcsj){
  1117 + djcsj=(fscjNext-fcsjTime)/1000;
  1118 + }
  1119 + }
  1120 + }
  1121 + }
  1122 + }
  1123 + for (int i = 0; i < listInfo1.size(); i++) {
  1124 + ScheduleRealInfo s=listInfo.get(i);
  1125 + Long fcsjTime=s.getFcsjActualTime();
  1126 + String time=s.getFcsjActual();
  1127 + String[] fcsjStr = time.split(":");
  1128 + long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
  1129 + if(i<listInfo.size()-1){
  1130 + Long djg=0l;
  1131 + Long fscjNext=listInfo.get(i+1).getFcsjActualTime();
  1132 + if(fcsj>=zgf1&&fcsj<=zgf2){
  1133 + djg = (long) (peak*60*1000);
  1134 + if(fscjNext-fcsjTime>djg){
  1135 + djgcsz ++;
  1136 + djgcsq ++;
  1137 + if(fscjNext-fcsjTime>djcsj){
  1138 + djcsj=(fscjNext-fcsjTime)/1000;
  1139 + }
  1140 + }
  1141 + }else if(fcsj>=wgf1&&fcsj<=wgf2){
  1142 + djg = (long) (peak*60*1000);
  1143 + if(fscjNext-fcsjTime>djg){
  1144 + djgcsw ++;
  1145 + djgcsq ++;
  1146 + if(fscjNext-fcsjTime>djcsj){
  1147 + djcsj=(fscjNext-fcsjTime)/1000;
  1148 + }
  1149 + }
  1150 + }else{
  1151 + djg = (long) (trough*60*1000);
  1152 + if(fscjNext-fcsjTime>djg){
  1153 + djgcsq ++;
  1154 + if(fscjNext-fcsjTime>djcsj){
  1155 + djcsj=(fscjNext-fcsjTime)/1000;
  1156 + }
  1157 + }
  1158 + }
  1159 + }
  1160 + }
  1161 +
  1162 + map.put("djgcsz", djgcsz);
  1163 + map.put("djgcsw", djgcsw);
  1164 + map.put("djgcsq", djgcsq);
  1165 + map.put("djgsj", djcsj);
  1166 + return map;
  1167 + }
947 1168  
948 1169 }
... ...