Commit 81631d6d0446f30731b71a293b9b043e5461a0eb
Merge branch 'minhang' of http://222.66.0.204:8090//panzhaov5/bsth_control into minhang
Showing
32 changed files
with
3148 additions
and
912 deletions
Too many changes to show.
To preserve performance only 32 of 52 files are displayed.
src/main/java/com/bsth/XDApplication.java
| @@ -6,6 +6,7 @@ import com.bsth.data.car_out_info.UpdateDBThread; | @@ -6,6 +6,7 @@ import com.bsth.data.car_out_info.UpdateDBThread; | ||
| 6 | import com.bsth.data.directive.DirectivesPstThread; | 6 | import com.bsth.data.directive.DirectivesPstThread; |
| 7 | import com.bsth.data.gpsdata.thread.GpsDataLoaderThread; | 7 | import com.bsth.data.gpsdata.thread.GpsDataLoaderThread; |
| 8 | import com.bsth.data.gpsdata.thread.OfflineMonitorThread; | 8 | import com.bsth.data.gpsdata.thread.OfflineMonitorThread; |
| 9 | +import com.bsth.data.schedule.edit_logs.SeiPstThread; | ||
| 9 | import com.bsth.data.schedule.late_adjust.ScheduleLateThread; | 10 | import com.bsth.data.schedule.late_adjust.ScheduleLateThread; |
| 10 | import com.bsth.data.schedule.thread.CalcOilThread; | 11 | import com.bsth.data.schedule.thread.CalcOilThread; |
| 11 | import com.bsth.data.schedule.thread.SchedulePstThread; | 12 | import com.bsth.data.schedule.thread.SchedulePstThread; |
| @@ -53,6 +54,8 @@ public class XDApplication implements CommandLineRunner { | @@ -53,6 +54,8 @@ public class XDApplication implements CommandLineRunner { | ||
| 53 | DirectivesPstThread directivesPstThread; | 54 | DirectivesPstThread directivesPstThread; |
| 54 | @Autowired | 55 | @Autowired |
| 55 | ThreadMonotor threadMonotor; | 56 | ThreadMonotor threadMonotor; |
| 57 | + @Autowired | ||
| 58 | + SeiPstThread seiPstThread; | ||
| 56 | 59 | ||
| 57 | private static long timeDiff; | 60 | private static long timeDiff; |
| 58 | 61 | ||
| @@ -93,6 +96,8 @@ public class XDApplication implements CommandLineRunner { | @@ -93,6 +96,8 @@ public class XDApplication implements CommandLineRunner { | ||
| 93 | //sexec.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS); | 96 | //sexec.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS); |
| 94 | //实际排班延迟入库线程 | 97 | //实际排班延迟入库线程 |
| 95 | //sexec.scheduleWithFixedDelay(schedulePstThread, 60, 15, TimeUnit.SECONDS); | 98 | //sexec.scheduleWithFixedDelay(schedulePstThread, 60, 15, TimeUnit.SECONDS); |
| 99 | + //班次修正日志延迟入库 | ||
| 100 | + //sexec.scheduleWithFixedDelay(seiPstThread, 60, 30, TimeUnit.SECONDS); | ||
| 96 | 101 | ||
| 97 | //线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | 102 | //线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) |
| 98 | //sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS); | 103 | //sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS); |
| @@ -107,10 +112,12 @@ public class XDApplication implements CommandLineRunner { | @@ -107,10 +112,12 @@ public class XDApplication implements CommandLineRunner { | ||
| 107 | sexec.scheduleWithFixedDelay(gpsDataLoader, 30, 2, TimeUnit.SECONDS); | 112 | sexec.scheduleWithFixedDelay(gpsDataLoader, 30, 2, TimeUnit.SECONDS); |
| 108 | //GPS设备掉离线 | 113 | //GPS设备掉离线 |
| 109 | sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS); | 114 | sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS); |
| 110 | - //实际排班更新线程 | 115 | + //班次更新线程 |
| 111 | sexec.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS); | 116 | sexec.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS); |
| 112 | - //实际排班延迟入库线程 | ||
| 113 | - sexec.scheduleWithFixedDelay(schedulePstThread, 60, 15, TimeUnit.SECONDS); | 117 | + //班次延迟入库线程 |
| 118 | + sexec.scheduleWithFixedDelay(schedulePstThread, 60, 10, TimeUnit.SECONDS); | ||
| 119 | + //班次修正日志延迟入库 | ||
| 120 | + sexec.scheduleWithFixedDelay(seiPstThread, 60, 60, TimeUnit.SECONDS); | ||
| 114 | //检查班次误点 | 121 | //检查班次误点 |
| 115 | sexec.scheduleWithFixedDelay(scheduleLateThread, 60, 30, TimeUnit.SECONDS); | 122 | sexec.scheduleWithFixedDelay(scheduleLateThread, 60, 30, TimeUnit.SECONDS); |
| 116 | //调度指令延迟入库 | 123 | //调度指令延迟入库 |
src/main/java/com/bsth/controller/realcontrol/SchEditInfoController.java
0 → 100644
| 1 | +package com.bsth.controller.realcontrol; | ||
| 2 | + | ||
| 3 | +import com.bsth.controller.BaseController; | ||
| 4 | +import com.bsth.data.schedule.edit_logs.entity.SchEditInfo; | ||
| 5 | +import com.bsth.data.schedule.edit_logs.service.SchEditInfoService; | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 10 | +import org.springframework.web.bind.annotation.RestController; | ||
| 11 | + | ||
| 12 | +import java.util.Map; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * 班次修正记录 | ||
| 16 | + * Created by panzhao on 2017/5/22. | ||
| 17 | + */ | ||
| 18 | +@RestController | ||
| 19 | +@RequestMapping("schEditInfo") | ||
| 20 | +public class SchEditInfoController extends BaseController<SchEditInfo, Long>{ | ||
| 21 | + | ||
| 22 | + @Autowired | ||
| 23 | + SchEditInfoService editInfoService; | ||
| 24 | + | ||
| 25 | + @RequestMapping(value = "/_list", method = RequestMethod.GET) | ||
| 26 | + public Map<String, Object> _list(@RequestParam String rq, @RequestParam String lineCode,@RequestParam Map<String, String> map) { | ||
| 27 | + return editInfoService._list(rq, lineCode, map); | ||
| 28 | + } | ||
| 29 | +} |
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| @@ -433,10 +433,12 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -433,10 +433,12 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 433 | * @return | 433 | * @return |
| 434 | */ | 434 | */ |
| 435 | @RequestMapping("dateArray") | 435 | @RequestMapping("dateArray") |
| 436 | - public List<String> dateArray(){ | 436 | + public List<String> dateArray(@RequestParam(defaultValue = "0") int c){ |
| 437 | List<String> rs = new ArrayList<>(); | 437 | List<String> rs = new ArrayList<>(); |
| 438 | 438 | ||
| 439 | - long t = new Date().getTime() - ONE_DAY - (1000 * 60 * 60 * 2); | 439 | + long t = new Date().getTime(); |
| 440 | + if(c != 1) | ||
| 441 | + t -= ONE_DAY - (1000 * 60 * 60 * 2); | ||
| 440 | for(int i = 0; i < 10; i ++){ | 442 | for(int i = 0; i < 10; i ++){ |
| 441 | rs.add(fmtyyyyMMdd.print(t)); | 443 | rs.add(fmtyyyyMMdd.print(t)); |
| 442 | t -= ONE_DAY; | 444 | t -= ONE_DAY; |
src/main/java/com/bsth/controller/report/SheetController.java
0 → 100644
| 1 | +package com.bsth.controller.report; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 10 | +import org.springframework.web.bind.annotation.RestController; | ||
| 11 | + | ||
| 12 | +import com.bsth.controller.BaseController; | ||
| 13 | +import com.bsth.entity.sheet.Sheet; | ||
| 14 | +import com.bsth.service.report.SheetService; | ||
| 15 | + | ||
| 16 | +@RestController | ||
| 17 | +@RequestMapping("sheet") | ||
| 18 | +public class SheetController extends BaseController<Sheet, Integer>{ | ||
| 19 | + @Autowired | ||
| 20 | + SheetService sheetService; | ||
| 21 | + @RequestMapping(value = "/saveListSheet",method = RequestMethod.POST) | ||
| 22 | + public String saveListSheet(){ | ||
| 23 | + String result=""; | ||
| 24 | + try { | ||
| 25 | + result = sheetService.saveSheetList(); | ||
| 26 | + } catch (Exception e) { | ||
| 27 | + // TODO Auto-generated catch block | ||
| 28 | + e.printStackTrace(); | ||
| 29 | + } | ||
| 30 | + return result; | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + | ||
| 34 | + @RequestMapping(value = "/sheetList",method = RequestMethod.GET) | ||
| 35 | + public List<Sheet> sheetList(@RequestParam Integer id){ | ||
| 36 | + List<Sheet> list=sheetService.sheetList(id); | ||
| 37 | + return list; | ||
| 38 | + } | ||
| 39 | + @RequestMapping(value = "/countList",method = RequestMethod.GET) | ||
| 40 | + public List<Map<String, Object>> countList(@RequestParam Map<String, Object> map){ | ||
| 41 | + List<Map<String, Object>> list=sheetService.countList(map); | ||
| 42 | + return list; | ||
| 43 | + } | ||
| 44 | +} |
src/main/java/com/bsth/data/safe_driv/SafeDrivCenter.java
| 1 | package com.bsth.data.safe_driv; | 1 | package com.bsth.data.safe_driv; |
| 2 | 2 | ||
| 3 | -import com.bsth.Application; | ||
| 4 | import com.bsth.websocket.handler.SendUtils; | 3 | import com.bsth.websocket.handler.SendUtils; |
| 5 | import org.joda.time.format.DateTimeFormat; | 4 | import org.joda.time.format.DateTimeFormat; |
| 6 | import org.joda.time.format.DateTimeFormatter; | 5 | import org.joda.time.format.DateTimeFormatter; |
| @@ -15,7 +14,6 @@ import java.util.HashMap; | @@ -15,7 +14,6 @@ import java.util.HashMap; | ||
| 15 | import java.util.HashSet; | 14 | import java.util.HashSet; |
| 16 | import java.util.Map; | 15 | import java.util.Map; |
| 17 | import java.util.Set; | 16 | import java.util.Set; |
| 18 | -import java.util.concurrent.TimeUnit; | ||
| 19 | 17 | ||
| 20 | /** | 18 | /** |
| 21 | * 安全驾驶 | 19 | * 安全驾驶 |
| @@ -69,7 +67,7 @@ public class SafeDrivCenter implements CommandLineRunner,ApplicationContextAware | @@ -69,7 +67,7 @@ public class SafeDrivCenter implements CommandLineRunner,ApplicationContextAware | ||
| 69 | @Override | 67 | @Override |
| 70 | public void run(String... strings) throws Exception { | 68 | public void run(String... strings) throws Exception { |
| 71 | //定时加载安全驾驶数据 | 69 | //定时加载安全驾驶数据 |
| 72 | - Application.mainServices.scheduleWithFixedDelay(safeDrivDataLoadThread, 60, 7, TimeUnit.SECONDS); | 70 | + //Application.mainServices.scheduleWithFixedDelay(safeDrivDataLoadThread, 80, 7, TimeUnit.SECONDS); |
| 73 | } | 71 | } |
| 74 | 72 | ||
| 75 | @Override | 73 | @Override |
src/main/java/com/bsth/data/schedule/edit_logs/FormLogger.java
| 1 | -package com.bsth.data.schedule.edit_logs; | ||
| 2 | - | ||
| 3 | -import com.bsth.controller.realcontrol.dto.ChangePersonCar; | ||
| 4 | -import com.bsth.entity.mcy_forms.Changetochange; | ||
| 5 | -import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 6 | -import com.bsth.entity.sys.SysUser; | ||
| 7 | -import com.bsth.repository.form.ChangetochangeRepository; | ||
| 8 | -import com.bsth.security.util.SecurityUtils; | ||
| 9 | -import org.apache.commons.lang3.StringUtils; | ||
| 10 | -import org.joda.time.format.DateTimeFormat; | ||
| 11 | -import org.joda.time.format.DateTimeFormatter; | ||
| 12 | -import org.slf4j.Logger; | ||
| 13 | -import org.slf4j.LoggerFactory; | ||
| 14 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 15 | -import org.springframework.stereotype.Service; | ||
| 16 | - | ||
| 17 | -import java.util.Date; | ||
| 18 | - | ||
| 19 | -/** | ||
| 20 | - * 为报表写入相关的班次修改记录 | ||
| 21 | - * Created by panzhao on 2017/5/7. | ||
| 22 | - */ | ||
| 23 | -@Service | ||
| 24 | -public class FormLogger { | ||
| 25 | - | ||
| 26 | - private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm"); | ||
| 27 | - | ||
| 28 | - Logger log = LoggerFactory.getLogger(this.getClass()); | ||
| 29 | - | ||
| 30 | - @Autowired | ||
| 31 | - ChangetochangeRepository changetochangeRepository; | ||
| 32 | - | ||
| 33 | - /** | ||
| 34 | - * 换人换车情况表 | ||
| 35 | - */ | ||
| 36 | - public void saveChangetochange(ScheduleRealInfo sch, ChangePersonCar cpc){ | ||
| 37 | - try { | ||
| 38 | - String newNbbm = cpc.getClZbh(); | ||
| 39 | - String newJsy = cpc.getJsy(); | ||
| 40 | - String oldJsy = sch.getjGh()+"/"+sch.getjName(); | ||
| 41 | - | ||
| 42 | - if(newNbbm == null && newJsy == null) | ||
| 43 | - return; | ||
| 44 | - | ||
| 45 | - if(newNbbm != null && newJsy != null | ||
| 46 | - && newNbbm.equals(sch.getClZbh()) && newJsy.equals(oldJsy)) | ||
| 47 | - return; | ||
| 48 | - | ||
| 49 | - Date d = new Date(); | ||
| 50 | - SysUser user = SecurityUtils.getCurrentUser(); | ||
| 51 | - Changetochange cc = new Changetochange(); | ||
| 52 | - cc.setRq(sch.getScheduleDateStr()); | ||
| 53 | - cc.setGs(sch.getGsBm()); | ||
| 54 | - cc.setFgs(sch.getFgsBm()); | ||
| 55 | - cc.setXl(sch.getXlBm()); | ||
| 56 | - cc.setLp(sch.getLpName()); | ||
| 57 | - cc.setFssj(fmtHHmm.print(d.getTime())); | ||
| 58 | - cc.setXgsj(fmtHHmm.print(d.getTime())); | ||
| 59 | - if(user != null) | ||
| 60 | - cc.setXgr(user.getUserName()); | ||
| 61 | - | ||
| 62 | - cc.setPcch(sch.getClZbh()); | ||
| 63 | - cc.setPcry(oldJsy); | ||
| 64 | - cc.setJhch(sch.getClZbh()); | ||
| 65 | - cc.setJhgh(sch.getjGh()); | ||
| 66 | - | ||
| 67 | - if(StringUtils.isNotEmpty(newNbbm)) | ||
| 68 | - cc.setSjch(newNbbm); | ||
| 69 | - if(StringUtils.isNotEmpty(newJsy)) | ||
| 70 | - cc.setSjgh(newJsy); | ||
| 71 | - | ||
| 72 | - changetochangeRepository.save(cc); | ||
| 73 | - }catch (Exception e){ | ||
| 74 | - log.error("纪录换人换车情况表", e); | ||
| 75 | - } | ||
| 76 | - } | ||
| 77 | - | ||
| 78 | - public void saveChangetochange(ScheduleRealInfo sch, String nbbm, String jsy){ | ||
| 79 | - ChangePersonCar cpc = new ChangePersonCar(); | ||
| 80 | - cpc.setClZbh(nbbm); | ||
| 81 | - cpc.setJsy(jsy); | ||
| 82 | - saveChangetochange(sch, cpc); | ||
| 83 | - } | ||
| 84 | -} | 1 | +package com.bsth.data.schedule.edit_logs; |
| 2 | + | ||
| 3 | +import com.bsth.controller.realcontrol.dto.ChangePersonCar; | ||
| 4 | +import com.bsth.entity.mcy_forms.Changetochange; | ||
| 5 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 6 | +import com.bsth.entity.sys.SysUser; | ||
| 7 | +import com.bsth.repository.form.ChangetochangeRepository; | ||
| 8 | +import com.bsth.security.util.SecurityUtils; | ||
| 9 | +import org.apache.commons.lang3.StringUtils; | ||
| 10 | +import org.joda.time.format.DateTimeFormat; | ||
| 11 | +import org.joda.time.format.DateTimeFormatter; | ||
| 12 | +import org.slf4j.Logger; | ||
| 13 | +import org.slf4j.LoggerFactory; | ||
| 14 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 15 | +import org.springframework.stereotype.Service; | ||
| 16 | + | ||
| 17 | +import java.util.Date; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * 为报表写入相关的班次修改记录 | ||
| 21 | + * Created by panzhao on 2017/5/7. | ||
| 22 | + */ | ||
| 23 | +@Service | ||
| 24 | +public class FormLogger { | ||
| 25 | + | ||
| 26 | + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm"); | ||
| 27 | + | ||
| 28 | + Logger log = LoggerFactory.getLogger(this.getClass()); | ||
| 29 | + | ||
| 30 | + @Autowired | ||
| 31 | + ChangetochangeRepository changetochangeRepository; | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * 换人换车情况表 | ||
| 35 | + */ | ||
| 36 | + public void saveChangetochange(ScheduleRealInfo sch, ChangePersonCar cpc){ | ||
| 37 | + try { | ||
| 38 | + String newNbbm = cpc.getClZbh(); | ||
| 39 | + String newJsy = cpc.getJsy(); | ||
| 40 | + String oldJsy = sch.getjGh()+"/"+sch.getjName(); | ||
| 41 | + | ||
| 42 | + if(newNbbm == null && newJsy == null) | ||
| 43 | + return; | ||
| 44 | + | ||
| 45 | + if(newNbbm != null && newJsy != null | ||
| 46 | + && newNbbm.equals(sch.getClZbh()) && newJsy.equals(oldJsy)) | ||
| 47 | + return; | ||
| 48 | + | ||
| 49 | + Date d = new Date(); | ||
| 50 | + SysUser user = SecurityUtils.getCurrentUser(); | ||
| 51 | + Changetochange cc = new Changetochange(); | ||
| 52 | + cc.setRq(sch.getScheduleDateStr()); | ||
| 53 | + cc.setGs(sch.getGsBm()); | ||
| 54 | + cc.setFgs(sch.getFgsBm()); | ||
| 55 | + cc.setXl(sch.getXlBm()); | ||
| 56 | + cc.setLp(sch.getLpName()); | ||
| 57 | + cc.setFssj(fmtHHmm.print(d.getTime())); | ||
| 58 | + cc.setXgsj(fmtHHmm.print(d.getTime())); | ||
| 59 | + if(user != null) | ||
| 60 | + cc.setXgr(user.getUserName()); | ||
| 61 | + | ||
| 62 | + cc.setPcch(sch.getClZbh()); | ||
| 63 | + cc.setPcry(oldJsy); | ||
| 64 | + cc.setJhch(sch.getClZbh()); | ||
| 65 | + cc.setJhgh(sch.getjGh()); | ||
| 66 | + | ||
| 67 | + if(StringUtils.isNotEmpty(newNbbm)) | ||
| 68 | + cc.setSjch(newNbbm); | ||
| 69 | + if(StringUtils.isNotEmpty(newJsy)) | ||
| 70 | + cc.setSjgh(newJsy); | ||
| 71 | + | ||
| 72 | + changetochangeRepository.save(cc); | ||
| 73 | + }catch (Exception e){ | ||
| 74 | + log.error("纪录换人换车情况表", e); | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + public void saveChangetochange(ScheduleRealInfo sch, String nbbm, String jsy){ | ||
| 79 | + ChangePersonCar cpc = new ChangePersonCar(); | ||
| 80 | + cpc.setClZbh(nbbm); | ||
| 81 | + cpc.setJsy(jsy); | ||
| 82 | + saveChangetochange(sch, cpc); | ||
| 83 | + } | ||
| 84 | +} |
src/main/java/com/bsth/data/schedule/edit_logs/ScheduleModifyLogger.java
| 1 | -package com.bsth.data.schedule.edit_logs; | ||
| 2 | - | ||
| 3 | -/** | ||
| 4 | - * 班次修正记录 | ||
| 5 | - * Created by panzhao on 2017/5/16. | ||
| 6 | - */ | ||
| 7 | -public class ScheduleModifyLogger { | ||
| 8 | - | ||
| 9 | - /** | ||
| 10 | - * 待发调整 | ||
| 11 | - */ | ||
| 12 | - public static void dftz(Long id, String remarks, String dfsj, String bcType, String opType){ | ||
| 13 | - | ||
| 14 | - } | ||
| 15 | -} | ||
| 16 | \ No newline at end of file | 1 | \ No newline at end of file |
| 2 | +package com.bsth.data.schedule.edit_logs; | ||
| 3 | + | ||
| 4 | +import com.alibaba.fastjson.JSONArray; | ||
| 5 | +import com.alibaba.fastjson.JSONObject; | ||
| 6 | +import com.bsth.controller.realcontrol.dto.ChangePersonCar; | ||
| 7 | +import com.bsth.data.schedule.edit_logs.entity.EditType; | ||
| 8 | +import com.bsth.data.schedule.edit_logs.entity.SchEditInfo; | ||
| 9 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 10 | +import org.apache.commons.lang3.StringUtils; | ||
| 11 | +import org.slf4j.Logger; | ||
| 12 | +import org.slf4j.LoggerFactory; | ||
| 13 | + | ||
| 14 | +import java.util.LinkedList; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * 班次修正记录 | ||
| 18 | + * Created by panzhao on 2017/5/16. | ||
| 19 | + */ | ||
| 20 | +public class ScheduleModifyLogger { | ||
| 21 | + | ||
| 22 | + public static LinkedList<SchEditInfo> list; | ||
| 23 | + | ||
| 24 | + static { | ||
| 25 | + list = new LinkedList<>(); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + static Logger log = LoggerFactory.getLogger(ScheduleModifyLogger.class); | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * 待发调整 | ||
| 32 | + * opType 0: 双击调整、 1:待发调整、2:批量待发调整、3:间隔调整 | ||
| 33 | + */ | ||
| 34 | + public static void dftz(ScheduleRealInfo sch, String opType, String oldDfsj, String nowDfsj, String remarks) { | ||
| 35 | + try { | ||
| 36 | + if (oldDfsj.equals(nowDfsj)) | ||
| 37 | + return; | ||
| 38 | + | ||
| 39 | + SchEditInfo sei = SchEditInfo.getInstance(sch); | ||
| 40 | + sei.setType(EditType.DFTZ); | ||
| 41 | + sei.setType2(opType); | ||
| 42 | + sei.setRemarks(remarks == null ? "" : remarks); | ||
| 43 | + | ||
| 44 | + //detail | ||
| 45 | + JSONObject jobj = new JSONObject(); | ||
| 46 | + jobj.put("old", oldDfsj); | ||
| 47 | + jobj.put("now", nowDfsj); | ||
| 48 | + | ||
| 49 | + sei.setJsonArray(jobj.toJSONString()); | ||
| 50 | + | ||
| 51 | + put(sei); | ||
| 52 | + } catch (Exception e) { | ||
| 53 | + log.error("", e); | ||
| 54 | + } | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * 发车信息微调记录器 | ||
| 59 | + */ | ||
| 60 | + public static void fcxxwt(ScheduleRealInfo sch, String remarks, JSONArray jsonArray) { | ||
| 61 | + | ||
| 62 | + try { | ||
| 63 | + if (jsonArray == null || jsonArray.size() == 0) | ||
| 64 | + return; | ||
| 65 | + | ||
| 66 | + SchEditInfo sei = SchEditInfo.getInstance(sch); | ||
| 67 | + sei.setRemarks(remarks); | ||
| 68 | + sei.setJsonArray(jsonArray.toJSONString()); | ||
| 69 | + sei.setType(EditType.FCXXWT); | ||
| 70 | + | ||
| 71 | + put(sei); | ||
| 72 | + } catch (Exception e) { | ||
| 73 | + log.error("", e); | ||
| 74 | + } | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + /** | ||
| 78 | + * 计划烂班 | ||
| 79 | + * | ||
| 80 | + * @param remarks | ||
| 81 | + */ | ||
| 82 | + public static void jhlb(ScheduleRealInfo sch, String remarks) { | ||
| 83 | + try { | ||
| 84 | + SchEditInfo sei = SchEditInfo.getInstance(sch); | ||
| 85 | + sei.setRemarks(remarks); | ||
| 86 | + sei.setType(EditType.JHLB); | ||
| 87 | + | ||
| 88 | + put(sei); | ||
| 89 | + } catch (Exception e) { | ||
| 90 | + log.error("", e); | ||
| 91 | + } | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + /** | ||
| 95 | + * 实发调整 | ||
| 96 | + * | ||
| 97 | + * @param sch | ||
| 98 | + * @param nowSfsj | ||
| 99 | + * @param remarks | ||
| 100 | + */ | ||
| 101 | + public static void sftz(ScheduleRealInfo sch, String nowSfsj, String remarks) { | ||
| 102 | + try { | ||
| 103 | + SchEditInfo sei = SchEditInfo.getInstance(sch); | ||
| 104 | + sei.setRemarks(remarks); | ||
| 105 | + sei.setType(EditType.SFTZ); | ||
| 106 | + //detail | ||
| 107 | + JSONObject jobj = new JSONObject(); | ||
| 108 | + jobj.put("old", sch.getFcsjActual()); | ||
| 109 | + jobj.put("now", nowSfsj); | ||
| 110 | + | ||
| 111 | + sei.setJsonArray(jobj.toJSONString()); | ||
| 112 | + put(sei); | ||
| 113 | + } catch (Exception e) { | ||
| 114 | + log.error("", e); | ||
| 115 | + } | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + /** | ||
| 119 | + * 撤销烂班 | ||
| 120 | + * | ||
| 121 | + * @param sch | ||
| 122 | + */ | ||
| 123 | + public static void cxlb(ScheduleRealInfo sch) { | ||
| 124 | + try { | ||
| 125 | + SchEditInfo sei = SchEditInfo.getInstance(sch); | ||
| 126 | + sei.setType(EditType.CXLB); | ||
| 127 | + | ||
| 128 | + put(sei); | ||
| 129 | + } catch (Exception e) { | ||
| 130 | + log.error("", e); | ||
| 131 | + } | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + /** | ||
| 135 | + * 撤销执行 | ||
| 136 | + * | ||
| 137 | + * @param sch | ||
| 138 | + */ | ||
| 139 | + public static void cxzx(ScheduleRealInfo sch) { | ||
| 140 | + try { | ||
| 141 | + SchEditInfo sei = SchEditInfo.getInstance(sch); | ||
| 142 | + sei.setType(EditType.CXZX); | ||
| 143 | + | ||
| 144 | + //detail | ||
| 145 | + JSONObject obj = new JSONObject(); | ||
| 146 | + if (StringUtils.isNotEmpty(sch.getFcsjActual())) | ||
| 147 | + obj.put("old_sfsj", sch.getFcsjActual()); | ||
| 148 | + | ||
| 149 | + if (StringUtils.isNotEmpty(sch.getZdsjActual())) | ||
| 150 | + obj.put("old_sdsj", sch.getZdsjActual()); | ||
| 151 | + | ||
| 152 | + sei.setJsonArray(obj.toJSONString()); | ||
| 153 | + put(sei); | ||
| 154 | + } catch (Exception e) { | ||
| 155 | + log.error("", e); | ||
| 156 | + } | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + /** | ||
| 160 | + * 撤销实发 | ||
| 161 | + * | ||
| 162 | + * @param sch | ||
| 163 | + */ | ||
| 164 | + public static void cxsf(ScheduleRealInfo sch) { | ||
| 165 | + try { | ||
| 166 | + SchEditInfo sei = SchEditInfo.getInstance(sch); | ||
| 167 | + sei.setType(EditType.CXSF); | ||
| 168 | + | ||
| 169 | + //detail | ||
| 170 | + JSONObject obj = new JSONObject(); | ||
| 171 | + obj.put("old_sfsj", sch.getFcsjActual()); | ||
| 172 | + | ||
| 173 | + sei.setJsonArray(obj.toJSONString()); | ||
| 174 | + put(sei); | ||
| 175 | + } catch (Exception e) { | ||
| 176 | + log.error("", e); | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + /** | ||
| 181 | + * 调整人车 | ||
| 182 | + * | ||
| 183 | + * @param sch | ||
| 184 | + * @param cpc | ||
| 185 | + */ | ||
| 186 | + public static void tzrc(ScheduleRealInfo sch, ChangePersonCar cpc) { | ||
| 187 | + try { | ||
| 188 | + String newNbbm = cpc.getClZbh(); | ||
| 189 | + String newJsy = cpc.getJsy(); | ||
| 190 | + String newSpy = cpc.getSpy(); | ||
| 191 | + //String oldJsy = sch.getjGh() + "/" + sch.getjName(); | ||
| 192 | + | ||
| 193 | + if (newNbbm == null && newJsy == null && newSpy==null) | ||
| 194 | + return; | ||
| 195 | + /*if (newNbbm != null && newJsy != null | ||
| 196 | + && newNbbm.equals(sch.getClZbh()) && newJsy.equals(oldJsy)) | ||
| 197 | + return;*/ | ||
| 198 | + | ||
| 199 | + | ||
| 200 | + SchEditInfo sei = SchEditInfo.getInstance(sch); | ||
| 201 | + sei.setType(EditType.TZRC); | ||
| 202 | + | ||
| 203 | + //detail | ||
| 204 | + JSONObject jobj = new JSONObject(); | ||
| 205 | + if (StringUtils.isNotEmpty(newNbbm) && !newNbbm.equals(sch.getClZbh())) { | ||
| 206 | + jobj.put("old_nbbm", sch.getClZbh()); | ||
| 207 | + jobj.put("now_nbbm", newNbbm); | ||
| 208 | + } | ||
| 209 | + | ||
| 210 | + String oldJsy = sch.getjGh() + "/" + sch.getjName(); | ||
| 211 | + if (StringUtils.isNotEmpty(newJsy) && !newJsy.equals(oldJsy)) { | ||
| 212 | + jobj.put("old_jsy", oldJsy); | ||
| 213 | + jobj.put("now_jsy", newJsy); | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + String oldSpy = sch.getsGh() + "/" + sch.getsName(); | ||
| 217 | + if (StringUtils.isNotEmpty(newSpy) && !newSpy.equals(oldSpy)) { | ||
| 218 | + jobj.put("old_spy", oldSpy); | ||
| 219 | + jobj.put("now_spy", cpc.getSpy()); | ||
| 220 | + } | ||
| 221 | + | ||
| 222 | + sei.setJsonArray(jobj.toJSONString()); | ||
| 223 | + put(sei); | ||
| 224 | + } catch (Exception e) { | ||
| 225 | + log.error("", e); | ||
| 226 | + } | ||
| 227 | + } | ||
| 228 | + | ||
| 229 | + public static void put(SchEditInfo sei) { | ||
| 230 | + list.add(sei); | ||
| 231 | + } | ||
| 232 | +} |
src/main/java/com/bsth/data/schedule/edit_logs/SeiPstThread.java
0 → 100644
| 1 | +package com.bsth.data.schedule.edit_logs; | ||
| 2 | + | ||
| 3 | +import com.bsth.data.schedule.edit_logs.entity.SchEditInfo; | ||
| 4 | +import com.bsth.data.schedule.edit_logs.repository.EditInfoRepository; | ||
| 5 | +import org.slf4j.Logger; | ||
| 6 | +import org.slf4j.LoggerFactory; | ||
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | +import org.springframework.stereotype.Component; | ||
| 9 | + | ||
| 10 | +import java.util.ArrayList; | ||
| 11 | +import java.util.LinkedList; | ||
| 12 | +import java.util.List; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * 班次修正日志入库 | ||
| 16 | + * Created by panzhao on 2017/5/19. | ||
| 17 | + */ | ||
| 18 | +@Component | ||
| 19 | +public class SeiPstThread extends Thread{ | ||
| 20 | + | ||
| 21 | + @Autowired | ||
| 22 | + EditInfoRepository repository; | ||
| 23 | + | ||
| 24 | + Logger log = LoggerFactory.getLogger(this.getClass()); | ||
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + public void run() { | ||
| 28 | + try{ | ||
| 29 | + List<SchEditInfo> pstList = new ArrayList<>(); | ||
| 30 | + LinkedList<SchEditInfo> list = ScheduleModifyLogger.list; | ||
| 31 | + SchEditInfo sei; | ||
| 32 | + for(int i = 0; i < 1000; i ++){ | ||
| 33 | + sei = list.poll(); | ||
| 34 | + if(sei == null) | ||
| 35 | + break; | ||
| 36 | + else{ | ||
| 37 | + //repository.save(sei); | ||
| 38 | + pstList.add(sei); | ||
| 39 | + } | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + repository.save(pstList); | ||
| 43 | + }catch (Exception e){ | ||
| 44 | + log.error("", e); | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | +} | ||
| 0 | \ No newline at end of file | 48 | \ No newline at end of file |
src/main/java/com/bsth/data/schedule/edit_logs/entity/EditType.java
0 → 100644
src/main/java/com/bsth/data/schedule/edit_logs/entity/SchEditInfo.java
0 → 100644
| 1 | +package com.bsth.data.schedule.edit_logs.entity; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 4 | +import com.bsth.entity.sys.SysUser; | ||
| 5 | +import com.bsth.security.util.SecurityUtils; | ||
| 6 | +import org.joda.time.format.DateTimeFormat; | ||
| 7 | +import org.joda.time.format.DateTimeFormatter; | ||
| 8 | + | ||
| 9 | +import javax.persistence.*; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * Created by panzhao on 2017/5/18. | ||
| 13 | + */ | ||
| 14 | +@Entity | ||
| 15 | +@Table(name = "logger_sch_modify") | ||
| 16 | +public class SchEditInfo { | ||
| 17 | + | ||
| 18 | + @Id | ||
| 19 | + @GeneratedValue | ||
| 20 | + private long id; | ||
| 21 | + /** | ||
| 22 | + * 日期 yyyy-MM-dd | ||
| 23 | + */ | ||
| 24 | + private String rq; | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * 时间 HH:mm | ||
| 28 | + */ | ||
| 29 | + private String timeStr; | ||
| 30 | + | ||
| 31 | + /** 时间戳 */ | ||
| 32 | + private long ts; | ||
| 33 | + | ||
| 34 | + private String lineCode; | ||
| 35 | + | ||
| 36 | + private String gsbm; | ||
| 37 | + | ||
| 38 | + private String fgsbm; | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * 班次ID | ||
| 42 | + */ | ||
| 43 | + private long schId; | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * 类型 | ||
| 47 | + */ | ||
| 48 | + @Enumerated(EnumType.STRING) | ||
| 49 | + private EditType type; | ||
| 50 | + | ||
| 51 | + private String type2; | ||
| 52 | + /** | ||
| 53 | + * 操作人 @system 系统/用户名 | ||
| 54 | + */ | ||
| 55 | + private String user; | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * 操作明细 | ||
| 59 | + */ | ||
| 60 | + @Column(length = 2000) | ||
| 61 | + private String jsonArray; | ||
| 62 | + | ||
| 63 | + private String remarks; | ||
| 64 | + | ||
| 65 | + public String getRq() { | ||
| 66 | + return rq; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + public void setRq(String rq) { | ||
| 70 | + this.rq = rq; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + public String getTimeStr() { | ||
| 74 | + return timeStr; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + public void setTimeStr(String timeStr) { | ||
| 78 | + this.timeStr = timeStr; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + public long getSchId() { | ||
| 82 | + return schId; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + public void setSchId(long schId) { | ||
| 86 | + this.schId = schId; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + public EditType getType() { | ||
| 90 | + return type; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + public void setType(EditType type) { | ||
| 94 | + this.type = type; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + public String getUser() { | ||
| 98 | + return user; | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + public void setUser(String user) { | ||
| 102 | + this.user = user; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + public long getId() { | ||
| 106 | + return id; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + public void setId(long id) { | ||
| 110 | + this.id = id; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + public String getJsonArray() { | ||
| 114 | + return jsonArray; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + public void setJsonArray(String jsonArray) { | ||
| 118 | + this.jsonArray = jsonArray; | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + public String getType2() { | ||
| 122 | + return type2; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + public void setType2(String type2) { | ||
| 126 | + this.type2 = type2; | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + public String getRemarks() { | ||
| 130 | + return remarks; | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + public void setRemarks(String remarks) { | ||
| 134 | + this.remarks = remarks; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + | ||
| 138 | + @Transient | ||
| 139 | + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm"); | ||
| 140 | + /* @Transient | ||
| 141 | + private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");*/ | ||
| 142 | + public static SchEditInfo getInstance(ScheduleRealInfo sch){ | ||
| 143 | + SchEditInfo sei = new SchEditInfo(); | ||
| 144 | + long t = System.currentTimeMillis(); | ||
| 145 | + | ||
| 146 | + sei.setTs(t); | ||
| 147 | + sei.setTimeStr(fmtHHmm.print(t)); | ||
| 148 | + | ||
| 149 | + SysUser user = SecurityUtils.getCurrentUser(); | ||
| 150 | + if(user != null) | ||
| 151 | + sei.setUser(user.getUserName()); | ||
| 152 | + | ||
| 153 | + if(sch != null){ | ||
| 154 | + sei.setRq(sch.getScheduleDateStr()); | ||
| 155 | + sei.setSchId(sch.getId()); | ||
| 156 | + sei.setLineCode(sch.getXlBm()); | ||
| 157 | + sei.setGsbm(sch.getGsBm()); | ||
| 158 | + sei.setFgsbm(sch.getFgsBm()); | ||
| 159 | + } | ||
| 160 | + return sei; | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + public String getLineCode() { | ||
| 164 | + return lineCode; | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + public void setLineCode(String lineCode) { | ||
| 168 | + this.lineCode = lineCode; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + public String getGsbm() { | ||
| 172 | + return gsbm; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + public void setGsbm(String gsbm) { | ||
| 176 | + this.gsbm = gsbm; | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + public String getFgsbm() { | ||
| 180 | + return fgsbm; | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + public void setFgsbm(String fgsbm) { | ||
| 184 | + this.fgsbm = fgsbm; | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + public long getTs() { | ||
| 188 | + return ts; | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + public void setTs(long ts) { | ||
| 192 | + this.ts = ts; | ||
| 193 | + } | ||
| 194 | +} | ||
| 0 | \ No newline at end of file | 195 | \ No newline at end of file |
src/main/java/com/bsth/data/schedule/edit_logs/loggers/FcxxwtLogger.java
0 → 100644
| 1 | +package com.bsth.data.schedule.edit_logs.loggers; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSONArray; | ||
| 4 | +import com.alibaba.fastjson.JSONObject; | ||
| 5 | +import com.bsth.data.schedule.edit_logs.ScheduleModifyLogger; | ||
| 6 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 7 | +import org.slf4j.Logger; | ||
| 8 | +import org.slf4j.LoggerFactory; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 发车信息微调记录 | ||
| 12 | + * Created by panzhao on 2017/5/19. | ||
| 13 | + */ | ||
| 14 | +public class FcxxwtLogger { | ||
| 15 | + | ||
| 16 | + static Logger log = LoggerFactory.getLogger(FcxxwtLogger.class); | ||
| 17 | + | ||
| 18 | + private JSONArray jsonArray = new JSONArray(); | ||
| 19 | + private String remarks; | ||
| 20 | + private ScheduleRealInfo sch; | ||
| 21 | + | ||
| 22 | + public void log(String title, Object old, Object now){ | ||
| 23 | + try { | ||
| 24 | + | ||
| 25 | + JSONObject jsonObject = new JSONObject(); | ||
| 26 | + jsonObject.put("title", title); | ||
| 27 | + jsonObject.put("old", old); | ||
| 28 | + jsonObject.put("now", now); | ||
| 29 | + | ||
| 30 | + jsonArray.add(jsonObject); | ||
| 31 | + }catch (Exception e){ | ||
| 32 | + log.error("", e); | ||
| 33 | + } | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public void log(String text){ | ||
| 37 | + try { | ||
| 38 | + JSONObject jsonObject = new JSONObject(); | ||
| 39 | + jsonObject.put("title", text); | ||
| 40 | + | ||
| 41 | + jsonArray.add(jsonObject); | ||
| 42 | + }catch (Exception e){ | ||
| 43 | + log.error("", e); | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + public static FcxxwtLogger start(ScheduleRealInfo sch, String remarks){ | ||
| 48 | + FcxxwtLogger fLog = new FcxxwtLogger(); | ||
| 49 | + fLog.setSch(sch); | ||
| 50 | + fLog.setRemarks(remarks); | ||
| 51 | + return fLog; | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + public void end(){ | ||
| 55 | + ScheduleModifyLogger.fcxxwt(sch, this.remarks, jsonArray); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + public String getRemarks() { | ||
| 59 | + return remarks; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + public void setRemarks(String remarks) { | ||
| 63 | + this.remarks = remarks; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + public ScheduleRealInfo getSch() { | ||
| 67 | + return sch; | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + public void setSch(ScheduleRealInfo sch) { | ||
| 71 | + this.sch = sch; | ||
| 72 | + } | ||
| 73 | +} |
src/main/java/com/bsth/data/schedule/edit_logs/repository/EditInfoRepository.java
0 → 100644
| 1 | +package com.bsth.data.schedule.edit_logs.repository; | ||
| 2 | + | ||
| 3 | +import com.bsth.data.schedule.edit_logs.entity.SchEditInfo; | ||
| 4 | +import com.bsth.repository.BaseRepository; | ||
| 5 | +import org.springframework.stereotype.Repository; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * Created by panzhao on 2017/5/19. | ||
| 9 | + */ | ||
| 10 | +@Repository | ||
| 11 | +public interface EditInfoRepository extends BaseRepository<SchEditInfo, Long>{ | ||
| 12 | +} |
src/main/java/com/bsth/data/schedule/edit_logs/service/SchEditInfoService.java
0 → 100644
| 1 | +package com.bsth.data.schedule.edit_logs.service; | ||
| 2 | + | ||
| 3 | +import com.bsth.data.schedule.edit_logs.entity.SchEditInfo; | ||
| 4 | +import com.bsth.service.BaseService; | ||
| 5 | + | ||
| 6 | +import java.util.Map; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * Created by panzhao on 2017/5/22. | ||
| 10 | + */ | ||
| 11 | +public interface SchEditInfoService extends BaseService<SchEditInfo, Long> { | ||
| 12 | + | ||
| 13 | + Map<String, Object> _list(String rq, String lineCode, Map<String, String> map); | ||
| 14 | +} |
src/main/java/com/bsth/data/schedule/edit_logs/service/SchEditInfoServiceImpl.java
0 → 100644
| 1 | +package com.bsth.data.schedule.edit_logs.service; | ||
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.data.schedule.edit_logs.entity.SchEditInfo; | ||
| 5 | +import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto; | ||
| 6 | +import com.bsth.service.impl.BaseServiceImpl; | ||
| 7 | +import com.bsth.util.BatchSaveUtils; | ||
| 8 | +import org.apache.commons.lang3.StringUtils; | ||
| 9 | +import org.slf4j.Logger; | ||
| 10 | +import org.slf4j.LoggerFactory; | ||
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 12 | +import org.springframework.jdbc.core.BeanPropertyRowMapper; | ||
| 13 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 14 | +import org.springframework.stereotype.Service; | ||
| 15 | + | ||
| 16 | +import java.util.HashMap; | ||
| 17 | +import java.util.List; | ||
| 18 | +import java.util.Map; | ||
| 19 | +import java.util.Set; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * Created by panzhao on 2017/5/22. | ||
| 23 | + */ | ||
| 24 | +@Service | ||
| 25 | +public class SchEditInfoServiceImpl extends BaseServiceImpl<SchEditInfo, Long> implements SchEditInfoService{ | ||
| 26 | + | ||
| 27 | + Logger log = LoggerFactory.getLogger(this.getClass()); | ||
| 28 | + | ||
| 29 | + @Autowired | ||
| 30 | + JdbcTemplate jdbcTemplate; | ||
| 31 | + | ||
| 32 | + public Map<String, Object> _list(String rq, String lineCode, Map<String, String> map) { | ||
| 33 | + | ||
| 34 | + Map<String, Object> rs = new HashMap(); | ||
| 35 | + try { | ||
| 36 | + //拼接除rq、lineCode 外的其他where 条件 | ||
| 37 | + map.remove("rq"); | ||
| 38 | + map.remove("lineCode"); | ||
| 39 | + String cont = "", v; | ||
| 40 | + Set<String> ks = map.keySet(); | ||
| 41 | + for(String k : ks){ | ||
| 42 | + v =map.get(k); | ||
| 43 | + if(StringUtils.isNotEmpty(v)) | ||
| 44 | + cont += " and t2." + BatchSaveUtils.propertyToField(k) + "='" + v + "'"; | ||
| 45 | + } | ||
| 46 | + String sql = "select t1.*, t2.fcsj,t2.lp_name,t2.cl_zbh,t2.j_gh,t2.j_name,t2.xl_dir,t2.real_exec_date from (select * from logger_sch_modify where rq=? and line_code=? ) t1 INNER JOIN bsth_c_s_sp_info_real t2 on t1.sch_id=t2.id where 1=1 " + cont; | ||
| 47 | + | ||
| 48 | + List<SchEditInfoDto> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(SchEditInfoDto.class), rq, lineCode); | ||
| 49 | + | ||
| 50 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 51 | + rs.put("list", list); | ||
| 52 | + }catch (Exception e){ | ||
| 53 | + log.error("", e); | ||
| 54 | + rs.put("status", ResponseCode.ERROR); | ||
| 55 | + rs.put("msg", e.getMessage()); | ||
| 56 | + } | ||
| 57 | + return rs; | ||
| 58 | + } | ||
| 59 | +} |
src/main/java/com/bsth/data/schedule/edit_logs/service/dto/SchEditInfoDto.java
0 → 100644
| 1 | +package com.bsth.data.schedule.edit_logs.service.dto; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * Created by panzhao on 2017/5/22. | ||
| 5 | + */ | ||
| 6 | +public class SchEditInfoDto { | ||
| 7 | + | ||
| 8 | + private long id; | ||
| 9 | + /*** 日期 yyyy-MM-dd*/ | ||
| 10 | + private String rq; | ||
| 11 | + | ||
| 12 | + /*** 时间 HH:mm*/ | ||
| 13 | + private String timeStr; | ||
| 14 | + | ||
| 15 | + private String lineCode; | ||
| 16 | + | ||
| 17 | + private String gsbm; | ||
| 18 | + | ||
| 19 | + private String fgsbm; | ||
| 20 | + | ||
| 21 | + /*** 班次ID*/ | ||
| 22 | + private long schId; | ||
| 23 | + | ||
| 24 | + /*** 类型*/ | ||
| 25 | + private String type; | ||
| 26 | + | ||
| 27 | + private String type2; | ||
| 28 | + /*** 操作人 @system 系统/用户名*/ | ||
| 29 | + private String user; | ||
| 30 | + | ||
| 31 | + /*** 操作明细*/ | ||
| 32 | + private String jsonArray; | ||
| 33 | + | ||
| 34 | + private String remarks; | ||
| 35 | + | ||
| 36 | + /** 路牌 */ | ||
| 37 | + private String lpName; | ||
| 38 | + | ||
| 39 | + /** 驾驶员工号 */ | ||
| 40 | + private String jGh; | ||
| 41 | + | ||
| 42 | + /** 驾驶员姓名 */ | ||
| 43 | + private String jName; | ||
| 44 | + | ||
| 45 | + /** 车辆自编号 */ | ||
| 46 | + private String clZbh; | ||
| 47 | + | ||
| 48 | + /** 计发时间 */ | ||
| 49 | + private String fcsj; | ||
| 50 | + | ||
| 51 | + /** 上下行 */ | ||
| 52 | + private int xlDir; | ||
| 53 | + | ||
| 54 | + /** 实际执行日期 */ | ||
| 55 | + private String realExecDate; | ||
| 56 | + | ||
| 57 | + public long getId() { | ||
| 58 | + return id; | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + public void setId(long id) { | ||
| 62 | + this.id = id; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + public String getRq() { | ||
| 66 | + return rq; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + public void setRq(String rq) { | ||
| 70 | + this.rq = rq; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + public String getTimeStr() { | ||
| 74 | + return timeStr; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + public void setTimeStr(String timeStr) { | ||
| 78 | + this.timeStr = timeStr; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + public String getLineCode() { | ||
| 82 | + return lineCode; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + public void setLineCode(String lineCode) { | ||
| 86 | + this.lineCode = lineCode; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + public String getGsbm() { | ||
| 90 | + return gsbm; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + public void setGsbm(String gsbm) { | ||
| 94 | + this.gsbm = gsbm; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + public String getFgsbm() { | ||
| 98 | + return fgsbm; | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + public void setFgsbm(String fgsbm) { | ||
| 102 | + this.fgsbm = fgsbm; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + public long getSchId() { | ||
| 106 | + return schId; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + public void setSchId(long schId) { | ||
| 110 | + this.schId = schId; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + public String getType2() { | ||
| 114 | + return type2; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + public void setType2(String type2) { | ||
| 118 | + this.type2 = type2; | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + public String getUser() { | ||
| 122 | + return user; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + public void setUser(String user) { | ||
| 126 | + this.user = user; | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + public String getJsonArray() { | ||
| 130 | + return jsonArray; | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + public void setJsonArray(String jsonArray) { | ||
| 134 | + this.jsonArray = jsonArray; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + public String getRemarks() { | ||
| 138 | + return remarks; | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + public void setRemarks(String remarks) { | ||
| 142 | + this.remarks = remarks; | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + public String getLpName() { | ||
| 146 | + return lpName; | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + public void setLpName(String lpName) { | ||
| 150 | + this.lpName = lpName; | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + public String getjGh() { | ||
| 154 | + return jGh; | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + public void setjGh(String jGh) { | ||
| 158 | + this.jGh = jGh; | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + public String getjName() { | ||
| 162 | + return jName; | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + public void setjName(String jName) { | ||
| 166 | + this.jName = jName; | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + | ||
| 170 | + public String getRealExecDate() { | ||
| 171 | + return realExecDate; | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | + public void setRealExecDate(String realExecDate) { | ||
| 175 | + this.realExecDate = realExecDate; | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | + public String getType() { | ||
| 179 | + return type; | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + public void setType(String type) { | ||
| 183 | + this.type = type; | ||
| 184 | + } | ||
| 185 | + | ||
| 186 | + public String getClZbh() { | ||
| 187 | + return clZbh; | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + public void setClZbh(String clZbh) { | ||
| 191 | + this.clZbh = clZbh; | ||
| 192 | + } | ||
| 193 | + | ||
| 194 | + public String getFcsj() { | ||
| 195 | + return fcsj; | ||
| 196 | + } | ||
| 197 | + | ||
| 198 | + public void setFcsj(String fcsj) { | ||
| 199 | + this.fcsj = fcsj; | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + public int getXlDir() { | ||
| 203 | + return xlDir; | ||
| 204 | + } | ||
| 205 | + | ||
| 206 | + public void setXlDir(int xlDir) { | ||
| 207 | + this.xlDir = xlDir; | ||
| 208 | + } | ||
| 209 | +} |
src/main/java/com/bsth/data/schedule/thread/CalcOilThread.java
| @@ -3,6 +3,8 @@ package com.bsth.data.schedule.thread; | @@ -3,6 +3,8 @@ package com.bsth.data.schedule.thread; | ||
| 3 | import com.bsth.service.oil.DlbService; | 3 | import com.bsth.service.oil.DlbService; |
| 4 | import com.bsth.data.safe_driv.SafeDrivCenter; | 4 | import com.bsth.data.safe_driv.SafeDrivCenter; |
| 5 | import com.bsth.service.oil.YlbService; | 5 | import com.bsth.service.oil.YlbService; |
| 6 | +import com.bsth.service.report.SheetService; | ||
| 7 | + | ||
| 6 | import org.slf4j.Logger; | 8 | import org.slf4j.Logger; |
| 7 | import org.slf4j.LoggerFactory; | 9 | import org.slf4j.LoggerFactory; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -19,6 +21,9 @@ public class CalcOilThread extends Thread{ | @@ -19,6 +21,9 @@ public class CalcOilThread extends Thread{ | ||
| 19 | YlbService ylbService; | 21 | YlbService ylbService; |
| 20 | @Autowired | 22 | @Autowired |
| 21 | DlbService dlbService; | 23 | DlbService dlbService; |
| 24 | + | ||
| 25 | + @Autowired | ||
| 26 | + SheetService sheetService; | ||
| 22 | Logger logger = LoggerFactory.getLogger(this.getClass()); | 27 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 23 | 28 | ||
| 24 | @Override | 29 | @Override |
| @@ -28,7 +33,9 @@ public class CalcOilThread extends Thread{ | @@ -28,7 +33,9 @@ public class CalcOilThread extends Thread{ | ||
| 28 | ylbService.obtainDsq(); | 33 | ylbService.obtainDsq(); |
| 29 | dlbService.obtainDsq(); | 34 | dlbService.obtainDsq(); |
| 30 | logger.info("计算路单里程加注量结束!"); | 35 | logger.info("计算路单里程加注量结束!"); |
| 31 | - | 36 | + logger.info("开始计算班次准点率...."); |
| 37 | + sheetService.saveSheetList(); | ||
| 38 | + logger.info("计算班次准点率结束!"); | ||
| 32 | //清除安全驾驶数据 先临时蹭这个线程 | 39 | //清除安全驾驶数据 先临时蹭这个线程 |
| 33 | SafeDrivCenter.clear(); | 40 | SafeDrivCenter.clear(); |
| 34 | } catch(Exception e){ | 41 | } catch(Exception e){ |
src/main/java/com/bsth/entity/sheet/Sheet.java
0 → 100644
| 1 | +package com.bsth.entity.sheet; | ||
| 2 | + | ||
| 3 | +import java.util.Date; | ||
| 4 | + | ||
| 5 | +import javax.persistence.Entity; | ||
| 6 | +import javax.persistence.GeneratedValue; | ||
| 7 | +import javax.persistence.Id; | ||
| 8 | +import javax.persistence.Table; | ||
| 9 | +import javax.persistence.Transient; | ||
| 10 | +@Entity | ||
| 11 | +@Table(name = "bsth_c_sheet") | ||
| 12 | +public class Sheet { | ||
| 13 | + @Id | ||
| 14 | + @GeneratedValue | ||
| 15 | + private Integer id; | ||
| 16 | + private String gs; | ||
| 17 | + private String fgs; | ||
| 18 | + private String line; | ||
| 19 | + private String date; | ||
| 20 | + private String realDate; | ||
| 21 | + private String jhsj; | ||
| 22 | + private Long jhsjt; | ||
| 23 | + private String sjsj; | ||
| 24 | + private Long sjsjt; | ||
| 25 | + private String xlDir; | ||
| 26 | + private Date createDate; | ||
| 27 | + private String zdname; | ||
| 28 | + | ||
| 29 | + @Transient | ||
| 30 | + private String sfzd; | ||
| 31 | + | ||
| 32 | + public Integer getId() { | ||
| 33 | + return id; | ||
| 34 | + } | ||
| 35 | + public void setId(Integer id) { | ||
| 36 | + this.id = id; | ||
| 37 | + } | ||
| 38 | + public String getGs() { | ||
| 39 | + return gs; | ||
| 40 | + } | ||
| 41 | + public void setGs(String gs) { | ||
| 42 | + this.gs = gs; | ||
| 43 | + } | ||
| 44 | + public String getFgs() { | ||
| 45 | + return fgs; | ||
| 46 | + } | ||
| 47 | + public void setFgs(String fgs) { | ||
| 48 | + this.fgs = fgs; | ||
| 49 | + } | ||
| 50 | + public String getLine() { | ||
| 51 | + return line; | ||
| 52 | + } | ||
| 53 | + public void setLine(String line) { | ||
| 54 | + this.line = line; | ||
| 55 | + } | ||
| 56 | + public String getDate() { | ||
| 57 | + return date; | ||
| 58 | + } | ||
| 59 | + public void setDate(String date) { | ||
| 60 | + this.date = date; | ||
| 61 | + } | ||
| 62 | + public String getRealDate() { | ||
| 63 | + return realDate; | ||
| 64 | + } | ||
| 65 | + public void setRealDate(String realDate) { | ||
| 66 | + this.realDate = realDate; | ||
| 67 | + } | ||
| 68 | + public String getJhsj() { | ||
| 69 | + return jhsj; | ||
| 70 | + } | ||
| 71 | + public void setJhsj(String jhsj) { | ||
| 72 | + this.jhsj = jhsj; | ||
| 73 | + } | ||
| 74 | + public String getSjsj() { | ||
| 75 | + return sjsj; | ||
| 76 | + } | ||
| 77 | + public void setSjsj(String sjsj) { | ||
| 78 | + this.sjsj = sjsj; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + public Long getJhsjt() { | ||
| 82 | + return jhsjt; | ||
| 83 | + } | ||
| 84 | + public void setJhsjt(Long jhsjt) { | ||
| 85 | + this.jhsjt = jhsjt; | ||
| 86 | + } | ||
| 87 | + public Long getSjsjt() { | ||
| 88 | + return sjsjt; | ||
| 89 | + } | ||
| 90 | + public void setSjsjt(Long sjsjt) { | ||
| 91 | + this.sjsjt = sjsjt; | ||
| 92 | + } | ||
| 93 | + public String getXlDir() { | ||
| 94 | + return xlDir; | ||
| 95 | + } | ||
| 96 | + public void setXlDir(String xlDir) { | ||
| 97 | + this.xlDir = xlDir; | ||
| 98 | + } | ||
| 99 | + public Date getCreateDate() { | ||
| 100 | + return createDate; | ||
| 101 | + } | ||
| 102 | + public void setCreateDate(Date createDate) { | ||
| 103 | + this.createDate = createDate; | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + public String getZdname() { | ||
| 107 | + return zdname; | ||
| 108 | + } | ||
| 109 | + public void setZdname(String zdname) { | ||
| 110 | + this.zdname = zdname; | ||
| 111 | + } | ||
| 112 | + public String getSfzd() { | ||
| 113 | + return sfzd; | ||
| 114 | + } | ||
| 115 | + public void setSfzd(String sfzd) { | ||
| 116 | + this.sfzd = sfzd; | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + | ||
| 120 | + | ||
| 121 | +} |
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
| @@ -147,6 +147,10 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | @@ -147,6 +147,10 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | ||
| 147 | List<ScheduleRealInfo> scheduleByDateAndLineQp(String line,String date); | 147 | List<ScheduleRealInfo> scheduleByDateAndLineQp(String line,String date); |
| 148 | 148 | ||
| 149 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | 149 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 150 | + @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)") | ||
| 151 | + List<ScheduleRealInfo> scheduleByDateAndLineQp2(String line,String date); | ||
| 152 | + | ||
| 153 | + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | ||
| 150 | @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.bcType not in ('in','out') order by s.xlBm,s.adjustExps,s.fcsj") | 154 | @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.bcType not in ('in','out') order by s.xlBm,s.adjustExps,s.fcsj") |
| 151 | List<ScheduleRealInfo> scheduleByDateAndLine2(String line,String date); | 155 | List<ScheduleRealInfo> scheduleByDateAndLine2(String line,String date); |
| 152 | 156 |
src/main/java/com/bsth/repository/sheet/SheetRepository.java
0 → 100644
| 1 | +package com.bsth.repository.sheet; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.sheet.Sheet; | ||
| 4 | +import com.bsth.repository.BaseRepository; | ||
| 5 | +import org.springframework.stereotype.Repository; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * | ||
| 9 | + */ | ||
| 10 | +@Repository | ||
| 11 | +public interface SheetRepository extends BaseRepository<Sheet, Integer>{ | ||
| 12 | +} |
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
| @@ -28,10 +28,12 @@ import com.bsth.entity.mcy_forms.Singledata; | @@ -28,10 +28,12 @@ import com.bsth.entity.mcy_forms.Singledata; | ||
| 28 | import com.bsth.entity.mcy_forms.Turnoutrate; | 28 | import com.bsth.entity.mcy_forms.Turnoutrate; |
| 29 | import com.bsth.entity.mcy_forms.Vehicleloading; | 29 | import com.bsth.entity.mcy_forms.Vehicleloading; |
| 30 | import com.bsth.entity.mcy_forms.Waybillday; | 30 | import com.bsth.entity.mcy_forms.Waybillday; |
| 31 | +import com.bsth.entity.oil.Dlb; | ||
| 31 | import com.bsth.entity.oil.Ylb; | 32 | import com.bsth.entity.oil.Ylb; |
| 32 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 33 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 33 | import com.bsth.entity.schedule.SchedulePlanInfo; | 34 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 34 | import com.bsth.repository.LineRepository; | 35 | import com.bsth.repository.LineRepository; |
| 36 | +import com.bsth.repository.oil.DlbRepository; | ||
| 35 | import com.bsth.repository.oil.YlbRepository; | 37 | import com.bsth.repository.oil.YlbRepository; |
| 36 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | 38 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; |
| 37 | import com.bsth.data.BasicData; | 39 | import com.bsth.data.BasicData; |
| @@ -67,6 +69,9 @@ public class FormsServiceImpl implements FormsService { | @@ -67,6 +69,9 @@ public class FormsServiceImpl implements FormsService { | ||
| 67 | YlbRepository ylbRepository; | 69 | YlbRepository ylbRepository; |
| 68 | 70 | ||
| 69 | @Autowired | 71 | @Autowired |
| 72 | + DlbRepository dlbRepository; | ||
| 73 | + | ||
| 74 | + @Autowired | ||
| 70 | LineRepository lineRepository; | 75 | LineRepository lineRepository; |
| 71 | 76 | ||
| 72 | 77 | ||
| @@ -98,6 +103,7 @@ public class FormsServiceImpl implements FormsService { | @@ -98,6 +103,7 @@ public class FormsServiceImpl implements FormsService { | ||
| 98 | }); | 103 | }); |
| 99 | List<ScheduleRealInfo> realList= scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date); | 104 | List<ScheduleRealInfo> realList= scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date); |
| 100 | List<Ylb> listYlb= ylbRepository.obtainYl(date, "", "", line, "", "xlbm"); | 105 | List<Ylb> listYlb= ylbRepository.obtainYl(date, "", "", line, "", "xlbm"); |
| 106 | + List<Dlb> listDlb= dlbRepository.obtainDl(date, "", "", line, "", "xlbm"); | ||
| 101 | double jzl=0.0,sh=0.0,yh=0.0; | 107 | double jzl=0.0,sh=0.0,yh=0.0; |
| 102 | for (int i = 0; i < list.size(); i++) { | 108 | for (int i = 0; i < list.size(); i++) { |
| 103 | Waybillday w=list.get(i); | 109 | Waybillday w=list.get(i); |
| @@ -132,6 +138,14 @@ public class FormsServiceImpl implements FormsService { | @@ -132,6 +138,14 @@ public class FormsServiceImpl implements FormsService { | ||
| 132 | } | 138 | } |
| 133 | } | 139 | } |
| 134 | 140 | ||
| 141 | + for (int j = 0; j < listDlb.size(); j++) { | ||
| 142 | + Dlb d=listDlb.get(j); | ||
| 143 | + if(w.getNbbm().equals(d.getNbbm()) && w.getJgh().equals(d.getJsy())){ | ||
| 144 | + jzl=Arith.add(jzl, d.getCdl()); | ||
| 145 | + sh=Arith.add(sh, d.getSh()); | ||
| 146 | + yh=Arith.add(yh, d.getHd()); | ||
| 147 | + } | ||
| 148 | + } | ||
| 135 | w.setJzl(String.valueOf(jzl)); | 149 | w.setJzl(String.valueOf(jzl)); |
| 136 | w.setYh(String.valueOf(yh)); | 150 | w.setYh(String.valueOf(yh)); |
| 137 | w.setSh(String.valueOf(sh)); | 151 | w.setSh(String.valueOf(sh)); |
| @@ -1087,7 +1101,10 @@ public class FormsServiceImpl implements FormsService { | @@ -1087,7 +1101,10 @@ public class FormsServiceImpl implements FormsService { | ||
| 1087 | 1101 | ||
| 1088 | @Override | 1102 | @Override |
| 1089 | public List<Daily> daily(Map<String, Object> map) { | 1103 | public List<Daily> daily(Map<String, Object> map) { |
| 1090 | - | 1104 | + String xlbm="";; |
| 1105 | + if(map.get("line")!=null){ | ||
| 1106 | + xlbm=map.get("line").toString().trim(); | ||
| 1107 | + } | ||
| 1091 | String gsbm=""; | 1108 | String gsbm=""; |
| 1092 | if(map.get("gsdmDaily")!=null){ | 1109 | if(map.get("gsdmDaily")!=null){ |
| 1093 | gsbm=map.get("gsdmDaily").toString(); | 1110 | gsbm=map.get("gsdmDaily").toString(); |
| @@ -1098,7 +1115,7 @@ public class FormsServiceImpl implements FormsService { | @@ -1098,7 +1115,7 @@ public class FormsServiceImpl implements FormsService { | ||
| 1098 | fgsbm=map.get("fgsdmDaily").toString(); | 1115 | fgsbm=map.get("fgsdmDaily").toString(); |
| 1099 | } | 1116 | } |
| 1100 | 1117 | ||
| 1101 | - String sql="select t.schedule_date_str," | 1118 | + /*String sql="select t.schedule_date_str," |
| 1102 | + " t.cl_zbh,t.j_gh,t.j_name,x.yh from (select r.schedule_date_str,r.xl_bm," | 1119 | + " t.cl_zbh,t.j_gh,t.j_name,x.yh from (select r.schedule_date_str,r.xl_bm," |
| 1103 | + " r.cl_zbh,r.j_gh,r.j_name from bsth_c_s_sp_info_real r WHERE " | 1120 | + " r.cl_zbh,r.j_gh,r.j_name from bsth_c_s_sp_info_real r WHERE " |
| 1104 | + " r.xl_bm='" + map.get("line").toString() + "' " | 1121 | + " r.xl_bm='" + map.get("line").toString() + "' " |
| @@ -1112,7 +1129,20 @@ public class FormsServiceImpl implements FormsService { | @@ -1112,7 +1129,20 @@ public class FormsServiceImpl implements FormsService { | ||
| 1112 | + " and y.ssgsdm like '%"+gsbm+"%' " | 1129 | + " and y.ssgsdm like '%"+gsbm+"%' " |
| 1113 | + " and y.fgsdm like '%"+fgsbm+"%'" | 1130 | + " and y.fgsdm like '%"+fgsbm+"%'" |
| 1114 | + " ) x" | 1131 | + " ) x" |
| 1115 | - + " on t.cl_zbh = x.nbbm and t.j_gh=x.jsy"; | 1132 | + + " on t.cl_zbh = x.nbbm and t.j_gh=x.jsy";*/ |
| 1133 | + | ||
| 1134 | + String sql="select r.schedule_date_str, " | ||
| 1135 | + + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm" | ||
| 1136 | + + " from bsth_c_s_sp_info_real r where " | ||
| 1137 | + + "r.schedule_date_str = '"+map.get("date").toString()+"'"; | ||
| 1138 | + if(xlbm.equals("")){ | ||
| 1139 | + sql +="and r.gs_bm='"+gsbm+"' " | ||
| 1140 | + + " and r.fgs_bm='"+fgsbm+"'"; | ||
| 1141 | + }else{ | ||
| 1142 | + sql += " and r.xl_bm = '"+xlbm+"'"; | ||
| 1143 | + } | ||
| 1144 | + sql += " group by r.schedule_date_str," | ||
| 1145 | + + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; | ||
| 1116 | 1146 | ||
| 1117 | List<Daily> list = jdbcTemplate.query(sql, new RowMapper<Daily>() { | 1147 | List<Daily> list = jdbcTemplate.query(sql, new RowMapper<Daily>() { |
| 1118 | @Override | 1148 | @Override |
| @@ -1122,21 +1152,31 @@ public class FormsServiceImpl implements FormsService { | @@ -1122,21 +1152,31 @@ public class FormsServiceImpl implements FormsService { | ||
| 1122 | daily.setZbh(arg0.getString("cl_zbh")); | 1152 | daily.setZbh(arg0.getString("cl_zbh")); |
| 1123 | daily.setJgh(arg0.getString("j_gh")); | 1153 | daily.setJgh(arg0.getString("j_gh")); |
| 1124 | daily.setjName(arg0.getString("j_name")); | 1154 | daily.setjName(arg0.getString("j_name")); |
| 1125 | - daily.setYh(arg0.getString("yh")); | ||
| 1126 | return daily; | 1155 | return daily; |
| 1127 | } | 1156 | } |
| 1128 | }); | 1157 | }); |
| 1158 | + List<Ylb> listYlb= ylbRepository.obtainYl(map.get("date").toString(), "", "", xlbm, "", "xlbm"); | ||
| 1159 | + List<Dlb> listDlb= dlbRepository.obtainDl(map.get("date").toString(), "", "", xlbm, "", "xlbm"); | ||
| 1129 | List<ScheduleRealInfo> sList; | 1160 | List<ScheduleRealInfo> sList; |
| 1130 | List<ScheduleRealInfo> lists=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(map.get("line").toString(), map.get("date").toString()); | 1161 | List<ScheduleRealInfo> lists=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(map.get("line").toString(), map.get("date").toString()); |
| 1131 | for(int i=0;i<list.size();i++){ | 1162 | for(int i=0;i<list.size();i++){ |
| 1132 | sList =new ArrayList<ScheduleRealInfo>(); | 1163 | sList =new ArrayList<ScheduleRealInfo>(); |
| 1133 | Daily d=list.get(i); | 1164 | Daily d=list.get(i); |
| 1134 | - if(d.getYh()==null){ | ||
| 1135 | - d.setYh("0"); | ||
| 1136 | - }else{ | ||
| 1137 | - if(d.getYh().equals("")) | ||
| 1138 | - d.setYh("0"); | 1165 | + Double yh=0.0; |
| 1166 | + for (int j = 0; j < listYlb.size(); j++) { | ||
| 1167 | + Ylb y=listYlb.get(j); | ||
| 1168 | + if(y.getNbbm().equals(d.getZbh())&& y.getJsy().equals(d.getJgh())){ | ||
| 1169 | + yh=Arith.add(yh, y.getYh()); | ||
| 1170 | + } | ||
| 1171 | + } | ||
| 1172 | + | ||
| 1173 | + for (int j = 0; j < listDlb.size(); j++) { | ||
| 1174 | + Dlb b=listDlb.get(j); | ||
| 1175 | + if(b.getNbbm().equals(d.getZbh())&& b.getJsy().equals(d.getJgh())){ | ||
| 1176 | + yh=Arith.add(yh, b.getHd()); | ||
| 1177 | + } | ||
| 1139 | } | 1178 | } |
| 1179 | + d.setYh(String.valueOf(yh)); | ||
| 1140 | for (int j = 0; j < lists.size(); j++) { | 1180 | for (int j = 0; j < lists.size(); j++) { |
| 1141 | ScheduleRealInfo s=lists.get(j); | 1181 | ScheduleRealInfo s=lists.get(j); |
| 1142 | if(d.getJgh().equals(s.getjGh()) && d.getZbh().equals(s.getClZbh())){ | 1182 | if(d.getJgh().equals(s.getjGh()) && d.getZbh().equals(s.getClZbh())){ |
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
| @@ -11,6 +11,7 @@ import java.util.Collections; | @@ -11,6 +11,7 @@ import java.util.Collections; | ||
| 11 | import java.util.Comparator; | 11 | import java.util.Comparator; |
| 12 | import java.util.Date; | 12 | import java.util.Date; |
| 13 | import java.util.HashMap; | 13 | import java.util.HashMap; |
| 14 | +import java.util.HashSet; | ||
| 14 | import java.util.Iterator; | 15 | import java.util.Iterator; |
| 15 | import java.util.List; | 16 | import java.util.List; |
| 16 | import java.util.Map; | 17 | import java.util.Map; |
| @@ -585,7 +586,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -585,7 +586,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 585 | 586 | ||
| 586 | @Override | 587 | @Override |
| 587 | public Map<String, Object> timeAndSpeed(Map<String, Object> map) { | 588 | public Map<String, Object> timeAndSpeed(Map<String, Object> map) { |
| 588 | - List<Long> ttList = new ArrayList<Long>(); | 589 | + List<Map<String, Object>> ttList = new ArrayList<Map<String, Object>>(); |
| 589 | List<ChildTaskPlan> cList = new ArrayList<ChildTaskPlan>(); | 590 | List<ChildTaskPlan> cList = new ArrayList<ChildTaskPlan>(); |
| 590 | List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | 591 | List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); |
| 591 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | 592 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| @@ -593,6 +594,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -593,6 +594,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 593 | Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); | 594 | Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); |
| 594 | Map<String, List<ChildTaskPlan>> cMap = new HashMap<String, List<ChildTaskPlan>>(); | 595 | Map<String, List<ChildTaskPlan>> cMap = new HashMap<String, List<ChildTaskPlan>>(); |
| 595 | Map<String, Object> modelMap = new HashMap<String, Object>(); | 596 | Map<String, Object> modelMap = new HashMap<String, Object>(); |
| 597 | + Set<Long> tsSet = new HashSet<Long>(); | ||
| 596 | 598 | ||
| 597 | String company = map.get("company").toString(); | 599 | String company = map.get("company").toString(); |
| 598 | String subCompany = map.get("subCompany").toString(); | 600 | String subCompany = map.get("subCompany").toString(); |
| @@ -616,20 +618,23 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -616,20 +618,23 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 616 | 618 | ||
| 617 | try { | 619 | try { |
| 618 | 620 | ||
| 619 | - String sql = "select * from bsth_c_s_sp_info_real where DATE_FORMAT(schedule_date,'%Y-%m-%d') >= '"+startDate+"' and DATE_FORMAT(schedule_date,'%Y-%m-%d') <= '"+endDate+"'"; | 621 | + String where = ""; |
| 620 | if(line.length() != 0 && statu.equals("1")){ | 622 | if(line.length() != 0 && statu.equals("1")){ |
| 621 | - sql += " and xl_bm = '"+line+"'"; | 623 | + where += " and xl_bm = '"+line+"'"; |
| 622 | } | 624 | } |
| 623 | if(lp.length() != 0 && statu.equals("1")){ | 625 | if(lp.length() != 0 && statu.equals("1")){ |
| 624 | - sql += " and lp_name = '"+lp+"'"; | 626 | + where += " and lp_name = '"+lp+"'"; |
| 625 | } | 627 | } |
| 626 | if(company.length() != 0){ | 628 | if(company.length() != 0){ |
| 627 | - sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; | 629 | + where += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; |
| 628 | } | 630 | } |
| 629 | if(sfqr == 1){ | 631 | if(sfqr == 1){ |
| 630 | - sql += " and zdsj >= '"+times1+"' and fcsj <= '"+times2+"'"; | 632 | + where += " and zdsj >= '"+times1+"' and fcsj <= '"+times2+"'"; |
| 631 | } | 633 | } |
| 632 | - sql += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' order by fcsj"; | 634 | + where += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; |
| 635 | + | ||
| 636 | + String sql = "select * from bsth_c_s_sp_info_real where DATE_FORMAT(schedule_date,'%Y-%m-%d') >= '"+startDate+"'" | ||
| 637 | + + " and DATE_FORMAT(schedule_date,'%Y-%m-%d') <= '"+endDate+"'"+where+""; | ||
| 633 | 638 | ||
| 634 | list = jdbcTemplate.query(sql, | 639 | list = jdbcTemplate.query(sql, |
| 635 | new RowMapper<ScheduleRealInfo>(){ | 640 | new RowMapper<ScheduleRealInfo>(){ |
| @@ -704,6 +709,65 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -704,6 +709,65 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 704 | return schedule; | 709 | return schedule; |
| 705 | } | 710 | } |
| 706 | }); | 711 | }); |
| 712 | + | ||
| 713 | + { | ||
| 714 | + List<Map<String, String>> temp1 = new ArrayList<Map<String, String>>(); | ||
| 715 | + List<Map<String, String>> temp2 = new ArrayList<Map<String, String>>(); | ||
| 716 | + sql = "select * from bsth_c_s_sp_info where bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; | ||
| 717 | + | ||
| 718 | + if(startDate.equals(endDate)){ | ||
| 719 | + sql += " and schedule_date = '"+startDate+"'"; | ||
| 720 | + } else { | ||
| 721 | + sql += " and schedule_date >= '"+startDate+"' and schedule_date <= '"+endDate+"'"; | ||
| 722 | + } | ||
| 723 | + if(line.length() != 0 && statu.equals("1")){ | ||
| 724 | + sql += " and xl_bm = '"+line+"'"; | ||
| 725 | + } | ||
| 726 | + if(company.length() != 0){ | ||
| 727 | + sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; | ||
| 728 | + } | ||
| 729 | + temp1 = jdbcTemplate.query(sql, | ||
| 730 | + new RowMapper<Map<String, String>>(){ | ||
| 731 | + @Override | ||
| 732 | + public Map<String, String> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 733 | + Map<String, String> m = new HashMap<String, String>(); | ||
| 734 | + m.put("id", rs.getString("id")); | ||
| 735 | + m.put("lp", rs.getString("lp")); | ||
| 736 | + m.put("fcsj", rs.getString("fcsj")); | ||
| 737 | + m.put("xl_bm", rs.getString("xl_bm")); | ||
| 738 | + m.put("tt_info", rs.getString("tt_info")); | ||
| 739 | + return m; | ||
| 740 | + } | ||
| 741 | + }); | ||
| 742 | + sql = "select * from bsth_c_s_ttinfo_detail where ists = 1" | ||
| 743 | + + " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; | ||
| 744 | + | ||
| 745 | + if(line.length() != 0 && statu.equals("1")){ | ||
| 746 | + sql += " and xl = '"+line+"'"; | ||
| 747 | + } | ||
| 748 | + temp2 = jdbcTemplate.query(sql, | ||
| 749 | + new RowMapper<Map<String, String>>(){ | ||
| 750 | + @Override | ||
| 751 | + public Map<String, String> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 752 | + Map<String, String> m = new HashMap<String, String>(); | ||
| 753 | + m.put("id", rs.getString("id")); | ||
| 754 | + m.put("lp", rs.getString("lp")); | ||
| 755 | + m.put("xl", rs.getString("xl")); | ||
| 756 | + m.put("fcsj", rs.getString("fcsj")); | ||
| 757 | + m.put("ttinfo", rs.getString("ttinfo")); | ||
| 758 | + return m; | ||
| 759 | + } | ||
| 760 | + }); | ||
| 761 | + | ||
| 762 | + for(Map<String, String> m2 : temp2){ | ||
| 763 | + for(Map<String, String> m1 : temp1){ | ||
| 764 | + if(m2.get("ttinfo").equals(m1.get("tt_info")) && m2.get("xl").equals(m1.get("xl_bm")) | ||
| 765 | + && m2.get("lp").equals(m1.get("lp")) && m2.get("fcsj").equals(m1.get("fcsj"))){ | ||
| 766 | + tsSet.add(Long.valueOf(m1.get("id"))); | ||
| 767 | + } | ||
| 768 | + } | ||
| 769 | + } | ||
| 770 | + } | ||
| 707 | 771 | ||
| 708 | sql = "select * from bsth_c_s_child_task order by start_date"; | 772 | sql = "select * from bsth_c_s_child_task order by start_date"; |
| 709 | 773 | ||
| @@ -723,13 +787,17 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -723,13 +787,17 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 723 | }); | 787 | }); |
| 724 | 788 | ||
| 725 | if(model.length() != 0){ | 789 | if(model.length() != 0){ |
| 726 | - sql = "select id from bsth_c_s_sp_info where tt_info = '" + model + "' and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; | 790 | + sql = "select sp.id from bsth_c_s_sp_info sp 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 " |
| 791 | + + "where tt_info = '" + model + "' and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; | ||
| 727 | 792 | ||
| 728 | ttList = jdbcTemplate.query(sql, | 793 | ttList = jdbcTemplate.query(sql, |
| 729 | - new RowMapper<Long>(){ | 794 | + new RowMapper<Map<String, Object>>(){ |
| 730 | @Override | 795 | @Override |
| 731 | - public Long mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 732 | - return rs.getLong("id"); | 796 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { |
| 797 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 798 | + m.put("id", rs.getString("id")); | ||
| 799 | + m.put("ists", rs.getString("ists")!=null?rs.getString("ists"):"0"); | ||
| 800 | + return m; | ||
| 733 | } | 801 | } |
| 734 | }); | 802 | }); |
| 735 | } | 803 | } |
| @@ -771,13 +839,15 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -771,13 +839,15 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 771 | if(schedule.getXlName()==null || schedule.getXlName().trim().length()==0) | 839 | if(schedule.getXlName()==null || schedule.getXlName().trim().length()==0) |
| 772 | continue; | 840 | continue; |
| 773 | if(model.length() != 0){ | 841 | if(model.length() != 0){ |
| 774 | - for(Long tt : ttList) | ||
| 775 | - if((long) tt == (long)schedule.getSpId()){ | 842 | + for(Map<String, Object> tt : ttList){ |
| 843 | + long id = Long.valueOf(tt.get("id").toString()); | ||
| 844 | + if(id == (long)schedule.getSpId()){ | ||
| 776 | String key = schedule.getScheduleDateStr() + "/" + schedule.getXlName() + "/" + schedule.getLpName(); | 845 | String key = schedule.getScheduleDateStr() + "/" + schedule.getXlName() + "/" + schedule.getLpName(); |
| 777 | if(!keyMap.containsKey(key)) | 846 | if(!keyMap.containsKey(key)) |
| 778 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | 847 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); |
| 779 | keyMap.get(key).add(schedule); | 848 | keyMap.get(key).add(schedule); |
| 780 | } | 849 | } |
| 850 | + } | ||
| 781 | }else{ | 851 | }else{ |
| 782 | String key = schedule.getScheduleDateStr() + "/" + schedule.getXlName() + "/" + schedule.getLpName(); | 852 | String key = schedule.getScheduleDateStr() + "/" + schedule.getXlName() + "/" + schedule.getLpName(); |
| 783 | if(!keyMap.containsKey(key)) | 853 | if(!keyMap.containsKey(key)) |
| @@ -821,14 +891,16 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -821,14 +891,16 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 821 | for(int i = 1; i < keyList.size(); i++){ | 891 | for(int i = 1; i < keyList.size(); i++){ |
| 822 | ScheduleRealInfo schedule1 = sortMap.get(keyList.get(i - 1)); | 892 | ScheduleRealInfo schedule1 = sortMap.get(keyList.get(i - 1)); |
| 823 | ScheduleRealInfo schedule2 = sortMap.get(keyList.get(i)); | 893 | ScheduleRealInfo schedule2 = sortMap.get(keyList.get(i)); |
| 824 | - if(sfqr == 1 && time1 > schedule1.getFcsjT()){ | ||
| 825 | - jhyysj += schedule2.getFcsjT() - time1; | ||
| 826 | - }else if(sfqr == 1 && time2 < schedule2.getFcsjT()){ | ||
| 827 | - jhyysj += time2 - schedule1.getFcsjT(); | ||
| 828 | - }else{ | ||
| 829 | - jhyysj += schedule2.getFcsjT() - schedule1.getFcsjT(); | 894 | + if(!tsSet.contains(schedule1.getId())){ |
| 895 | + if(sfqr == 1 && time1 > schedule1.getFcsjT()){ | ||
| 896 | + jhyysj += schedule2.getFcsjT() - time1; | ||
| 897 | + }else if(sfqr == 1 && time2 < schedule2.getFcsjT()){ | ||
| 898 | + jhyysj += time2 - schedule1.getFcsjT(); | ||
| 899 | + }else{ | ||
| 900 | + jhyysj += schedule2.getFcsjT() - schedule1.getFcsjT(); | ||
| 901 | + } | ||
| 902 | + jhyysj1 += schedule2.getFcsjT() - schedule1.getFcsjT(); | ||
| 830 | } | 903 | } |
| 831 | - jhyysj1 += schedule2.getFcsjT() - schedule1.getFcsjT(); | ||
| 832 | long zdsj2 = schedule2.getZdsjT(); | 904 | long zdsj2 = schedule2.getZdsjT(); |
| 833 | long fcsj2 = schedule2.getFcsjT(); | 905 | long fcsj2 = schedule2.getFcsjT(); |
| 834 | if(fcsj2 > zdsj2) | 906 | if(fcsj2 > zdsj2) |
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
| @@ -1016,18 +1016,21 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1016,18 +1016,21 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1016 | if(nbbm.trim()!=""){ | 1016 | if(nbbm.trim()!=""){ |
| 1017 | stringList.add(nbbm); | 1017 | stringList.add(nbbm); |
| 1018 | List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm); | 1018 | List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm); |
| 1019 | - int cs=Integer.parseInt(objectLists.get(0)[1].toString()); | ||
| 1020 | - if(sxtj.equals("1")){ | ||
| 1021 | - if(cs==1){ | 1019 | + if(objectLists.size()>0){ |
| 1020 | + int cs=Integer.parseInt(objectLists.get(0)[1].toString()); | ||
| 1021 | + if(sxtj.equals("1")){ | ||
| 1022 | + if(cs==1){ | ||
| 1023 | + listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList); | ||
| 1024 | + } | ||
| 1025 | + }else if(sxtj.equals("2")){ | ||
| 1026 | + if(cs>1){ | ||
| 1027 | + listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList); | ||
| 1028 | + } | ||
| 1029 | + }else{ | ||
| 1022 | listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList); | 1030 | listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList); |
| 1023 | } | 1031 | } |
| 1024 | } | 1032 | } |
| 1025 | 1033 | ||
| 1026 | - if(sxtj.equals("2")){ | ||
| 1027 | - if(cs>1){ | ||
| 1028 | - listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList); | ||
| 1029 | - } | ||
| 1030 | - } | ||
| 1031 | }else{ | 1034 | }else{ |
| 1032 | //全部 | 1035 | //全部 |
| 1033 | if(sxtj.equals("0")){ | 1036 | if(sxtj.equals("0")){ |
| @@ -1248,17 +1251,18 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1248,17 +1251,18 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1248 | if(zlc>0){ | 1251 | if(zlc>0){ |
| 1249 | long l=0l; | 1252 | long l=0l; |
| 1250 | double ylxs=0.0; | 1253 | double ylxs=0.0; |
| 1251 | - if(i==iterator2.size()){ | 1254 | + if(i==iterator2.size()-1){ |
| 1252 | ylxs=czyl; | 1255 | ylxs=czyl; |
| 1253 | }else{ | 1256 | }else{ |
| 1254 | l=Math.round(nextJzyl); | 1257 | l=Math.round(nextJzyl); |
| 1255 | ylxs=l*100/100; | 1258 | ylxs=l*100/100; |
| 1256 | } | 1259 | } |
| 1257 | -// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); | ||
| 1258 | yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl)); | 1260 | yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl)); |
| 1259 | t.setYh(yh); | 1261 | t.setYh(yh); |
| 1260 | t.setJzyl(ylxs); | 1262 | t.setJzyl(ylxs); |
| 1261 | nextJzyl=ylxs; | 1263 | nextJzyl=ylxs; |
| 1264 | + | ||
| 1265 | + | ||
| 1262 | }else{ | 1266 | }else{ |
| 1263 | t.setYh(yh); | 1267 | t.setYh(yh); |
| 1264 | t.setJzyl(nextJzyl); | 1268 | t.setJzyl(nextJzyl); |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -10,11 +10,12 @@ import com.bsth.controller.realcontrol.dto.DfsjChange; | @@ -10,11 +10,12 @@ import com.bsth.controller.realcontrol.dto.DfsjChange; | ||
| 10 | import com.bsth.controller.realcontrol.dto.LpData; | 10 | import com.bsth.controller.realcontrol.dto.LpData; |
| 11 | import com.bsth.data.BasicData; | 11 | import com.bsth.data.BasicData; |
| 12 | import com.bsth.data.LineConfigData; | 12 | import com.bsth.data.LineConfigData; |
| 13 | -import com.bsth.data.msg_queue.DirectivePushQueue; | ||
| 14 | import com.bsth.data.schedule.DayOfSchedule; | 13 | import com.bsth.data.schedule.DayOfSchedule; |
| 15 | import com.bsth.data.schedule.SchAttrCalculator; | 14 | import com.bsth.data.schedule.SchAttrCalculator; |
| 16 | -import com.bsth.data.schedule.edit_logs.FormLogger; | ||
| 17 | import com.bsth.data.schedule.ScheduleComparator; | 15 | import com.bsth.data.schedule.ScheduleComparator; |
| 16 | +import com.bsth.data.schedule.edit_logs.FormLogger; | ||
| 17 | +import com.bsth.data.schedule.edit_logs.ScheduleModifyLogger; | ||
| 18 | +import com.bsth.data.schedule.edit_logs.loggers.FcxxwtLogger; | ||
| 18 | import com.bsth.data.schedule.late_adjust.LateAdjustHandle; | 19 | import com.bsth.data.schedule.late_adjust.LateAdjustHandle; |
| 19 | import com.bsth.entity.Cars; | 20 | import com.bsth.entity.Cars; |
| 20 | import com.bsth.entity.Line; | 21 | import com.bsth.entity.Line; |
| @@ -221,6 +222,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -221,6 +222,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 221 | schedule.setRealExecDate(schedule.getScheduleDateStr()); | 222 | schedule.setRealExecDate(schedule.getScheduleDateStr()); |
| 222 | } | 223 | } |
| 223 | 224 | ||
| 225 | + //记录日志 | ||
| 226 | + ScheduleModifyLogger.dftz(schedule,opType, schedule.getDfsj(),dfsj,remarks); | ||
| 227 | + | ||
| 224 | schedule.setDfsjAll(dfsj); | 228 | schedule.setDfsjAll(dfsj); |
| 225 | schedule.setDfAuto(false); | 229 | schedule.setDfAuto(false); |
| 226 | schedule.addRemarks(remarks); | 230 | schedule.addRemarks(remarks); |
| @@ -276,6 +280,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -276,6 +280,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 276 | map.put("msg", "不必要的重复烂班!"); | 280 | map.put("msg", "不必要的重复烂班!"); |
| 277 | return map; | 281 | return map; |
| 278 | } | 282 | } |
| 283 | + //记录日志 | ||
| 284 | + ScheduleModifyLogger.jhlb(schedule, remarks); | ||
| 279 | 285 | ||
| 280 | schedule.setAdjustExps(reason); | 286 | schedule.setAdjustExps(reason); |
| 281 | schedule.destroy(); | 287 | schedule.destroy(); |
| @@ -1043,6 +1049,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1043,6 +1049,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1043 | sch.setRealExecDate(sch.getScheduleDateStr()); | 1049 | sch.setRealExecDate(sch.getScheduleDateStr()); |
| 1044 | } | 1050 | } |
| 1045 | 1051 | ||
| 1052 | + //日志记录 | ||
| 1053 | + ScheduleModifyLogger.sftz(sch, fcsjActual, remarks); | ||
| 1054 | + | ||
| 1046 | sch.setFcsjActualAll(fcsjActual); | 1055 | sch.setFcsjActualAll(fcsjActual); |
| 1047 | sch.addRemarks(remarks); | 1056 | sch.addRemarks(remarks); |
| 1048 | sch.calcStatus(); | 1057 | sch.calcStatus(); |
| @@ -1078,6 +1087,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1078,6 +1087,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1078 | rs.put("status", ResponseCode.ERROR); | 1087 | rs.put("status", ResponseCode.ERROR); |
| 1079 | rs.put("msg", "未烂班,无法撤销!"); | 1088 | rs.put("msg", "未烂班,无法撤销!"); |
| 1080 | } else { | 1089 | } else { |
| 1090 | + //日志记录 | ||
| 1091 | + ScheduleModifyLogger.cxlb(sch); | ||
| 1092 | + | ||
| 1081 | sch.setStatus(0); | 1093 | sch.setStatus(0); |
| 1082 | sch.setRemarks("");//清空备注 | 1094 | sch.setRemarks("");//清空备注 |
| 1083 | sch.setJhlc(sch.getJhlcOrig()); | 1095 | sch.setJhlc(sch.getJhlcOrig()); |
| @@ -1117,6 +1129,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1117,6 +1129,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1117 | break; | 1129 | break; |
| 1118 | } | 1130 | } |
| 1119 | }*/ | 1131 | }*/ |
| 1132 | + //日志记录 | ||
| 1133 | + ScheduleModifyLogger.cxsf(sch); | ||
| 1120 | 1134 | ||
| 1121 | sch.clearFcsjActual(); | 1135 | sch.clearFcsjActual(); |
| 1122 | rs.put("status", ResponseCode.SUCCESS); | 1136 | rs.put("status", ResponseCode.SUCCESS); |
| @@ -1163,7 +1177,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1163,7 +1177,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1163 | sch = list.get(i); | 1177 | sch = list.get(i); |
| 1164 | 1178 | ||
| 1165 | //调整待发 | 1179 | //调整待发 |
| 1166 | - outgoAdjust(sch.getId(), null, fmtHHmm.print(st), null, "间隔调整"); | 1180 | + outgoAdjust(sch.getId(), null, fmtHHmm.print(st), null, "3"); |
| 1167 | } | 1181 | } |
| 1168 | 1182 | ||
| 1169 | rs.put("status", ResponseCode.SUCCESS); | 1183 | rs.put("status", ResponseCode.SUCCESS); |
| @@ -1186,6 +1200,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1186,6 +1200,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1186 | List<ScheduleRealInfo> ts = new ArrayList<>(); | 1200 | List<ScheduleRealInfo> ts = new ArrayList<>(); |
| 1187 | try { | 1201 | try { |
| 1188 | Long id = Long.parseLong(map.get("id")); | 1202 | Long id = Long.parseLong(map.get("id")); |
| 1203 | + String remarks = map.get("remarks"); | ||
| 1204 | + | ||
| 1189 | ScheduleRealInfo sch = dayOfSchedule.get(id); | 1205 | ScheduleRealInfo sch = dayOfSchedule.get(id); |
| 1190 | 1206 | ||
| 1191 | if(null == sch){ | 1207 | if(null == sch){ |
| @@ -1194,6 +1210,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1194,6 +1210,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1194 | return rs; | 1210 | return rs; |
| 1195 | } | 1211 | } |
| 1196 | 1212 | ||
| 1213 | + //日志记录器 | ||
| 1214 | + FcxxwtLogger fLog = FcxxwtLogger.start(sch, remarks); | ||
| 1215 | + | ||
| 1197 | String clZbh = map.get("clZbh"); | 1216 | String clZbh = map.get("clZbh"); |
| 1198 | String jsy = map.get("jsy"); | 1217 | String jsy = map.get("jsy"); |
| 1199 | if(!clZbh.equals(sch.getClZbh()) | 1218 | if(!clZbh.equals(sch.getClZbh()) |
| @@ -1208,7 +1227,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1208,7 +1227,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1208 | rs.put("status", ResponseCode.ERROR); | 1227 | rs.put("status", ResponseCode.ERROR); |
| 1209 | rs.put("msg", "车辆 " + clZbh + " 不存在!"); | 1228 | rs.put("msg", "车辆 " + clZbh + " 不存在!"); |
| 1210 | return rs; | 1229 | return rs; |
| 1211 | - } else { | 1230 | + } else if(!clZbh.equals(sch.getClZbh())){ |
| 1231 | + fLog.log("换车", sch.getClZbh(), clZbh); | ||
| 1212 | dayOfSchedule.changeCar(sch, clZbh); | 1232 | dayOfSchedule.changeCar(sch, clZbh); |
| 1213 | } | 1233 | } |
| 1214 | } | 1234 | } |
| @@ -1224,7 +1244,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1224,7 +1244,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1224 | rs.put("status", ResponseCode.ERROR); | 1244 | rs.put("status", ResponseCode.ERROR); |
| 1225 | return rs; | 1245 | return rs; |
| 1226 | } | 1246 | } |
| 1227 | - persoChange(sch, jGh); | 1247 | + else if(!jGh.equals(sch.getjGh())){ |
| 1248 | + fLog.log("换驾驶员", sch.getjGh() + "/" + sch.getjName(), jsy); | ||
| 1249 | + persoChange(sch, jGh); | ||
| 1250 | + } | ||
| 1228 | } | 1251 | } |
| 1229 | 1252 | ||
| 1230 | /** | 1253 | /** |
| @@ -1239,9 +1262,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1239,9 +1262,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1239 | rs.put("status", ResponseCode.ERROR); | 1262 | rs.put("status", ResponseCode.ERROR); |
| 1240 | return rs; | 1263 | return rs; |
| 1241 | } | 1264 | } |
| 1242 | - persoChangeSPY(sch, sGh); | 1265 | + else if(!sGh.equals(sch.getsGh())){ |
| 1266 | + fLog.log("换售票员", sch.getsGh() + "/" + sch.getsName(), spy); | ||
| 1267 | + persoChangeSPY(sch, sGh); | ||
| 1268 | + } | ||
| 1243 | } | 1269 | } |
| 1244 | - else{ | 1270 | + else if(StringUtils.isNotEmpty(sch.getsGh())){ |
| 1271 | + fLog.log("撤销售票员"); | ||
| 1245 | sch.setsGh(""); | 1272 | sch.setsGh(""); |
| 1246 | sch.setsName(""); | 1273 | sch.setsName(""); |
| 1247 | } | 1274 | } |
| @@ -1261,6 +1288,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1261,6 +1288,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1261 | else | 1288 | else |
| 1262 | t = fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr() + fcsjActual); | 1289 | t = fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr() + fcsjActual); |
| 1263 | 1290 | ||
| 1291 | + fLog.log("调整实发时间", sch.getFcsjActual(), fcsjActual); | ||
| 1264 | sch.setFcsjActualAll(t); | 1292 | sch.setFcsjActualAll(t); |
| 1265 | //取消应发未到标记 | 1293 | //取消应发未到标记 |
| 1266 | if(sch.isLate2()){ | 1294 | if(sch.isLate2()){ |
| @@ -1268,6 +1296,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1268,6 +1296,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1268 | LateAdjustHandle.remove(sch); | 1296 | LateAdjustHandle.remove(sch); |
| 1269 | } | 1297 | } |
| 1270 | } else if (StringUtils.isNotEmpty(sch.getFcsjActual()) && StringUtils.isEmpty(fcsjActual)){ | 1298 | } else if (StringUtils.isNotEmpty(sch.getFcsjActual()) && StringUtils.isEmpty(fcsjActual)){ |
| 1299 | + fLog.log("撤销实发时间", sch.getFcsjActual(), ""); | ||
| 1271 | //撤销实发 | 1300 | //撤销实发 |
| 1272 | revokeRealOutgo(sch.getId()); | 1301 | revokeRealOutgo(sch.getId()); |
| 1273 | } | 1302 | } |
| @@ -1280,6 +1309,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1280,6 +1309,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1280 | && !zdsjActual.equals(sch.getZdsjActual())) { | 1309 | && !zdsjActual.equals(sch.getZdsjActual())) { |
| 1281 | 1310 | ||
| 1282 | //调整实达 | 1311 | //调整实达 |
| 1312 | + fLog.log("调整实达时间", sch.getZdsjActual(), zdsjActual); | ||
| 1283 | sch.setZdsjActualAll(zdsjActual); | 1313 | sch.setZdsjActualAll(zdsjActual); |
| 1284 | //路牌下一班起点到达时间 | 1314 | //路牌下一班起点到达时间 |
| 1285 | ScheduleRealInfo next = dayOfSchedule.nextByLp(sch); | 1315 | ScheduleRealInfo next = dayOfSchedule.nextByLp(sch); |
| @@ -1289,19 +1319,20 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1289,19 +1319,20 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1289 | ts.add(next); | 1319 | ts.add(next); |
| 1290 | } | 1320 | } |
| 1291 | 1321 | ||
| 1292 | - try{ | 1322 | +/* try{ |
| 1293 | //车辆下一个要执行的班次 | 1323 | //车辆下一个要执行的班次 |
| 1294 | ScheduleRealInfo carNext = dayOfSchedule.next(sch); | 1324 | ScheduleRealInfo carNext = dayOfSchedule.next(sch); |
| 1295 | if(carNext != null && !carNext.getXlBm().equals(sch.getXlBm())){ | 1325 | if(carNext != null && !carNext.getXlBm().equals(sch.getXlBm())){ |
| 1296 | DirectivePushQueue.put64(carNext.getClZbh(), carNext.getXlBm(), "套跑@系统"); | 1326 | DirectivePushQueue.put64(carNext.getClZbh(), carNext.getXlBm(), "套跑@系统"); |
| 1297 | - //directiveService.lineChange(carNext.getClZbh(), carNext.getXlBm(), "套跑@系统"); | 1327 | + fLog.log("下发线路切换指令", sch.getXlName(), carNext.getXlName()); |
| 1298 | } | 1328 | } |
| 1299 | - }catch (Exception e){logger.error("", e);} | 1329 | + }catch (Exception e){logger.error("", e);}*/ |
| 1300 | 1330 | ||
| 1301 | //重新计算车辆执行班次 | 1331 | //重新计算车辆执行班次 |
| 1302 | dayOfSchedule.reCalcExecPlan(sch.getClZbh()); | 1332 | dayOfSchedule.reCalcExecPlan(sch.getClZbh()); |
| 1303 | } else if(StringUtils.isNotEmpty(sch.getZdsjActual()) && StringUtils.isEmpty(zdsjActual)){ | 1333 | } else if(StringUtils.isNotEmpty(sch.getZdsjActual()) && StringUtils.isEmpty(zdsjActual)){ |
| 1304 | //清除实达时间 | 1334 | //清除实达时间 |
| 1335 | + fLog.log("撤销实达时间", sch.getZdsjActual(), ""); | ||
| 1305 | sch.clearZdsjActual(); | 1336 | sch.clearZdsjActual(); |
| 1306 | //清除路牌下一班起点到达时间 | 1337 | //清除路牌下一班起点到达时间 |
| 1307 | ScheduleRealInfo next = dayOfSchedule.nextByLp(sch); | 1338 | ScheduleRealInfo next = dayOfSchedule.nextByLp(sch); |
| @@ -1316,7 +1347,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1316,7 +1347,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1316 | /** | 1347 | /** |
| 1317 | * 备注 | 1348 | * 备注 |
| 1318 | */ | 1349 | */ |
| 1319 | - sch.setRemarks(map.get("remarks")); | 1350 | + sch.setRemarks(remarks); |
| 1320 | 1351 | ||
| 1321 | /** | 1352 | /** |
| 1322 | * 烂班 | 1353 | * 烂班 |
| @@ -1324,6 +1355,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1324,6 +1355,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1324 | if (map.get("status") != null | 1355 | if (map.get("status") != null |
| 1325 | && Integer.parseInt(map.get("status").toString()) == -1) { | 1356 | && Integer.parseInt(map.get("status").toString()) == -1) { |
| 1326 | destroy(sch.getId() + "", "", map.get("adjustExps").toString()); | 1357 | destroy(sch.getId() + "", "", map.get("adjustExps").toString()); |
| 1358 | + fLog.log("烂班"); | ||
| 1327 | } | 1359 | } |
| 1328 | 1360 | ||
| 1329 | /** | 1361 | /** |
| @@ -1333,9 +1365,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1333,9 +1365,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1333 | if (StringUtils.isNotEmpty(jhlc)) { | 1365 | if (StringUtils.isNotEmpty(jhlc)) { |
| 1334 | double jhlcNum = Double.parseDouble(jhlc); | 1366 | double jhlcNum = Double.parseDouble(jhlc); |
| 1335 | //烂班 | 1367 | //烂班 |
| 1336 | - if(jhlcNum == 0 && sch.getJhlcOrig() != 0 && !sch._isInout()) | 1368 | + if(jhlcNum == 0 && sch.getJhlcOrig() != 0 && !sch._isInout() && !sch.isDestroy()){ |
| 1337 | destroy(sch.getId() + "", "", map.get("adjustExps").toString()); | 1369 | destroy(sch.getId() + "", "", map.get("adjustExps").toString()); |
| 1370 | + fLog.log("里程设置为0,自动烂班"); | ||
| 1371 | + } | ||
| 1338 | else if(jhlcNum != sch.getJhlc()){ | 1372 | else if(jhlcNum != sch.getJhlc()){ |
| 1373 | + fLog.log("设置里程", sch.getJhlc(), jhlcNum); | ||
| 1339 | sch.setJhlc(jhlcNum); | 1374 | sch.setJhlc(jhlcNum); |
| 1340 | //临加班次,实际计划一起改 | 1375 | //临加班次,实际计划一起改 |
| 1341 | if(sch.isSflj()) | 1376 | if(sch.isSflj()) |
| @@ -1347,7 +1382,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1347,7 +1382,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1347 | * 修改班次类型 | 1382 | * 修改班次类型 |
| 1348 | */ | 1383 | */ |
| 1349 | String bcType = map.get("bcType"); | 1384 | String bcType = map.get("bcType"); |
| 1350 | - if (StringUtils.isNotEmpty(bcType)) { | 1385 | + if (StringUtils.isNotEmpty(bcType) && !bcType.equals(sch.getBcType())) { |
| 1386 | + fLog.log("修改班次类型", sch.getBcType(), bcType); | ||
| 1351 | sch.setBcType(bcType); | 1387 | sch.setBcType(bcType); |
| 1352 | } | 1388 | } |
| 1353 | 1389 | ||
| @@ -1359,6 +1395,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1359,6 +1395,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1359 | 1395 | ||
| 1360 | rs.put("status", ResponseCode.SUCCESS); | 1396 | rs.put("status", ResponseCode.SUCCESS); |
| 1361 | rs.put("ts", ts); | 1397 | rs.put("ts", ts); |
| 1398 | + | ||
| 1399 | + //日志记录结束 | ||
| 1400 | + fLog.end(); | ||
| 1362 | } catch (Exception e) { | 1401 | } catch (Exception e) { |
| 1363 | logger.error("", e); | 1402 | logger.error("", e); |
| 1364 | rs.put("status", ResponseCode.ERROR); | 1403 | rs.put("status", ResponseCode.ERROR); |
| @@ -1383,7 +1422,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1383,7 +1422,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1383 | schedule = dayOfSchedule.get(id); | 1422 | schedule = dayOfSchedule.get(id); |
| 1384 | 1423 | ||
| 1385 | if(schedule != null) | 1424 | if(schedule != null) |
| 1386 | - outgoAdjust(id, null, dfsj, null, "批量调整"); | 1425 | + outgoAdjust(id, null, dfsj, null, "2"); |
| 1387 | } | 1426 | } |
| 1388 | 1427 | ||
| 1389 | rs.put("status", ResponseCode.SUCCESS); | 1428 | rs.put("status", ResponseCode.SUCCESS); |
| @@ -2894,7 +2933,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -2894,7 +2933,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 2894 | list.add(t); | 2933 | list.add(t); |
| 2895 | } | 2934 | } |
| 2896 | 2935 | ||
| 2897 | - List<ScheduleRealInfo> listInfo2 = scheduleRealInfoRepository.scheduleByDateAndLine(line, date); | 2936 | + List<ScheduleRealInfo> listInfo2 = scheduleRealInfoRepository.scheduleByDateAndLineQp2(line, date); |
| 2898 | List<ScheduleRealInfo> xList = new ArrayList<ScheduleRealInfo>(); | 2937 | List<ScheduleRealInfo> xList = new ArrayList<ScheduleRealInfo>(); |
| 2899 | List<ScheduleRealInfo> yList = new ArrayList<ScheduleRealInfo>(); | 2938 | List<ScheduleRealInfo> yList = new ArrayList<ScheduleRealInfo>(); |
| 2900 | List<ScheduleRealInfo> zList = new ArrayList<ScheduleRealInfo>(); | 2939 | List<ScheduleRealInfo> zList = new ArrayList<ScheduleRealInfo>(); |
| @@ -3117,9 +3156,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -3117,9 +3156,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 3117 | Double jccgl=culateMieageService.culateJccgl(listS); | 3156 | Double jccgl=culateMieageService.culateJccgl(listS); |
| 3118 | Double zyygl=Arith.add(sjgl, ljgl); | 3157 | Double zyygl=Arith.add(sjgl, ljgl); |
| 3119 | Double zksgl=Arith.add(ksgl, jccgl); | 3158 | Double zksgl=Arith.add(ksgl, jccgl); |
| 3120 | - yesterdayDataList.get(x).put("totalKilometers", Arith.add(zyygl, zksgl)); | 3159 | + Double zlc=Arith.add(zyygl, zksgl); |
| 3160 | + yesterdayDataList.get(x).put("totalKilometers", zlc); | ||
| 3121 | 3161 | ||
| 3122 | } | 3162 | } |
| 3163 | + for (int i = 0; i < yesterdayDataList.size(); i++) { | ||
| 3164 | + Map<String, Object> map=yesterdayDataList.get(i); | ||
| 3165 | + Double zlc=map.get("totalKilometers")==null?0.0:Double.parseDouble(map.get("totalKilometers").toString()); | ||
| 3166 | + if(zlc<=0){ | ||
| 3167 | + yesterdayDataList.remove(map); | ||
| 3168 | + } | ||
| 3169 | + } | ||
| 3123 | //增加顺序号 | 3170 | //增加顺序号 |
| 3124 | for (int i = 0; i < yesterdayDataList.size(); i++) { | 3171 | for (int i = 0; i < yesterdayDataList.size(); i++) { |
| 3125 | if (i == 0) { | 3172 | if (i == 0) { |
| @@ -3144,7 +3191,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -3144,7 +3191,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 3144 | Set<ScheduleRealInfo> set = new HashSet<>(); | 3191 | Set<ScheduleRealInfo> set = new HashSet<>(); |
| 3145 | 3192 | ||
| 3146 | ScheduleRealInfo sch; | 3193 | ScheduleRealInfo sch; |
| 3147 | - //BiMap<String, String> map = BasicData.deviceId2NbbmMap.inverse(); | ||
| 3148 | 3194 | ||
| 3149 | String jGh = null,jName,sGh,sName; | 3195 | String jGh = null,jName,sGh,sName; |
| 3150 | for (ChangePersonCar cpc : cpcs) { | 3196 | for (ChangePersonCar cpc : cpcs) { |
| @@ -3171,6 +3217,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -3171,6 +3217,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 3171 | 3217 | ||
| 3172 | //为换人换车情况表写入数据 | 3218 | //为换人换车情况表写入数据 |
| 3173 | schModifyLog.saveChangetochange(sch, cpc); | 3219 | schModifyLog.saveChangetochange(sch, cpc); |
| 3220 | + //日志记录 | ||
| 3221 | + ScheduleModifyLogger.tzrc(sch, cpc); | ||
| 3174 | 3222 | ||
| 3175 | if (StringUtils.isNotEmpty(cpc.getJsy())) { | 3223 | if (StringUtils.isNotEmpty(cpc.getJsy())) { |
| 3176 | //换驾驶员 | 3224 | //换驾驶员 |
| @@ -3257,7 +3305,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -3257,7 +3305,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 3257 | if (StringUtils.isEmpty(dc.getOld_dfsj()) || StringUtils.isEmpty(dc.getNew_dfsj())) | 3305 | if (StringUtils.isEmpty(dc.getOld_dfsj()) || StringUtils.isEmpty(dc.getNew_dfsj())) |
| 3258 | continue; | 3306 | continue; |
| 3259 | 3307 | ||
| 3260 | - tempMap = outgoAdjust(dc.getSchId(), "", dc.getNew_dfsj(), null, "批量调整"); | 3308 | + tempMap = outgoAdjust(dc.getSchId(), "", dc.getNew_dfsj(), null, "2"); |
| 3261 | 3309 | ||
| 3262 | if (tempMap.get("status").equals(ResponseCode.SUCCESS)) { | 3310 | if (tempMap.get("status").equals(ResponseCode.SUCCESS)) { |
| 3263 | list.addAll((Collection<? extends ScheduleRealInfo>) tempMap.get("ts")); | 3311 | list.addAll((Collection<? extends ScheduleRealInfo>) tempMap.get("ts")); |
| @@ -4534,6 +4582,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -4534,6 +4582,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 4534 | rs.put("status", ResponseCode.ERROR); | 4582 | rs.put("status", ResponseCode.ERROR); |
| 4535 | rs.put("msg", "班次未执行,无法撤销!"); | 4583 | rs.put("msg", "班次未执行,无法撤销!"); |
| 4536 | } else { | 4584 | } else { |
| 4585 | + //日志记录 | ||
| 4586 | + ScheduleModifyLogger.cxzx(sch); | ||
| 4537 | 4587 | ||
| 4538 | sch.clearFcsjActual(); | 4588 | sch.clearFcsjActual(); |
| 4539 | sch.clearZdsjActual(); | 4589 | sch.clearZdsjActual(); |
src/main/java/com/bsth/service/report/SheetService.java
0 → 100644
| 1 | +package com.bsth.service.report; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import com.bsth.entity.sheet.Sheet; | ||
| 7 | +import com.bsth.service.BaseService; | ||
| 8 | + | ||
| 9 | +public interface SheetService extends BaseService<Sheet, Integer>{ | ||
| 10 | + public List<Map<String, Object>> bcPunctual(Map<String, Object> map); | ||
| 11 | + public String saveSheetList() throws Exception; | ||
| 12 | + public List<Map<String, Object>> countList(Map<String, Object> map); | ||
| 13 | + | ||
| 14 | + public List<Sheet> sheetList(Integer id); | ||
| 15 | +} |
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
| @@ -375,11 +375,11 @@ public class ReportServiceImpl implements ReportService{ | @@ -375,11 +375,11 @@ public class ReportServiceImpl implements ReportService{ | ||
| 375 | String[] minSjs = minfcsj.split(":"); | 375 | String[] minSjs = minfcsj.split(":"); |
| 376 | int minSj=Integer.parseInt(minSjs[0])*60+Integer.parseInt(minSjs[1]); | 376 | int minSj=Integer.parseInt(minSjs[0])*60+Integer.parseInt(minSjs[1]); |
| 377 | //查询时间里程 | 377 | //查询时间里程 |
| 378 | - String sqlPc=" (SELECT jhlc,fcsj,bc_type,lp,2 as xh FROM bsth_c_s_ttinfo_detail " | 378 | + String sqlPc=" (SELECT jhlc,fcsj,bc_type,lp,2 as xh, ists FROM bsth_c_s_ttinfo_detail " |
| 379 | + " where ttinfo ='"+ttinfo+"' and fcsj <='"+minfcsj+"' ) " | 379 | + " where ttinfo ='"+ttinfo+"' and fcsj <='"+minfcsj+"' ) " |
| 380 | + " union " | 380 | + " union " |
| 381 | - + " (SELECT jhlc,fcsj,bc_type,lp,1 as xh FROM bsth_c_s_ttinfo_detail " | ||
| 382 | - + " where ttinfo ='"+ttinfo+"' and fcsj > '"+minfcsj+"') order by lp,xh,fcsj"; | 381 | + + " (SELECT jhlc,fcsj,bc_type,lp,1 as xh, ists FROM bsth_c_s_ttinfo_detail " |
| 382 | + + " where ttinfo ='"+ttinfo+"' and fcsj > '"+minfcsj+"') order by lp,xh,fcsj"; | ||
| 383 | 383 | ||
| 384 | Map<String, Object> map=new HashMap<String,Object>(); | 384 | Map<String, Object> map=new HashMap<String,Object>(); |
| 385 | List<Map<String, Object>> list= jdbcTemplate.query(sqlPc, | 385 | List<Map<String, Object>> list= jdbcTemplate.query(sqlPc, |
| @@ -391,6 +391,7 @@ public class ReportServiceImpl implements ReportService{ | @@ -391,6 +391,7 @@ public class ReportServiceImpl implements ReportService{ | ||
| 391 | m.put("yygl", rs.getString("jhlc")==null?"0":rs.getString("jhlc")); | 391 | m.put("yygl", rs.getString("jhlc")==null?"0":rs.getString("jhlc")); |
| 392 | m.put("bcType", rs.getString("bc_type")); | 392 | m.put("bcType", rs.getString("bc_type")); |
| 393 | m.put("lp", rs.getString("lp")); | 393 | m.put("lp", rs.getString("lp")); |
| 394 | + m.put("ists", rs.getObject("ists")==null?"0":rs.getString("ists")); | ||
| 394 | return m; | 395 | return m; |
| 395 | } | 396 | } |
| 396 | }); | 397 | }); |
| @@ -451,6 +452,9 @@ public class ReportServiceImpl implements ReportService{ | @@ -451,6 +452,9 @@ public class ReportServiceImpl implements ReportService{ | ||
| 451 | lp=m.get("lp").toString(); | 452 | lp=m.get("lp").toString(); |
| 452 | 453 | ||
| 453 | } | 454 | } |
| 455 | + if(m.containsKey("ists") && m.get("ists").equals("1")){ | ||
| 456 | + sj = 0; | ||
| 457 | + } | ||
| 454 | } | 458 | } |
| 455 | if(yysj>0){ | 459 | if(yysj>0){ |
| 456 | yycs =yygl/(yysj*1.0/60); | 460 | yycs =yygl/(yysj*1.0/60); |
| @@ -573,191 +577,77 @@ public class ReportServiceImpl implements ReportService{ | @@ -573,191 +577,77 @@ public class ReportServiceImpl implements ReportService{ | ||
| 573 | 577 | ||
| 574 | //查询全程 | 578 | //查询全程 |
| 575 | String sqlqc="select t.*,x.station_name as qdz_name from ( " | 579 | String sqlqc="select t.*,x.station_name as qdz_name from ( " |
| 576 | - + "(SELECT fcsj,qdz,2 as xh,xl_dir FROM bsth_c_s_ttinfo_detail " | ||
| 577 | - + " where ttinfo ='"+ttinfo+"' and bc_type='normal' and fcsj <='"+minfcsj+"' ) " | 580 | + + " (SELECT bc_type, fcsj,qdz,2 as xh,xl_dir FROM bsth_c_s_ttinfo_detail " |
| 581 | + + " where ttinfo ='"+ttinfo+"' and (bc_type='normal' || bc_type='region') " | ||
| 582 | + + " and fcsj <='"+minfcsj+"') " | ||
| 578 | + " union " | 583 | + " union " |
| 579 | - + " (SELECT fcsj,qdz,1 as xh,xl_dir FROM bsth_c_s_ttinfo_detail " | ||
| 580 | - + " where ttinfo ='"+ttinfo+"' and bc_type='normal' and fcsj > '"+minfcsj+"') " | ||
| 581 | - + "order by xl_dir,xh,fcsj ) t left join bsth_c_station x on t.qdz=x.id"; | 584 | + + " (SELECT bc_type, fcsj,qdz,1 as xh,xl_dir FROM bsth_c_s_ttinfo_detail " |
| 585 | + + " where ttinfo ='"+ttinfo+"' and (bc_type='normal' || bc_type='region') " | ||
| 586 | + + " and fcsj > '"+minfcsj+"') " | ||
| 587 | + + "order by xl_dir,xh,fcsj ) t left join bsth_c_station x on t.qdz=x.id"; | ||
| 582 | List<Map<String, String>> qclist= jdbcTemplate.query(sqlqc, | 588 | List<Map<String, String>> qclist= jdbcTemplate.query(sqlqc, |
| 583 | new RowMapper<Map<String, String>>(){ | 589 | new RowMapper<Map<String, String>>(){ |
| 584 | @Override | 590 | @Override |
| 585 | - public Map<String, String> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 586 | - Map<String, String> m=new HashMap<String,String>(); | ||
| 587 | - m.put("qdz_name", rs.getString("qdz_name")); | ||
| 588 | - m.put("fcsj", rs.getString("fcsj")); | ||
| 589 | - m.put("xl", rs.getString("xl_dir")); | ||
| 590 | - return m; | ||
| 591 | - } | 591 | + public Map<String, String> mapRow(ResultSet rs, int rowNum) throws SQLException { |
| 592 | + Map<String, String> m=new HashMap<String,String>(); | ||
| 593 | + m.put("qdz_name", rs.getString("qdz_name")); | ||
| 594 | + m.put("bcType", rs.getString("bc_type")); | ||
| 595 | + m.put("fcsj", rs.getString("fcsj")); | ||
| 596 | + m.put("xl", rs.getString("xl_dir")); | ||
| 597 | + m.put("xh", rs.getString("xh")); | ||
| 598 | + return m; | ||
| 599 | + } | ||
| 592 | 600 | ||
| 593 | }); | 601 | }); |
| 594 | - | ||
| 595 | - Map<String, Object> qcMap=new HashMap<String,Object>(); | ||
| 596 | - int num=0; | ||
| 597 | - String sxfcsj=""; | ||
| 598 | - String xxfcsj=""; | ||
| 599 | - String sxzd=""; | ||
| 600 | - String xxzd=""; | ||
| 601 | - for (int i = 0; i < qclist.size(); i++) { | ||
| 602 | - Map<String, String> map=qclist.get(i); | ||
| 603 | - if(map.get("xl").equals("0")){ | ||
| 604 | - if(sxzd.equals("")){ | ||
| 605 | - sxzd=map.get("qdz_name").toString(); | ||
| 606 | - qcMap.put("sxzm", sxzd); | ||
| 607 | - sxfcsj +=map.get("fcsj").toString()+"-"; | ||
| 608 | - } | ||
| 609 | - if(!(qclist.get(i+1).get("xl").equals("0"))){ | ||
| 610 | - sxfcsj +=map.get("fcsj").toString(); | ||
| 611 | - qcMap.put("sxsj",sxfcsj); | ||
| 612 | - qcMap.put("sxbc", i+1); | ||
| 613 | - num=i+1; | ||
| 614 | - } | ||
| 615 | - } | ||
| 616 | - if(map.get("xl").equals("1")){ | ||
| 617 | - if(xxzd.equals("")){ | ||
| 618 | - xxzd=map.get("qdz_name").toString(); | ||
| 619 | - xxfcsj+=map.get("fcsj").toString()+"-"; | ||
| 620 | - qcMap.put("xxzm", xxzd); | ||
| 621 | - } | 602 | + |
| 603 | + List<List<Map<String, String>>> mapList = new ArrayList<List<Map<String,String>>>(); | ||
| 604 | + mapList.add(new ArrayList<Map<String, String>>()); | ||
| 605 | + mapList.add(new ArrayList<Map<String, String>>()); | ||
| 606 | + for(Map<String, String> m : qclist){ | ||
| 607 | + String bcType = m.get("bcType"); | ||
| 608 | + if(bcType.equals("normal")){ | ||
| 609 | + mapList.get(0).add(m); | ||
| 610 | + } else { | ||
| 611 | + mapList.get(1).add(m); | ||
| 622 | } | 612 | } |
| 623 | } | 613 | } |
| 624 | - xxfcsj +=qclist.get(qclist.size()-1).get("fcsj").toString(); | ||
| 625 | - qcMap.put("xxsj", xxfcsj); | ||
| 626 | - qcMap.put("xxbc", qclist.size()-num); | ||
| 627 | - list.add(qcMap); | ||
| 628 | - | ||
| 629 | - | ||
| 630 | - //查询区间 | ||
| 631 | - String sqlqj="select t.*,x.station_name as qdz_name from ( " | ||
| 632 | - + "(SELECT fcsj,qdz,'1' as gf,xl_dir FROM bsth_c_s_ttinfo_detail " | ||
| 633 | - + "where ttinfo ='"+ttinfo+"' and bc_type='region' and fcsj >='06:31'" | ||
| 634 | - + "and fcsj <'08:30')" | ||
| 635 | - + " union ( SELECT fcsj,qdz,'2' as gf,xl_dir FROM bsth_c_s_ttinfo_detail " | ||
| 636 | - + "where ttinfo ='"+ttinfo+"' and bc_type='region' " | ||
| 637 | - + "and fcsj > '16:01' and fcsj < '18:00') order by xl_dir,gf,fcsj ) t " | ||
| 638 | - + "left join bsth_c_station x on t.qdz=x.id"; | ||
| 639 | - | ||
| 640 | - List<Map<String, String>> qjlist= jdbcTemplate.query(sqlqj, | ||
| 641 | - new RowMapper<Map<String, String>>(){ | ||
| 642 | - @Override | ||
| 643 | - public Map<String, String> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 644 | - Map<String, String> m=new HashMap<String,String>(); | ||
| 645 | - m.put("qdz_name", rs.getString("qdz_name")); | ||
| 646 | - m.put("fcsj", rs.getString("fcsj")); | ||
| 647 | - m.put("xl", rs.getString("xl_dir")); | ||
| 648 | - m.put("gf", rs.getString("gf")); | ||
| 649 | - return m; | ||
| 650 | - } | ||
| 651 | - }); | ||
| 652 | 614 | ||
| 653 | - Map<String, Object> qjzMap=new HashMap<String,Object>(); | ||
| 654 | - Map<String, Object> qjwMap=new HashMap<String,Object>(); | ||
| 655 | - int numqj=0; | ||
| 656 | - String sxfcsjqj=""; | ||
| 657 | - String xxfcsjqj=""; | ||
| 658 | - String sxzdqj=""; | ||
| 659 | - String xxzdqj=""; | ||
| 660 | - for(int i=0;i<qjlist.size();i++){ | ||
| 661 | - Map<String, String> map=qjlist.get(i); | ||
| 662 | - if(map.get("xl").toString().equals("0")){ | ||
| 663 | - if(map.get("gf").toString().equals("1")){ | ||
| 664 | - if(sxzdqj.equals("")){ | ||
| 665 | - sxzdqj =map.get("qdz_name").toString(); | ||
| 666 | - qjzMap.put("sxzm", sxzdqj); | ||
| 667 | - sxfcsjqj +=map.get("fcsj").toString()+"-"; | ||
| 668 | - } | ||
| 669 | - if(i<qjlist.size()-1){ | ||
| 670 | - if(!(qjlist.get(i+1).get("gf").equals("1"))){ | ||
| 671 | - sxfcsjqj +=map.get("fcsj").toString(); | ||
| 672 | - qjzMap.put("sxsj",sxfcsjqj); | ||
| 673 | - qjzMap.put("sxbc", i+1); | ||
| 674 | - numqj=i+1; | ||
| 675 | - sxzdqj =""; | ||
| 676 | - sxfcsjqj=""; | ||
| 677 | - } | ||
| 678 | - }else{ | ||
| 679 | - qjzMap.put("sxsj",sxfcsjqj+"-"+map.get("fcsj").toString()); | ||
| 680 | - qjzMap.put("sxbc", i+1); | ||
| 681 | - numqj=i+1; | ||
| 682 | - sxzdqj =""; | ||
| 683 | - sxfcsjqj=""; | ||
| 684 | - } | ||
| 685 | - } | ||
| 686 | - if(map.get("gf").toString().equals("2")){ | ||
| 687 | - if(sxzdqj.equals("")){ | ||
| 688 | - sxzdqj =map.get("qdz_name").toString(); | ||
| 689 | - qjwMap.put("sxzm", sxzdqj); | ||
| 690 | - sxfcsjqj +=map.get("fcsj").toString()+"-"; | ||
| 691 | - } | ||
| 692 | - if(i<qjlist.size()-1){ | ||
| 693 | - if(!(qjlist.get(i+1).get("xl").equals("0"))){ | ||
| 694 | - sxfcsjqj +=map.get("fcsj").toString(); | ||
| 695 | - qjwMap.put("sxsj",sxfcsjqj); | ||
| 696 | - qjwMap.put("sxbc", i+1-numqj); | ||
| 697 | - numqj=i+1; | ||
| 698 | - } | ||
| 699 | - }else{ | ||
| 700 | - qjwMap.put("sxsj",sxfcsjqj+"-"+map.get("fcsj").toString()); | ||
| 701 | - qjwMap.put("sxbc", i+1-numqj); | ||
| 702 | - numqj=i+1; | ||
| 703 | - } | ||
| 704 | - } | ||
| 705 | - | ||
| 706 | - }else{ | ||
| 707 | - if(map.get("gf").toString().equals("1")){ | ||
| 708 | - if(xxzdqj.equals("")){ | ||
| 709 | - xxzdqj =map.get("qdz_name").toString(); | ||
| 710 | - qjzMap.put("xxzm", xxzdqj); | ||
| 711 | - xxfcsjqj +=map.get("fcsj").toString()+"-"; | ||
| 712 | - } | ||
| 713 | - if(i<qjlist.size()-1){ | ||
| 714 | - if(!(qjlist.get(i+1).get("gf").equals("1"))){ | ||
| 715 | - xxfcsjqj +=map.get("fcsj").toString(); | ||
| 716 | - qjzMap.put("xxsj",xxfcsjqj); | ||
| 717 | - qjzMap.put("xxbc", i+1-numqj); | ||
| 718 | - numqj=i+1; | ||
| 719 | - xxzdqj =""; | ||
| 720 | - xxfcsjqj=""; | ||
| 721 | - } | ||
| 722 | - }else{ | ||
| 723 | - qjzMap.put("xxsj",xxfcsjqj+"-"+map.get("fcsj").toString()); | ||
| 724 | - qjzMap.put("xxbc", i+1-numqj); | ||
| 725 | - numqj=i+1; | ||
| 726 | - xxzdqj =""; | ||
| 727 | - xxfcsjqj=""; | ||
| 728 | - } | ||
| 729 | - } | ||
| 730 | - if(map.get("gf").toString().equals("2")){ | ||
| 731 | - if(xxzdqj.equals("")){ | ||
| 732 | - xxzdqj =map.get("qdz_name").toString(); | ||
| 733 | - qjwMap.put("xxzm", xxzdqj); | ||
| 734 | - xxfcsjqj +=map.get("fcsj").toString()+"-"; | ||
| 735 | - } | ||
| 736 | - if(i<qjlist.size()){ | ||
| 737 | - if(i==qjlist.size()-1){ | ||
| 738 | - xxfcsjqj +=map.get("fcsj").toString(); | ||
| 739 | - qjwMap.put("xxsj",xxfcsjqj); | ||
| 740 | - qjwMap.put("xxbc", i+1-numqj); | ||
| 741 | - numqj=i+1; | ||
| 742 | - } | ||
| 743 | - }else{ | ||
| 744 | - qjwMap.put("xxsj",xxfcsjqj+"-"+xxfcsjqj); | ||
| 745 | - qjwMap.put("xxbc", i+1-numqj); | ||
| 746 | - numqj=i+1; | ||
| 747 | - } | 615 | + for(int i = 0; i < mapList.size(); i++){ |
| 616 | + List<Map<String, String>> l = mapList.get(i); | ||
| 617 | + Map<String, Object> tempMap = new HashMap<String, Object>(); | ||
| 618 | + List<String> upfcsj = new ArrayList<String>(); | ||
| 619 | + List<String> downfcsj = new ArrayList<String>(); | ||
| 620 | + String sxqdz = "", xxqdz = ""; | ||
| 621 | + String sxfcsj = "", xxfcsj = ""; | ||
| 622 | + int sxbc = 0, xxbc = 0; | ||
| 623 | + for(Map<String, String> m : l){ | ||
| 624 | + if(m.get("xl").equals("0")){ | ||
| 625 | + sxbc++; | ||
| 626 | + upfcsj.add(m.get("fcsj")); | ||
| 627 | + if(sxqdz.length() == 0 && m.containsKey("qdz_name")) | ||
| 628 | + sxqdz = m.get("qdz_name"); | ||
| 629 | + } else { | ||
| 630 | + xxbc++; | ||
| 631 | + downfcsj.add(m.get("fcsj")); | ||
| 632 | + if(xxqdz.length() == 0 && m.containsKey("qdz_name")) | ||
| 633 | + xxqdz = m.get("qdz_name"); | ||
| 748 | } | 634 | } |
| 749 | - | ||
| 750 | - | ||
| 751 | } | 635 | } |
| 636 | + if(upfcsj.size() != 0) | ||
| 637 | + sxfcsj = upfcsj.get(0) + "-" + upfcsj.get(upfcsj.size() - 1); | ||
| 638 | + if(downfcsj.size() != 0) | ||
| 639 | + xxfcsj = downfcsj.get(0) + "-" + downfcsj.get(downfcsj.size() - 1); | ||
| 640 | + tempMap.put("sxqdz", sxqdz); | ||
| 641 | + tempMap.put("sxfcsj", i==0?sxfcsj:""); | ||
| 642 | + tempMap.put("sxbc", sxbc!=0?sxbc:""); | ||
| 643 | + tempMap.put("xxqdz", xxqdz); | ||
| 644 | + tempMap.put("xxfcsj", i==0?xxfcsj:""); | ||
| 645 | + tempMap.put("xxbc", xxbc!=0?xxbc:""); | ||
| 646 | + tempMap.put("bcType", i); | ||
| 647 | + if(sxqdz.length()!=0 || xxqdz.length()!=0) | ||
| 648 | + list.add(tempMap); | ||
| 752 | } | 649 | } |
| 753 | 650 | ||
| 754 | - if(!qjzMap.isEmpty()){ | ||
| 755 | - list.add(qjzMap); | ||
| 756 | - } | ||
| 757 | - if(!qjwMap.isEmpty()){ | ||
| 758 | - list.add(qjwMap); | ||
| 759 | - | ||
| 760 | - } | ||
| 761 | return list; | 651 | return list; |
| 762 | } | 652 | } |
| 763 | @Override | 653 | @Override |
| @@ -769,30 +659,36 @@ public class ReportServiceImpl implements ReportService{ | @@ -769,30 +659,36 @@ public class ReportServiceImpl implements ReportService{ | ||
| 769 | String[] minSjs = minfcsj.split(":"); | 659 | String[] minSjs = minfcsj.split(":"); |
| 770 | int minSj=Integer.parseInt(minSjs[0])*60+Integer.parseInt(minSjs[1]); | 660 | int minSj=Integer.parseInt(minSjs[0])*60+Integer.parseInt(minSjs[1]); |
| 771 | //查询时间里程 | 661 | //查询时间里程 |
| 772 | - String sqlPc=" (SELECT jhlc,fcsj,bcsj,bc_type,lp,xl_dir,2 as xh FROM " | 662 | + String sqlPc=" (SELECT jhlc,fcsj,bcsj,bc_type,lp,xl_dir,ists,2 as xh FROM " |
| 773 | + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"' and " | 663 | + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"' and " |
| 774 | - + " fcsj <='"+minfcsj+"' and bc_type = 'normal') " | 664 | + + " fcsj <='"+minfcsj+"' and bc_type!='in' and bc_type!='out' and bc_type!='ldks') " |
| 775 | + " union " | 665 | + " union " |
| 776 | - + " (SELECT jhlc,fcsj,bcsj,bc_type,lp,xl_dir,1 as xh FROM " | 666 | + + " (SELECT jhlc,fcsj,bcsj,bc_type,lp,xl_dir,ists,1 as xh FROM " |
| 777 | + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"' and " | 667 | + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"' and " |
| 778 | - + " fcsj >'"+minfcsj+"' and bc_type ='normal') " | ||
| 779 | - + " order by xl_dir, xh,fcsj"; | ||
| 780 | - | 668 | + + " fcsj > '"+minfcsj+"' and bc_type!='in' and bc_type!='out' and bc_type!='ldks') " |
| 669 | + + " order by xl_dir, xh, fcsj"; | ||
| 781 | Map<String, Object> map=new HashMap<String,Object>(); | 670 | Map<String, Object> map=new HashMap<String,Object>(); |
| 782 | List<Map<String, Object>> list= jdbcTemplate.query(sqlPc, | 671 | List<Map<String, Object>> list= jdbcTemplate.query(sqlPc, |
| 783 | - new RowMapper<Map<String, Object>>(){ | ||
| 784 | - @Override | ||
| 785 | - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 786 | - Map<String, Object> m=new HashMap<String,Object>(); | ||
| 787 | - m.put("fcsj", rs.getString("fcsj")); | ||
| 788 | - m.put("yygl", rs.getString("jhlc")==null?"0":rs.getString("jhlc")); | ||
| 789 | - m.put("bcsj", rs.getString("bcsj")); | ||
| 790 | - m.put("bcType", rs.getString("bc_type")); | ||
| 791 | - m.put("lp", rs.getString("lp")); | ||
| 792 | - m.put("dir", rs.getString("xl_dir")); | ||
| 793 | - return m; | ||
| 794 | - } | ||
| 795 | - }); | 672 | + new RowMapper<Map<String, Object>>(){ |
| 673 | + @Override | ||
| 674 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 675 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 676 | + m.put("fcsj", rs.getString("fcsj")); | ||
| 677 | + m.put("yygl", rs.getString("jhlc")==null?"0":rs.getString("jhlc")); | ||
| 678 | + m.put("bcsj", rs.getString("bcsj")); | ||
| 679 | + m.put("bcType", rs.getString("bc_type")); | ||
| 680 | + m.put("lp", rs.getString("lp")); | ||
| 681 | + m.put("dir", rs.getString("xl_dir")); | ||
| 682 | + m.put("ists", rs.getString("ists")!=null?rs.getString("ists"):""); | ||
| 683 | + | ||
| 684 | + if(rs.getString("xh").equals("2")){ | ||
| 685 | + String[] split = m.get("fcsj").toString().split(":"); | ||
| 686 | + m.put("fcsj", Integer.valueOf(split[0]) + 24 + ":"+split[1]); | ||
| 687 | + } | ||
| 688 | + | ||
| 689 | + return m; | ||
| 690 | + } | ||
| 691 | + }); | ||
| 796 | 692 | ||
| 797 | List<Map<String, Object>> newList=new ArrayList<Map<String,Object>>(); | 693 | List<Map<String, Object>> newList=new ArrayList<Map<String,Object>>(); |
| 798 | Map<String, List<Map<String, Object>>> keyMap = new HashMap<String, List<Map<String, Object>>>(); | 694 | Map<String, List<Map<String, Object>>> keyMap = new HashMap<String, List<Map<String, Object>>>(); |
| @@ -824,8 +720,10 @@ public class ReportServiceImpl implements ReportService{ | @@ -824,8 +720,10 @@ public class ReportServiceImpl implements ReportService{ | ||
| 824 | Map<String, Object> tempMap = new HashMap<String, Object>(); | 720 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| 825 | List<Map<String, Object>> list2 = keyMap.get(key); | 721 | List<Map<String, Object>> list2 = keyMap.get(key); |
| 826 | List<Integer> cjs = new ArrayList<Integer>(); | 722 | List<Integer> cjs = new ArrayList<Integer>(); |
| 827 | - int sxsj = 0, xxsj = 0, zcj = 0; | 723 | + int sxsj = 0, xxsj = 0, zcj = 0, tssj = 0; |
| 724 | + int sxbc = 0, xxbc = 0; | ||
| 828 | int temp = 24*60+1; | 725 | int temp = 24*60+1; |
| 726 | + boolean ists = false; | ||
| 829 | for(Map<String, Object> m : list2){ | 727 | for(Map<String, Object> m : list2){ |
| 830 | String[] split = m.get("fcsj").toString().split(":"); | 728 | String[] split = m.get("fcsj").toString().split(":"); |
| 831 | int fcsj = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); | 729 | int fcsj = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); |
| @@ -833,14 +731,25 @@ public class ReportServiceImpl implements ReportService{ | @@ -833,14 +731,25 @@ public class ReportServiceImpl implements ReportService{ | ||
| 833 | int bcsj = Integer.valueOf(m.get("bcsj").toString()); | 731 | int bcsj = Integer.valueOf(m.get("bcsj").toString()); |
| 834 | if(xlDir == 0){ | 732 | if(xlDir == 0){ |
| 835 | sxsj += bcsj; | 733 | sxsj += bcsj; |
| 734 | + sxbc ++; | ||
| 836 | } else { | 735 | } else { |
| 837 | xxsj += bcsj; | 736 | xxsj += bcsj; |
| 737 | + xxbc ++; | ||
| 838 | } | 738 | } |
| 839 | if(temp >= fcsj){ | 739 | if(temp >= fcsj){ |
| 840 | temp = fcsj; | 740 | temp = fcsj; |
| 741 | + ists = false; | ||
| 841 | } else { | 742 | } else { |
| 842 | - cjs.add(fcsj - temp); | 743 | + if(ists){ |
| 744 | + tssj += fcsj - temp; | ||
| 745 | + ists = false; | ||
| 746 | + } else { | ||
| 747 | + cjs.add(fcsj - temp); | ||
| 748 | + } | ||
| 843 | temp = fcsj; | 749 | temp = fcsj; |
| 750 | + if(m.get("ists").equals("1")){ | ||
| 751 | + ists = true; | ||
| 752 | + } | ||
| 844 | } | 753 | } |
| 845 | } | 754 | } |
| 846 | Collections.sort(cjs); | 755 | Collections.sort(cjs); |
| @@ -848,11 +757,12 @@ public class ReportServiceImpl implements ReportService{ | @@ -848,11 +757,12 @@ public class ReportServiceImpl implements ReportService{ | ||
| 848 | zcj += i; | 757 | zcj += i; |
| 849 | } | 758 | } |
| 850 | tempMap.put("sjd", key); | 759 | tempMap.put("sjd", key); |
| 851 | - tempMap.put("sxsj", sxsj); | ||
| 852 | - tempMap.put("xxsj", xxsj); | ||
| 853 | - tempMap.put("fqsj", sxsj + xxsj); | 760 | + tempMap.put("sxsj", sxsj / sxbc); |
| 761 | + tempMap.put("xxsj", xxsj / xxbc); | ||
| 762 | + tempMap.put("fqsj", (sxsj + xxsj) / list2.size()); | ||
| 854 | tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——"); | 763 | tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——"); |
| 855 | - tempMap.put("pjcj", cjs.size()>0?zcj/(cjs.size()-1):"/"); | 764 | + tempMap.put("pjcj", cjs.size()>0?zcj/cjs.size():"/"); |
| 765 | + tempMap.put("tssj", tssj); | ||
| 856 | maps.put(key, tempMap); | 766 | maps.put(key, tempMap); |
| 857 | } | 767 | } |
| 858 | newList.add(maps.get("(首)——6:30")); | 768 | newList.add(maps.get("(首)——6:30")); |
src/main/java/com/bsth/service/report/impl/SheetServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.report.impl; | ||
| 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; | ||
| 8 | +import java.util.ArrayList; | ||
| 9 | +import java.util.Calendar; | ||
| 10 | +import java.util.Collections; | ||
| 11 | +import java.util.Comparator; | ||
| 12 | +import java.util.Date; | ||
| 13 | +import java.util.GregorianCalendar; | ||
| 14 | +import java.util.HashMap; | ||
| 15 | +import java.util.Iterator; | ||
| 16 | +import java.util.List; | ||
| 17 | +import java.util.Map; | ||
| 18 | +import java.util.Set; | ||
| 19 | + | ||
| 20 | +import javax.transaction.Transactional; | ||
| 21 | + | ||
| 22 | +import org.apache.poi.hssf.eventusermodel.EventWorkbookBuilder.SheetRecordCollectingListener; | ||
| 23 | +import org.slf4j.Logger; | ||
| 24 | +import org.slf4j.LoggerFactory; | ||
| 25 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 26 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 27 | +import org.springframework.jdbc.core.RowMapper; | ||
| 28 | +import org.springframework.scheduling.commonj.ScheduledTimerListener; | ||
| 29 | +import org.springframework.stereotype.Service; | ||
| 30 | + | ||
| 31 | +import com.bsth.data.BasicData; | ||
| 32 | +import com.bsth.entity.Line; | ||
| 33 | +import com.bsth.entity.oil.Ylb; | ||
| 34 | +import com.bsth.entity.realcontrol.ChildTaskPlan; | ||
| 35 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 36 | +import com.bsth.entity.sheet.Sheet; | ||
| 37 | +import com.bsth.repository.LineRepository; | ||
| 38 | +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | ||
| 39 | +import com.bsth.repository.sheet.SheetRepository; | ||
| 40 | +import com.bsth.service.impl.BaseServiceImpl; | ||
| 41 | +import com.bsth.service.report.SheetService; | ||
| 42 | +import com.bsth.util.BatchSaveUtils; | ||
| 43 | +import com.bsth.util.ComparableChild; | ||
| 44 | +import com.bsth.util.ComparableReal; | ||
| 45 | +import com.google.common.util.concurrent.AbstractScheduledService.Scheduler; | ||
| 46 | + | ||
| 47 | +@Service | ||
| 48 | +public class SheetServiceImpl extends BaseServiceImpl<Sheet, Integer> implements SheetService { | ||
| 49 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 50 | + @Autowired | ||
| 51 | + ScheduleRealInfoRepository scheduleRealInfoRepository; | ||
| 52 | + @Autowired | ||
| 53 | + LineRepository lineRepository; | ||
| 54 | + @Autowired | ||
| 55 | + JdbcTemplate jdbcTemplate; | ||
| 56 | + @Autowired | ||
| 57 | + SheetRepository sheetRepository; | ||
| 58 | + /** | ||
| 59 | + * 班次准点率 | ||
| 60 | + */ | ||
| 61 | + @Override | ||
| 62 | + public List<Map<String, Object>> bcPunctual(Map<String, Object> map) { | ||
| 63 | + // TODO Auto-generated method stub | ||
| 64 | + String line =map.get("line").toString(); | ||
| 65 | + String date =map.get("date").toString(); | ||
| 66 | + List<ScheduleRealInfo> realList=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date); | ||
| 67 | + | ||
| 68 | + return null; | ||
| 69 | + } | ||
| 70 | + public static boolean isInOut(ScheduleRealInfo s){ | ||
| 71 | + boolean fage=false; | ||
| 72 | + if(s.getBcType().equals("in")){ | ||
| 73 | + fage=true; | ||
| 74 | + } | ||
| 75 | + if(s.getBcType().equals("out")){ | ||
| 76 | + fage=true; | ||
| 77 | + } | ||
| 78 | + if(s.getBcType().equals("ldks")){ | ||
| 79 | + fage=true; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + return fage; | ||
| 83 | + } | ||
| 84 | + @Override | ||
| 85 | + public String saveSheetList() throws Exception{ | ||
| 86 | + Map<String, Object> map=new HashMap<String,Object>(); | ||
| 87 | + String result = "failure"; | ||
| 88 | + try { | ||
| 89 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | ||
| 90 | + Date dNow = new Date(); //当前时间 | ||
| 91 | + Calendar calendar = Calendar.getInstance(); //得到日历 | ||
| 92 | + calendar.setTime(dNow);//把当前时间赋给日历 | ||
| 93 | + calendar.add(Calendar.DAY_OF_MONTH, -3); //设置为前三天 | ||
| 94 | + | ||
| 95 | + String rq=sdf.format(calendar.getTime()); | ||
| 96 | +// String rq="2017-05-16"; | ||
| 97 | + | ||
| 98 | + List<Line> lineList = (List<Line>) lineRepository.findAll(); | ||
| 99 | + | ||
| 100 | + List<ScheduleRealInfo> lists= scheduleRealInfoRepository.findByDate(rq); | ||
| 101 | + List<Sheet> listAdds=new ArrayList<Sheet>(); | ||
| 102 | + for (int i = 0; i < lineList.size(); i++) { | ||
| 103 | + List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>(); | ||
| 104 | + String line=lineList.get(i).getLineCode(); | ||
| 105 | + for (int j = 0; j < lists.size(); j++) { | ||
| 106 | + ScheduleRealInfo s=lists.get(j); | ||
| 107 | + if(!isInOut(s)){ | ||
| 108 | + if(s.getXlBm().equals(line)){ | ||
| 109 | + list.add(s); | ||
| 110 | + } | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + } | ||
| 114 | + if(list.size()>0){ | ||
| 115 | + List<Sheet> listAdd=punctualByLine(line,list); | ||
| 116 | + if(listAdd.size()>0){ | ||
| 117 | + listAdds.addAll(listAdd); | ||
| 118 | + } | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + if(listAdds.size()>0){ | ||
| 124 | + new BatchSaveUtils<Sheet>().saveList(listAdds, Sheet.class); | ||
| 125 | + } | ||
| 126 | + result = "success"; | ||
| 127 | + }catch (Exception e) { | ||
| 128 | + // TODO Auto-generated catch block | ||
| 129 | + throw e; | ||
| 130 | + }finally{ | ||
| 131 | + logger.info("setDDRB:"+result); | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + return result; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + public List<Sheet> punctualByLine(String line,List<ScheduleRealInfo> list){ | ||
| 138 | + List<Sheet> listAdd=new ArrayList<Sheet>(); | ||
| 139 | +// String line =map.get("line").toString(); | ||
| 140 | +// String date =map.get("date").toString(); | ||
| 141 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm"); | ||
| 142 | + String sqlMinYysj="select start_opt from bsth_c_line_config where " | ||
| 143 | + + " id = (" | ||
| 144 | + + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(line) +"'" | ||
| 145 | + + ")"; | ||
| 146 | + List<String> listMin=jdbcTemplate.query(sqlMinYysj, | ||
| 147 | + new RowMapper<String>(){ | ||
| 148 | + @Override | ||
| 149 | + public String mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 150 | + String s=rs.getString("start_opt"); | ||
| 151 | + return s; | ||
| 152 | + } | ||
| 153 | + }); | ||
| 154 | + if(listMin.size()>0){ | ||
| 155 | + String minfcsj=listMin.get(0); | ||
| 156 | + String[] minSjs = minfcsj.split(":"); | ||
| 157 | + //车辆最早发车时间 用了过滤超第二天0点的数据 | ||
| 158 | + Long minSj=Long.parseLong(minSjs[0])*60+Long.parseLong(minSjs[1]); | ||
| 159 | + //0 上行 1下行 | ||
| 160 | + List<ScheduleRealInfo> listJhsj0=new ArrayList<ScheduleRealInfo>(); | ||
| 161 | + | ||
| 162 | + List<ScheduleRealInfo> listJhsj1=new ArrayList<ScheduleRealInfo>(); | ||
| 163 | + | ||
| 164 | + List<ScheduleRealInfo> listReal0=new ArrayList<ScheduleRealInfo>(); | ||
| 165 | + | ||
| 166 | + List<ScheduleRealInfo> listReal1=new ArrayList<ScheduleRealInfo>(); | ||
| 167 | + //排除所有进出场班次 | ||
| 168 | +// List<ScheduleRealInfo> list=scheduleRealInfoRepository.scheduleByDateAndLine2(line, date); | ||
| 169 | + /* for (int i = 0; i < list.size(); i++) { | ||
| 170 | + //排除所有烂班的班次 | ||
| 171 | + ScheduleRealInfo s=list.get(i); | ||
| 172 | + Set<ChildTaskPlan> cts=s.getcTasks(); | ||
| 173 | + if(cts!=null && cts.size() > 0){ | ||
| 174 | + | ||
| 175 | + } | ||
| 176 | + ScheduleRealInfo r=checkBc(s); | ||
| 177 | + String[] fcsj= r.getFcsj().split(":"); | ||
| 178 | + Long fcsjL=Long.parseLong(fcsj[0])*60+Long.parseLong(fcsj[1]); | ||
| 179 | + Long fscjT=0L; | ||
| 180 | + if(fcsjL<minSj){ | ||
| 181 | + Calendar calendar = new GregorianCalendar(); | ||
| 182 | + calendar.setTime(r.getScheduleDate()); | ||
| 183 | + calendar.add(calendar.DATE,1); | ||
| 184 | + r.setScheduleDate(calendar.getTime()); | ||
| 185 | + try { | ||
| 186 | + fscjT = sdf.parse(sdf.format(r.getScheduleDate())+" "+r.getFcsj()).getTime(); | ||
| 187 | + } catch (ParseException e) { | ||
| 188 | + // TODO Auto-generated catch block | ||
| 189 | + e.printStackTrace(); | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + }else{ | ||
| 193 | + try { | ||
| 194 | + fscjT =sdf.parse(r.getScheduleDateStr()+" "+r.getFcsj()).getTime(); | ||
| 195 | + } catch (ParseException e) { | ||
| 196 | + // TODO Auto-generated catch block | ||
| 197 | + e.printStackTrace(); | ||
| 198 | + }; | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + Sheet sheet=new Sheet(); | ||
| 202 | + Long fcsjAcual=0L; | ||
| 203 | + if (r.getFcsjActual()!=null) { | ||
| 204 | + if(!r.getFcsjActual().equals("")){ | ||
| 205 | + try { | ||
| 206 | + fcsjAcual =sdf.parse(r.getRealExecDate()+" "+r.getFcsjActual()).getTime(); | ||
| 207 | + } catch (ParseException e) { | ||
| 208 | + // TODO Auto-generated catch block | ||
| 209 | + e.printStackTrace(); | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + | ||
| 213 | + Long sjc=fscjT-fcsjAcual; | ||
| 214 | + //在快慢五分钟内直接添加 | ||
| 215 | + if(sjc>= 3*60*1000*-1 && sjc <=3*60*1000){ | ||
| 216 | + | ||
| 217 | + sheet.setDate(r.getScheduleDateStr()); | ||
| 218 | + sheet.setRealDate(r.getRealExecDate()); | ||
| 219 | + sheet.setJhsjt(fscjT); | ||
| 220 | + sheet.setJhsj(r.getFcsj()); | ||
| 221 | + sheet.setSjsjt(fcsjAcual); | ||
| 222 | + sheet.setSjsj(r.getFcsjActual()); | ||
| 223 | + sheet.setGs(r.getGsBm()); | ||
| 224 | + sheet.setFgs(r.getFgsBm()); | ||
| 225 | + sheet.setLine(r.getXlBm()); | ||
| 226 | + sheet.setXlDir(r.getXlDir()); | ||
| 227 | + sheet.setZdname(r.getQdzName()); | ||
| 228 | + sheet.setCreateDate(new Date()); | ||
| 229 | + listAdd.add(sheet); | ||
| 230 | + }else{ | ||
| 231 | + r.setFcsjActualTime(fcsjAcual); | ||
| 232 | + r.setFcsjT(fscjT); | ||
| 233 | + if(r.getXlDir().equals("0")){ | ||
| 234 | + listJhsj0.add(r); | ||
| 235 | + listReal0.add(r); | ||
| 236 | + }else{ | ||
| 237 | + listJhsj1.add(r); | ||
| 238 | + listReal1.add(r); | ||
| 239 | + } | ||
| 240 | + } | ||
| 241 | + }else{ | ||
| 242 | + sheet.setDate(r.getScheduleDateStr()); | ||
| 243 | + sheet.setRealDate(r.getRealExecDate()); | ||
| 244 | + sheet.setJhsjt(fscjT); | ||
| 245 | + sheet.setJhsj(r.getFcsj()); | ||
| 246 | + sheet.setSjsjt(0L); | ||
| 247 | + sheet.setSjsj("烂班"); | ||
| 248 | + sheet.setGs(r.getGsBm()); | ||
| 249 | + sheet.setFgs(r.getFgsBm()); | ||
| 250 | + sheet.setLine(r.getXlBm()); | ||
| 251 | + sheet.setXlDir(r.getXlDir()); | ||
| 252 | + sheet.setZdname(r.getQdzName()); | ||
| 253 | + sheet.setCreateDate(new Date()); | ||
| 254 | + listAdd.add(sheet); | ||
| 255 | + } | ||
| 256 | + }else{ | ||
| 257 | + sheet.setDate(r.getScheduleDateStr()); | ||
| 258 | + sheet.setRealDate(r.getRealExecDate()); | ||
| 259 | + sheet.setJhsjt(fscjT); | ||
| 260 | + sheet.setJhsj(r.getFcsj()); | ||
| 261 | + sheet.setSjsjt(0L); | ||
| 262 | + sheet.setSjsj("烂班"); | ||
| 263 | + sheet.setGs(r.getGsBm()); | ||
| 264 | + sheet.setFgs(r.getFgsBm()); | ||
| 265 | + sheet.setLine(r.getXlBm()); | ||
| 266 | + sheet.setXlDir(r.getXlDir()); | ||
| 267 | + sheet.setZdname(r.getQdzName()); | ||
| 268 | + sheet.setCreateDate(new Date()); | ||
| 269 | + listAdd.add(sheet); | ||
| 270 | + } | ||
| 271 | + }*/ | ||
| 272 | + for (int i = 0; i < list.size(); i++) { | ||
| 273 | + ScheduleRealInfo s=list.get(i); | ||
| 274 | + ScheduleRealInfo r=checkBc(s); | ||
| 275 | + String[] fcsj= r.getFcsj().split(":"); | ||
| 276 | + Long fcsjL=Long.parseLong(fcsj[0])*60+Long.parseLong(fcsj[1]); | ||
| 277 | + Long fscjT=0L; | ||
| 278 | + if(fcsjL<minSj){ | ||
| 279 | + Calendar calendar = new GregorianCalendar(); | ||
| 280 | + calendar.setTime(r.getScheduleDate()); | ||
| 281 | + calendar.add(calendar.DATE,1); | ||
| 282 | + r.setScheduleDate(calendar.getTime()); | ||
| 283 | + try { | ||
| 284 | + fscjT = sdf.parse(sdf.format(r.getScheduleDate())+" "+r.getFcsj()).getTime(); | ||
| 285 | + } catch (ParseException e) { | ||
| 286 | + // TODO Auto-generated catch block | ||
| 287 | + e.printStackTrace(); | ||
| 288 | + } | ||
| 289 | + | ||
| 290 | + }else{ | ||
| 291 | + try { | ||
| 292 | + fscjT =sdf.parse(r.getScheduleDateStr()+" "+r.getFcsj()).getTime(); | ||
| 293 | + } catch (ParseException e) { | ||
| 294 | + // TODO Auto-generated catch block | ||
| 295 | + e.printStackTrace(); | ||
| 296 | + }; | ||
| 297 | + } | ||
| 298 | + r.setFcsjT(fscjT); | ||
| 299 | + Sheet sheet=new Sheet(); | ||
| 300 | + if (s.getFcsjActual() != null) { | ||
| 301 | + Long fcsjAcual = 0L; | ||
| 302 | + try { | ||
| 303 | + fcsjAcual = sdf.parse(r.getRealExecDate() + " " + r.getFcsjActual()).getTime(); | ||
| 304 | + r.setFcsjActualTime(fcsjAcual); | ||
| 305 | + r.setFcsjT(fscjT); | ||
| 306 | + } catch (ParseException e) { | ||
| 307 | + // TODO Auto-generated catch block | ||
| 308 | + e.printStackTrace(); | ||
| 309 | + } | ||
| 310 | + if (r.isSflj()) { | ||
| 311 | + if (s.getXlDir().equals("0")) { | ||
| 312 | + listReal0.add(r); | ||
| 313 | + } else { | ||
| 314 | + listReal1.add(r); | ||
| 315 | + } | ||
| 316 | + | ||
| 317 | + } else { | ||
| 318 | + if (s.getFcsjActual() != null) { | ||
| 319 | + Long sjc = fcsjAcual - fscjT; | ||
| 320 | + // 在快慢五分钟内直接添加 | ||
| 321 | + if (sjc >= 1 * 60 * 1000 * -1 && sjc <= 3 * 60 * 1000) { | ||
| 322 | + sheet.setDate(r.getScheduleDateStr()); | ||
| 323 | + sheet.setRealDate(r.getRealExecDate()); | ||
| 324 | + sheet.setJhsjt(fscjT); | ||
| 325 | + sheet.setJhsj(r.getFcsj()); | ||
| 326 | + sheet.setSjsjt(fcsjAcual); | ||
| 327 | + sheet.setSjsj(r.getFcsjActual()); | ||
| 328 | + sheet.setGs(r.getGsBm()); | ||
| 329 | + sheet.setFgs(r.getFgsBm()); | ||
| 330 | + sheet.setLine(r.getXlBm()); | ||
| 331 | + sheet.setXlDir(r.getXlDir()); | ||
| 332 | + sheet.setZdname(r.getQdzName()); | ||
| 333 | + sheet.setCreateDate(new Date()); | ||
| 334 | + listAdd.add(sheet); | ||
| 335 | + } else { | ||
| 336 | + if (r.getXlDir().equals("0")) { | ||
| 337 | + listJhsj0.add(r); | ||
| 338 | + listReal0.add(r); | ||
| 339 | + } else { | ||
| 340 | + listJhsj1.add(r); | ||
| 341 | + listReal1.add(r); | ||
| 342 | + } | ||
| 343 | + } | ||
| 344 | + } | ||
| 345 | + } | ||
| 346 | + } else { | ||
| 347 | + /*sheet.setDate(r.getScheduleDateStr()); | ||
| 348 | + sheet.setRealDate(r.getRealExecDate()); | ||
| 349 | + sheet.setJhsjt(fscjT); | ||
| 350 | + sheet.setJhsj(r.getFcsj()); | ||
| 351 | + sheet.setSjsjt(0L); | ||
| 352 | + sheet.setSjsj("烂班"); | ||
| 353 | + sheet.setGs(r.getGsBm()); | ||
| 354 | + sheet.setFgs(r.getFgsBm()); | ||
| 355 | + sheet.setLine(r.getXlBm()); | ||
| 356 | + sheet.setXlDir(r.getXlDir()); | ||
| 357 | + sheet.setZdname(r.getQdzName()); | ||
| 358 | + sheet.setCreateDate(new Date()); | ||
| 359 | + listAdd.add(sheet);*/ | ||
| 360 | + r.setFcsjActualTime(0L); | ||
| 361 | + r.setFcsjT(fscjT); | ||
| 362 | + r.setFcsjActual("烂班"); | ||
| 363 | + if (r.getXlDir().equals("0")) { | ||
| 364 | + listJhsj0.add(r); | ||
| 365 | + listReal0.add(r); | ||
| 366 | + } else { | ||
| 367 | + listJhsj1.add(r); | ||
| 368 | + listReal1.add(r); | ||
| 369 | + } | ||
| 370 | + | ||
| 371 | + } | ||
| 372 | + | ||
| 373 | + } | ||
| 374 | + //计发排序 | ||
| 375 | + Collections.sort(listJhsj0, new ComparableReal()); | ||
| 376 | + Collections.sort(listJhsj1, new ComparableReal()); | ||
| 377 | + //实发排序 | ||
| 378 | + Collections.sort(listReal0,new ComparableAcual()); | ||
| 379 | + Collections.sort(listReal1,new ComparableAcual()); | ||
| 380 | + | ||
| 381 | + //计划发车时间和实际发车时间比较计算准点率 | ||
| 382 | + | ||
| 383 | + | ||
| 384 | + | ||
| 385 | + int no=listJhsj0.size()*2; | ||
| 386 | + boolean fage=true; | ||
| 387 | +// for (int p = no; p > 0; p--) { | ||
| 388 | + while(fage){ | ||
| 389 | + //查询所有的实发 对应最接近的 计发 | ||
| 390 | + List<Map<String, Object>> list_map=new ArrayList<Map<String,Object>>(); | ||
| 391 | + for (int i = 0; i < listReal0.size(); i++) { | ||
| 392 | + Map<String, Object> m_=new HashMap<String,Object>(); | ||
| 393 | + ScheduleRealInfo s1=listReal0.get(i); | ||
| 394 | + Long sjsj=s1.getFcsjActualTime(); | ||
| 395 | + ScheduleRealInfo absInfo=new ScheduleRealInfo(); | ||
| 396 | + int next_j=listJhsj0.size(); | ||
| 397 | + for (int j = 0; j < listJhsj0.size(); j++) { | ||
| 398 | + ScheduleRealInfo s2=listJhsj0.get(j); | ||
| 399 | + if(j==0){ | ||
| 400 | + absInfo=s2; | ||
| 401 | + }else{ | ||
| 402 | + //计发实发时间绝对值比较 取到最接近的值 | ||
| 403 | + Long abs1 = Math.abs(sjsj - s2.getFcsjT()); | ||
| 404 | + Long abs2 = Math.abs(sjsj -absInfo.getFcsjT()); | ||
| 405 | + if(abs2-abs1>0){ | ||
| 406 | + absInfo=s2; | ||
| 407 | + next_j=j; | ||
| 408 | + } | ||
| 409 | + } | ||
| 410 | + } | ||
| 411 | + if(next_j<=0){ | ||
| 412 | + break; | ||
| 413 | + }else{ | ||
| 414 | + m_.put("s", s1.getId()); | ||
| 415 | + m_.put("j", absInfo.getId()); | ||
| 416 | + m_.put("s_list", s1); | ||
| 417 | + m_.put("j_list", absInfo); | ||
| 418 | + m_.put("abs", Math.abs(sjsj-absInfo.getFcsjT())); | ||
| 419 | + list_map.add(m_); | ||
| 420 | + } | ||
| 421 | + } | ||
| 422 | + Collections.sort(list_map,new ComparableMap()); | ||
| 423 | + Map<String, Object> m_s=new HashMap<String,Object>(); | ||
| 424 | + List<Map<String, Object>> list_m_s=new ArrayList<Map<String,Object>>(); | ||
| 425 | + | ||
| 426 | + for (int i = 0; i < list_map.size(); i++) { | ||
| 427 | + Map<String, Object> m_=list_map.get(i); | ||
| 428 | + Map<String, Object> m_l=new HashMap<String,Object>(); | ||
| 429 | + if(m_s.get(m_.get("j").toString())==null){ | ||
| 430 | + m_s.put(m_.get("s").toString(), m_.get("s")); | ||
| 431 | + m_s.put(m_.get("j").toString(), m_.get("j")); | ||
| 432 | + m_l.put("s", m_.get("s")); | ||
| 433 | + m_l.put("j", m_.get("j")); | ||
| 434 | + m_l.put("s_l",m_.get("s_list")); | ||
| 435 | + m_l.put("j_l",m_.get("j_list")); | ||
| 436 | + list_m_s.add(m_l); | ||
| 437 | + } | ||
| 438 | + } | ||
| 439 | + for (int i = 0; i < list_m_s.size(); i++) { | ||
| 440 | + Map<String, Object> m_l=list_m_s.get(i); | ||
| 441 | + Long s=Long.parseLong(m_l.get("s").toString()); | ||
| 442 | + boolean s_bool=false; | ||
| 443 | + for (int k = 0; k < listReal0.size(); k++) { | ||
| 444 | + ScheduleRealInfo s0=listReal0.get(k); | ||
| 445 | + if(s0.getId()-s==0){ | ||
| 446 | + listReal0.remove(s0); | ||
| 447 | + s_bool=true; | ||
| 448 | + } | ||
| 449 | + } | ||
| 450 | + | ||
| 451 | + Long j=Long.parseLong(m_l.get("j").toString()); | ||
| 452 | + boolean j_bool=false; | ||
| 453 | + for (int j2 = 0; j2 < listJhsj0.size(); j2++) { | ||
| 454 | + ScheduleRealInfo j0=listJhsj0.get(j2); | ||
| 455 | + if(j0.getId()-j==0){ | ||
| 456 | + listJhsj0.remove(j0); | ||
| 457 | + j_bool=true; | ||
| 458 | + } | ||
| 459 | + } | ||
| 460 | + | ||
| 461 | + if(s_bool&&j_bool){ | ||
| 462 | + ScheduleRealInfo sf=(ScheduleRealInfo)m_l.get("s_l"); | ||
| 463 | + ScheduleRealInfo jf=(ScheduleRealInfo)m_l.get("j_l"); | ||
| 464 | + Sheet sheet=new Sheet(); | ||
| 465 | + sheet.setDate(sf.getScheduleDateStr()); | ||
| 466 | + sheet.setRealDate(sf.getRealExecDate()); | ||
| 467 | + sheet.setJhsjt(jf.getFcsjT()); | ||
| 468 | + sheet.setJhsj(jf.getFcsj()); | ||
| 469 | + sheet.setSjsjt(sf.getFcsjActualTime()); | ||
| 470 | + sheet.setSjsj(sf.getFcsjActual()); | ||
| 471 | + sheet.setGs(sf.getGsBm()); | ||
| 472 | + sheet.setFgs(sf.getFgsBm()); | ||
| 473 | + sheet.setLine(sf.getXlBm()); | ||
| 474 | + sheet.setXlDir(sf.getXlDir()); | ||
| 475 | + sheet.setZdname(sf.getQdzName()); | ||
| 476 | + sheet.setCreateDate(new Date()); | ||
| 477 | + listAdd.add(sheet); | ||
| 478 | + } | ||
| 479 | + } | ||
| 480 | + | ||
| 481 | + if(listJhsj0.size()<=0){ | ||
| 482 | + fage=false; | ||
| 483 | + } | ||
| 484 | + no--; | ||
| 485 | + if(no<0){ | ||
| 486 | + fage=false; | ||
| 487 | + } | ||
| 488 | + } | ||
| 489 | + | ||
| 490 | + | ||
| 491 | + int nos=listJhsj1.size()*2; | ||
| 492 | + fage=true; | ||
| 493 | + while(fage){ | ||
| 494 | + //查询所有的实发 对应最接近的 计发 | ||
| 495 | + List<Map<String, Object>> list_map=new ArrayList<Map<String,Object>>(); | ||
| 496 | + for (int i = 0; i < listReal1.size(); i++) { | ||
| 497 | + Map<String, Object> m_=new HashMap<String,Object>(); | ||
| 498 | + ScheduleRealInfo s1=listReal1.get(i); | ||
| 499 | + Long sjsj=s1.getFcsjActualTime(); | ||
| 500 | + ScheduleRealInfo absInfo=new ScheduleRealInfo(); | ||
| 501 | + int next_j=listJhsj1.size(); | ||
| 502 | + for (int j = 0; j < listJhsj1.size(); j++) { | ||
| 503 | + ScheduleRealInfo s2=listJhsj1.get(j); | ||
| 504 | + if(j==0){ | ||
| 505 | + absInfo=s2; | ||
| 506 | + }else{ | ||
| 507 | + //计发实发时间绝对值比较 取到最接近的值 | ||
| 508 | + Long abs1 = Math.abs(sjsj - s2.getFcsjT()); | ||
| 509 | + Long abs2 = Math.abs(sjsj -absInfo.getFcsjT()); | ||
| 510 | + if(abs2-abs1>0){ | ||
| 511 | + absInfo=s2; | ||
| 512 | + next_j=j; | ||
| 513 | + } | ||
| 514 | + } | ||
| 515 | + } | ||
| 516 | + if(next_j<=0){ | ||
| 517 | + break; | ||
| 518 | + }else{ | ||
| 519 | + m_.put("s", s1.getId()); | ||
| 520 | + m_.put("j", absInfo.getId()); | ||
| 521 | + m_.put("s_list", s1); | ||
| 522 | + m_.put("j_list", absInfo); | ||
| 523 | + m_.put("abs", Math.abs(sjsj-absInfo.getFcsjT())); | ||
| 524 | + list_map.add(m_); | ||
| 525 | + } | ||
| 526 | + | ||
| 527 | + } | ||
| 528 | + Collections.sort(list_map,new ComparableMap()); | ||
| 529 | + Map<String, Object> m_s=new HashMap<String,Object>(); | ||
| 530 | + List<Map<String, Object>> list_m_s=new ArrayList<Map<String,Object>>(); | ||
| 531 | + | ||
| 532 | + for (int i = 0; i < list_map.size(); i++) { | ||
| 533 | + Map<String, Object> m_=list_map.get(i); | ||
| 534 | + Map<String, Object> m_l=new HashMap<String,Object>(); | ||
| 535 | + if(m_s.get(m_.get("j").toString())==null){ | ||
| 536 | + m_s.put(m_.get("s").toString(), m_.get("s")); | ||
| 537 | + m_s.put(m_.get("j").toString(), m_.get("j")); | ||
| 538 | + m_l.put("s", m_.get("s")); | ||
| 539 | + m_l.put("j", m_.get("j")); | ||
| 540 | + m_l.put("s_l",m_.get("s_list")); | ||
| 541 | + m_l.put("j_l",m_.get("j_list")); | ||
| 542 | + list_m_s.add(m_l); | ||
| 543 | + } | ||
| 544 | + } | ||
| 545 | + for (int i = 0; i < list_m_s.size(); i++) { | ||
| 546 | + Map<String, Object> m_l=list_m_s.get(i); | ||
| 547 | + Long s=Long.parseLong(m_l.get("s").toString()); | ||
| 548 | + boolean s_bool=false; | ||
| 549 | + for (int k = 0; k < listReal1.size(); k++) { | ||
| 550 | + ScheduleRealInfo s0=listReal1.get(k); | ||
| 551 | + if(s0.getId()-s==0){ | ||
| 552 | + listReal1.remove(s0); | ||
| 553 | + s_bool=true; | ||
| 554 | + } | ||
| 555 | + } | ||
| 556 | + | ||
| 557 | + Long j=Long.parseLong(m_l.get("j").toString()); | ||
| 558 | + boolean j_bool=false; | ||
| 559 | + for (int j2 = 0; j2 < listJhsj1.size(); j2++) { | ||
| 560 | + ScheduleRealInfo j0=listJhsj1.get(j2); | ||
| 561 | + if(j0.getId()-j==0){ | ||
| 562 | + listJhsj1.remove(j0); | ||
| 563 | + j_bool=true; | ||
| 564 | + } | ||
| 565 | + } | ||
| 566 | + | ||
| 567 | + if(s_bool&&j_bool){ | ||
| 568 | + ScheduleRealInfo sf=(ScheduleRealInfo)m_l.get("s_l"); | ||
| 569 | + ScheduleRealInfo jf=(ScheduleRealInfo)m_l.get("j_l"); | ||
| 570 | + Sheet sheet=new Sheet(); | ||
| 571 | + sheet.setDate(sf.getScheduleDateStr()); | ||
| 572 | + sheet.setRealDate(sf.getRealExecDate()); | ||
| 573 | + sheet.setJhsjt(jf.getFcsjT()); | ||
| 574 | + sheet.setJhsj(jf.getFcsj()); | ||
| 575 | + sheet.setSjsjt(sf.getFcsjActualTime()); | ||
| 576 | + sheet.setSjsj(sf.getFcsjActual()); | ||
| 577 | + sheet.setGs(sf.getGsBm()); | ||
| 578 | + sheet.setFgs(sf.getFgsBm()); | ||
| 579 | + sheet.setLine(sf.getXlBm()); | ||
| 580 | + sheet.setXlDir(sf.getXlDir()); | ||
| 581 | + sheet.setZdname(sf.getQdzName()); | ||
| 582 | + sheet.setCreateDate(new Date()); | ||
| 583 | + listAdd.add(sheet); | ||
| 584 | + } | ||
| 585 | + } | ||
| 586 | + | ||
| 587 | + if(listJhsj1.size()<=0){ | ||
| 588 | + fage=false; | ||
| 589 | + } | ||
| 590 | + nos--; | ||
| 591 | + if(nos<0){ | ||
| 592 | + fage=false; | ||
| 593 | + } | ||
| 594 | + } | ||
| 595 | + } | ||
| 596 | + return listAdd; | ||
| 597 | + } | ||
| 598 | + | ||
| 599 | + public ScheduleRealInfo checkBc(ScheduleRealInfo s){ | ||
| 600 | + //如果班次有子任务 且 子任务中有属于营运的。把该子任务的发车时间设置成班次的发车时间 | ||
| 601 | + Set<ChildTaskPlan> childTaskPlans = s.getcTasks(); | ||
| 602 | + if(!childTaskPlans.isEmpty()){ | ||
| 603 | + List<ChildTaskPlan> listit=new ArrayList<ChildTaskPlan>(childTaskPlans); | ||
| 604 | + Collections.sort(listit, new ComparableChild()); | ||
| 605 | + for (int i = 0; i < listit.size(); i++) { | ||
| 606 | + ChildTaskPlan c=listit.get(i); | ||
| 607 | + if(!c.isDestroy()){ | ||
| 608 | + if(c.getMileageType().equals("service")){ | ||
| 609 | + s.setFcsjActual(c.getStartDate()); | ||
| 610 | + break; | ||
| 611 | + } | ||
| 612 | + | ||
| 613 | + } | ||
| 614 | + } | ||
| 615 | + } | ||
| 616 | + return s; | ||
| 617 | + } | ||
| 618 | + | ||
| 619 | + public Long abs_js(List<ScheduleRealInfo> list,ScheduleRealInfo t){ | ||
| 620 | + Long jhsj=t.getFcsjT(); | ||
| 621 | + ScheduleRealInfo absInfo=new ScheduleRealInfo(); | ||
| 622 | + for (int j = 0; j < list.size(); j++) { | ||
| 623 | + ScheduleRealInfo s =list.get(j); | ||
| 624 | + if(j==0){ | ||
| 625 | + absInfo=s; | ||
| 626 | + }else{ | ||
| 627 | + //计发实发时间绝对值比较 取到最接近的值 | ||
| 628 | + Long abs1 = Math.abs(jhsj - s.getFcsjActualTime()); | ||
| 629 | + Long abs2 = Math.abs(absInfo.getFcsjActualTime()); | ||
| 630 | + if(abs2-abs1>0){ | ||
| 631 | + absInfo=s; | ||
| 632 | + } | ||
| 633 | + } | ||
| 634 | + } | ||
| 635 | + return absInfo.getId(); | ||
| 636 | + | ||
| 637 | + } | ||
| 638 | + | ||
| 639 | + @Override | ||
| 640 | + public List<Map<String, Object>> countList(Map<String, Object> map) { | ||
| 641 | + // TODO Auto-generated method stub | ||
| 642 | + List<Map<String, Object>> listmap=new ArrayList<Map<String,Object>>(); | ||
| 643 | + String line=""; | ||
| 644 | + if(map.get("line")!=null){ | ||
| 645 | + line =map.get("line").toString(); | ||
| 646 | + } | ||
| 647 | + String gs=""; | ||
| 648 | + if(map.get("gs")!=null){ | ||
| 649 | + gs=map.get("gs").toString(); | ||
| 650 | + } | ||
| 651 | + String fgs=""; | ||
| 652 | + if(map.get("fgs")!=null){ | ||
| 653 | + fgs=map.get("fgs").toString(); | ||
| 654 | + } | ||
| 655 | + String date=map.get("date").toString(); | ||
| 656 | + String sql="select * from bsth_c_sheet where date='"+date+"'"; | ||
| 657 | + if(line.trim().equals("")){ | ||
| 658 | + sql +=" and gs like '%"+gs+"%' and fgs like '%"+fgs+"%'"; | ||
| 659 | + }else{ | ||
| 660 | + sql +=" and line ='"+line+"'"; | ||
| 661 | + } | ||
| 662 | + sql +=" order by line "; | ||
| 663 | + List<Sheet> list=jdbcTemplate.query(sql, | ||
| 664 | + new RowMapper<Sheet>(){ | ||
| 665 | + @Override | ||
| 666 | + public Sheet mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 667 | + Sheet s=new Sheet(); | ||
| 668 | + s.setGs(rs.getString("gs")); | ||
| 669 | + s.setFgs(rs.getString("fgs")); | ||
| 670 | + s.setLine(rs.getString("line")); | ||
| 671 | + s.setDate(rs.getString("date")); | ||
| 672 | + s.setJhsj(rs.getString("jhsj")); | ||
| 673 | + s.setJhsjt(rs.getLong("jhsjt")); | ||
| 674 | + s.setSjsj(rs.getString("sjsj")); | ||
| 675 | + s.setSjsjt(rs.getLong("sjsjt")); | ||
| 676 | + s.setId(rs.getInt("id")); | ||
| 677 | + return s; | ||
| 678 | + } | ||
| 679 | + }); | ||
| 680 | + | ||
| 681 | + String sqlByLine="select line from bsth_c_sheet where date='"+date+"'"; | ||
| 682 | + if(line.trim().equals("")){ | ||
| 683 | + sqlByLine +=" and gs like '%"+gs+"%' and fgs like '%"+fgs+"%'"; | ||
| 684 | + }else{ | ||
| 685 | + sqlByLine +=" and line ='"+line+"'"; | ||
| 686 | + } | ||
| 687 | + sqlByLine +=" group by line "; | ||
| 688 | + List<String> listLine=jdbcTemplate.query(sqlByLine, | ||
| 689 | + new RowMapper<String>(){ | ||
| 690 | + @Override | ||
| 691 | + public String mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 692 | + String line=rs.getString("line"); | ||
| 693 | + return line; | ||
| 694 | + } | ||
| 695 | + }); | ||
| 696 | + for (int i = 0; i < listLine.size(); i++) { | ||
| 697 | + String xlbm=listLine.get(i); | ||
| 698 | + List<Sheet> newList=new ArrayList<Sheet>(); | ||
| 699 | + for (int j = 0; j < list.size(); j++) { | ||
| 700 | + if(xlbm.equals(list.get(j).getLine())){ | ||
| 701 | + newList.add(list.get(j)); | ||
| 702 | + } | ||
| 703 | + } | ||
| 704 | + | ||
| 705 | + if(newList.size()>0){ | ||
| 706 | + Map<String, Object> newmap=culateByLine(newList); | ||
| 707 | + listmap.add(newmap); | ||
| 708 | + } | ||
| 709 | + | ||
| 710 | + } | ||
| 711 | + return listmap; | ||
| 712 | + } | ||
| 713 | + | ||
| 714 | + public Map<String, Object> culateByLine(List<Sheet> list){ | ||
| 715 | + Map<String, Object> map=new HashMap<String,Object>(); | ||
| 716 | + String gs=BasicData.businessCodeNameMap.get(list.get(0).getGs()); | ||
| 717 | + String fgs=BasicData.businessFgsCodeNameMap.get(list.get(0).getFgs()+"_"+list.get(0).getGs()); | ||
| 718 | + String line=BasicData.lineCode2NameMap.get(list.get(0).getLine()); | ||
| 719 | + Integer id=list.get(0).getId(); | ||
| 720 | + int bcs=list.size(); | ||
| 721 | + int zdbcs=0; | ||
| 722 | + for (int i = 0; i < list.size(); i++) { | ||
| 723 | + Sheet s=list.get(i); | ||
| 724 | + Long sjc=s.getJhsjt()-s.getSjsjt(); | ||
| 725 | + if(sjc>= 3*60*1000*-1 && sjc <=1*60*1000){ | ||
| 726 | + zdbcs++; | ||
| 727 | + } | ||
| 728 | + } | ||
| 729 | + double zdlv =(zdbcs*1.0/bcs)*100; | ||
| 730 | + DecimalFormat df = new DecimalFormat("0.00"); | ||
| 731 | + map.put("gs", gs); | ||
| 732 | + map.put("fgs", fgs); | ||
| 733 | + map.put("line", line); | ||
| 734 | + map.put("bcs", bcs); | ||
| 735 | + map.put("zdbcs", zdbcs); | ||
| 736 | + map.put("zdlv", df.format(zdlv)+"%"); | ||
| 737 | + map.put("id", id); | ||
| 738 | + return map; | ||
| 739 | + } | ||
| 740 | + @Override | ||
| 741 | + public List<Sheet> sheetList(Integer id) { | ||
| 742 | + // TODO Auto-generated method stub | ||
| 743 | + Sheet sheet=sheetRepository.findOne(id); | ||
| 744 | + String sql="select * from bsth_c_sheet where date='"+sheet.getDate()+"' and line = '"+sheet.getLine()+"'" | ||
| 745 | + + " order by xl_dir,jhsj"; | ||
| 746 | + | ||
| 747 | + List<Sheet> list=jdbcTemplate.query(sql, | ||
| 748 | + new RowMapper<Sheet>(){ | ||
| 749 | + @Override | ||
| 750 | + public Sheet mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 751 | + Sheet s=new Sheet(); | ||
| 752 | + s.setId(rs.getInt("id")); | ||
| 753 | + s.setGs(rs.getString("gs")); | ||
| 754 | + s.setFgs(rs.getString("fgs")); | ||
| 755 | + s.setLine(rs.getString("line")); | ||
| 756 | + s.setDate(rs.getString("date")); | ||
| 757 | + s.setJhsj(rs.getString("jhsj")); | ||
| 758 | + s.setJhsjt(rs.getLong("jhsjt")); | ||
| 759 | + s.setSjsj(rs.getString("sjsj")); | ||
| 760 | + s.setSjsjt(rs.getLong("sjsjt")); | ||
| 761 | + s.setZdname(rs.getString("zdname")); | ||
| 762 | + return s; | ||
| 763 | + } | ||
| 764 | + }); | ||
| 765 | + for (int i = 0; i < list.size(); i++) { | ||
| 766 | + Sheet t=list.get(i); | ||
| 767 | + t.setLine(BasicData.lineCode2NameMap.get(t.getLine())); | ||
| 768 | + Long sjc=t.getJhsjt()-t.getSjsjt(); | ||
| 769 | + if(sjc>= 3*60*1000*-1 && sjc <=1*60*1000){ | ||
| 770 | + t.setSfzd("Y"); | ||
| 771 | + }else{ | ||
| 772 | + t.setSfzd("N"); | ||
| 773 | + } | ||
| 774 | + } | ||
| 775 | + | ||
| 776 | + return list; | ||
| 777 | + } | ||
| 778 | + | ||
| 779 | + | ||
| 780 | +} | ||
| 781 | + class ComparableAcual implements Comparator<ScheduleRealInfo>{ | ||
| 782 | + | ||
| 783 | + @Override | ||
| 784 | + public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) { | ||
| 785 | + // TODO Auto-generated method stub | ||
| 786 | + return o1.getFcsjActualTime().compareTo(o2.getFcsjActualTime()); | ||
| 787 | + } | ||
| 788 | + | ||
| 789 | +} | ||
| 790 | + | ||
| 791 | + class ComparableMap implements Comparator<Map<String, Object>>{ | ||
| 792 | + @Override | ||
| 793 | + public int compare(Map<String, Object> o1, Map<String, Object> o2) { | ||
| 794 | + // TODO Auto-generated method stub | ||
| 795 | + return (int) (Long.parseLong(o1.get("abs").toString())-Long.parseLong((o2.get("abs").toString()))); | ||
| 796 | + } | ||
| 797 | + } |
src/main/java/com/bsth/service/schedule/datatools/TTInfoDetailDataToolsImpl.java
| 1 | -package com.bsth.service.schedule.datatools; | ||
| 2 | - | ||
| 3 | -import com.bsth.service.schedule.exception.ScheduleException; | ||
| 4 | -import com.bsth.service.schedule.utils.DataToolsProperties; | ||
| 5 | -import com.bsth.service.schedule.utils.DataToolsService; | ||
| 6 | -import jxl.Cell; | ||
| 7 | -import jxl.Sheet; | ||
| 8 | -import jxl.Workbook; | ||
| 9 | -import jxl.write.Label; | ||
| 10 | -import jxl.write.WritableSheet; | ||
| 11 | -import jxl.write.WritableWorkbook; | ||
| 12 | -import org.apache.commons.lang3.StringUtils; | ||
| 13 | -import org.joda.time.DateTime; | ||
| 14 | -import org.slf4j.Logger; | ||
| 15 | -import org.slf4j.LoggerFactory; | ||
| 16 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 17 | -import org.springframework.beans.factory.annotation.Qualifier; | ||
| 18 | -import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
| 19 | -import org.springframework.stereotype.Service; | ||
| 20 | - | ||
| 21 | -import java.io.File; | ||
| 22 | -import java.io.PrintWriter; | ||
| 23 | -import java.io.StringWriter; | ||
| 24 | -import java.util.*; | ||
| 25 | - | ||
| 26 | -/** | ||
| 27 | - * Created by xu on 17/5/16. | ||
| 28 | - */ | ||
| 29 | -@EnableConfigurationProperties(DataToolsProperties.class) | ||
| 30 | -@Service(value = "ttInfoDetail_dataTool") | ||
| 31 | -public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetailForEdit { | ||
| 32 | - /** 日志记录器 */ | ||
| 33 | - private final static Logger LOGGER = LoggerFactory.getLogger(TTInfoDetailDataToolsImpl.class); | ||
| 34 | - | ||
| 35 | - @Autowired | ||
| 36 | - @Qualifier(value = "dataToolsServiceImpl") | ||
| 37 | - private DataToolsService dataToolsService; | ||
| 38 | - | ||
| 39 | - @Autowired | ||
| 40 | - private DataToolsProperties dataToolsProperties; | ||
| 41 | - | ||
| 42 | - @Override | ||
| 43 | - public File uploadFile(String filename, byte[] filedata) throws ScheduleException { | ||
| 44 | - try { | ||
| 45 | - // 对上传的excel文件做处理,将第一个sheet名字设定为工作表1 | ||
| 46 | - File file = dataToolsService.uploadFile(filename, filedata); | ||
| 47 | - Workbook workbook = Workbook.getWorkbook(file); | ||
| 48 | - Sheet sheet = workbook.getSheet(0); | ||
| 49 | - | ||
| 50 | - File fileCal = new File(file.getAbsolutePath() + "_sheetChange.xls"); | ||
| 51 | - WritableWorkbook writableWorkbook = Workbook.createWorkbook(fileCal); | ||
| 52 | - WritableSheet writableSheet = writableWorkbook.createSheet("工作表1", 0); | ||
| 53 | - for (int i = 0; i < sheet.getRows(); i++) { | ||
| 54 | - Cell[] cells = sheet.getRow(i); | ||
| 55 | - for (int j = 0; j < cells.length; j++) { | ||
| 56 | - writableSheet.addCell(new Label(j, i, cells[j].getContents())); | ||
| 57 | - } | ||
| 58 | - } | ||
| 59 | - writableWorkbook.write(); | ||
| 60 | - writableWorkbook.close(); | ||
| 61 | - | ||
| 62 | - return fileCal; | ||
| 63 | - | ||
| 64 | - } catch (Exception exp) { | ||
| 65 | - throw new ScheduleException(exp); | ||
| 66 | - } | ||
| 67 | - } | ||
| 68 | - | ||
| 69 | - @Override | ||
| 70 | - public void importData(File file, Map<String, Object> params) throws ScheduleException { | ||
| 71 | - try { | ||
| 72 | - LOGGER.info("//---------------- 导入时刻表明细 start... ----------------//"); | ||
| 73 | - | ||
| 74 | - String filename = file.getAbsolutePath(); // xls文件名 | ||
| 75 | - String sheetname = String.valueOf(params.get("sheetname")); // sheet名字 | ||
| 76 | - Long ttid = Long.valueOf(String.valueOf(params.get("ttid"))); // 时刻表id | ||
| 77 | - Long xlid = Long.valueOf(String.valueOf(params.get("xlid"))); // 线路id | ||
| 78 | - Integer lineid = Integer.valueOf(String.valueOf(params.get("lineinfo"))); // 线路标准id | ||
| 79 | - String xlname = String.valueOf(params.get("xlname")); // 线路名字 | ||
| 80 | - String ttname = String.valueOf(params.get("ttname")); // 时刻表名字 | ||
| 81 | - | ||
| 82 | - LOGGER.info("参数1, xls文件名={},sheet名字={}", filename, sheetname); | ||
| 83 | - LOGGER.info("参数2, 线路id={},线路名字={}", xlid, xlname); | ||
| 84 | - LOGGER.info("参数3, 时刻表id={},时刻表名字={}", ttid, ttname); | ||
| 85 | - | ||
| 86 | - LOGGER.info("转换xls文件格式成文本格式..."); | ||
| 87 | - // 1、修改已经上传的excel文件,在每个起点站后标示数字,表示第几个班次 | ||
| 88 | - // 2、由于格式问题,需要把内容都转换成字符串 | ||
| 89 | - List<String> colList = new ArrayList<>(); | ||
| 90 | - Workbook workbook = Workbook.getWorkbook(new File(filename)); | ||
| 91 | - Sheet sheet = workbook.getSheet(sheetname); | ||
| 92 | - Cell[] cells = sheet.getRow(0); | ||
| 93 | - for (int i = 0; i < cells.length; i++) { | ||
| 94 | - if (i == 0) { | ||
| 95 | - colList.add(cells[i].getContents().trim()); | ||
| 96 | - } else { | ||
| 97 | - colList.add(cells[i].getContents() + i); | ||
| 98 | - } | ||
| 99 | - } | ||
| 100 | - | ||
| 101 | - File fileCal = new File(filename + "_stringType.xls"); | ||
| 102 | - WritableWorkbook writableWorkbook = Workbook.createWorkbook(fileCal, workbook); | ||
| 103 | - WritableSheet sheet1 = writableWorkbook.getSheet(sheetname); | ||
| 104 | - for (int i = 0; i < sheet1.getColumns(); i++) { // 第一行数据 | ||
| 105 | - sheet1.addCell(new Label(i, 0, colList.get(i))); | ||
| 106 | - } | ||
| 107 | - for (int i = 1; i < sheet1.getRows(); i++) { // 第二行开始 | ||
| 108 | - Cell[] cells1 = sheet.getRow(i); | ||
| 109 | - for (int j = 0; j < cells1.length; j++) { | ||
| 110 | - sheet1.addCell(new Label(j, i, cells1[j].getContents())); | ||
| 111 | - } | ||
| 112 | - } | ||
| 113 | - writableWorkbook.write(); | ||
| 114 | - writableWorkbook.close(); | ||
| 115 | - | ||
| 116 | - // 2、删除原有数据 | ||
| 117 | - // 操作在ktr内部执行 | ||
| 118 | - | ||
| 119 | - // 3、导入时刻表 | ||
| 120 | - | ||
| 121 | - // 计算表头参数 | ||
| 122 | - Workbook book = Workbook.getWorkbook(fileCal); | ||
| 123 | - Sheet sheet_exp = book.getSheet(sheetname); | ||
| 124 | - List<String> columnames = new ArrayList<>(); | ||
| 125 | - for (int i = 0; i < sheet_exp.getColumns(); i++) { // 获取第一行,数据,作为列名 | ||
| 126 | - columnames.add(sheet_exp.getCell(i, 0).getContents()); | ||
| 127 | - } | ||
| 128 | - LOGGER.info("表头={}", StringUtils.join(columnames.toArray(), ",")); | ||
| 129 | - | ||
| 130 | - // 创建ktr转换所需参数 | ||
| 131 | - Map<String, Object> ktrParms = new HashMap<>(); | ||
| 132 | - File ktrFile = new File(this.getClass().getResource( | ||
| 133 | - dataToolsProperties.getTtinfodetailMetadatainputktr()).toURI()); | ||
| 134 | -// File ktrFile2 = new File(this.getClass().getResource( | ||
| 135 | -// dataToolsProperties.getTtinfodetailDatainputktr()).toURI()); | ||
| 136 | - File ktrFile2 = new File(this.getClass().getResource( | ||
| 137 | - dataToolsProperties.getTtinfodetailDatainputktr2()).toURI()); | ||
| 138 | - | ||
| 139 | - // 通用参数,转换文件路径,excel输入文件路径,错误输出文件路径 | ||
| 140 | - ktrParms.put("transpath", ktrFile.getAbsolutePath()); | ||
| 141 | - ktrParms.put("filepath", fileCal.getAbsolutePath()); | ||
| 142 | - ktrParms.put("erroroutputdir", dataToolsProperties.getTransErrordir()); | ||
| 143 | - | ||
| 144 | - // 附加参数 | ||
| 145 | - ktrParms.put("injectktrfile", ktrFile2.getAbsolutePath()); // 注入元数据的ktr文件 | ||
| 146 | - ktrParms.put("sheetname", sheetname); // sheet工作区的名字 | ||
| 147 | - ktrParms.put("lineinfoid", lineid); // 线路标准id | ||
| 148 | - ktrParms.put("xlname", xlname); // 线路名称 | ||
| 149 | - ktrParms.put("ttinfoname", ttname); // 时刻表名称 | ||
| 150 | - ktrParms.put("ttid", ttid.intValue()); // 时刻表id | ||
| 151 | - ktrParms.put("excelfieldnames", StringUtils.join(columnames.toArray(), ",")); // 时刻表excel输入字段名,以逗号连接 | ||
| 152 | - columnames.remove(0); | ||
| 153 | - ktrParms.put("normalizefieldnames", StringUtils.join(columnames.toArray(), ",")); // 数据范式化字段名,以逗号连接 | ||
| 154 | - | ||
| 155 | - dataToolsService.importData(fileCal, ktrParms); | ||
| 156 | - | ||
| 157 | - LOGGER.info("//---------------- 导入时刻表明细 success... ----------------//"); | ||
| 158 | - } catch (Exception exp) { | ||
| 159 | - LOGGER.info("//---------------- 导入时刻表明细 failed... ----------------//"); | ||
| 160 | - | ||
| 161 | - StringWriter sw = new StringWriter(); | ||
| 162 | - exp.printStackTrace(new PrintWriter(sw)); | ||
| 163 | - LOGGER.info(sw.toString()); | ||
| 164 | - | ||
| 165 | - throw new ScheduleException(exp.getMessage()); | ||
| 166 | - } | ||
| 167 | - } | ||
| 168 | - | ||
| 169 | - @Override | ||
| 170 | - public File exportData(Map<String, Object> params) throws ScheduleException { | ||
| 171 | - try { | ||
| 172 | - LOGGER.info("//---------------- 导出时刻表明细 start... ----------------//"); | ||
| 173 | - | ||
| 174 | - // 创建ktr转换所需参数 | ||
| 175 | - Map<String, Object> ktrParms = new HashMap<>(); | ||
| 176 | - File ktrFile = new File(this.getClass().getResource( | ||
| 177 | - dataToolsProperties.getTtinfodetailMetaoutput()).toURI()); | ||
| 178 | - File ktrFile2 = new File(this.getClass().getResource( | ||
| 179 | - dataToolsProperties.getTtinfodetailOutput()).toURI()); | ||
| 180 | - | ||
| 181 | - // 通用参数,转换文件路径,excel输出文件名 | ||
| 182 | - ktrParms.put("transpath", ktrFile.getAbsolutePath()); | ||
| 183 | - ktrParms.put("filename", String.format("时刻表_(id=%s)_download-", String.valueOf(params.get("ttinfoid")))); | ||
| 184 | - | ||
| 185 | - // 附加参数 | ||
| 186 | - ktrParms.put("injectktrfile", ktrFile2.getAbsolutePath()); // 注入元数据的ktr文件 | ||
| 187 | - ktrParms.put("ttinfoid", String.valueOf(params.get("ttinfoid"))); | ||
| 188 | - | ||
| 189 | - File file = dataToolsService.exportData(ktrParms); | ||
| 190 | - | ||
| 191 | - LOGGER.info("//---------------- 导出时刻表明细 success... ----------------//"); | ||
| 192 | - | ||
| 193 | - return file; | ||
| 194 | - } catch (Exception exp) { | ||
| 195 | - LOGGER.info("//---------------- 导出时刻表明细 failed... ----------------//"); | ||
| 196 | - | ||
| 197 | - StringWriter sw = new StringWriter(); | ||
| 198 | - exp.printStackTrace(new PrintWriter(sw)); | ||
| 199 | - LOGGER.info(sw.toString()); | ||
| 200 | - | ||
| 201 | - throw new ScheduleException(exp.getMessage()); | ||
| 202 | - } | ||
| 203 | - } | ||
| 204 | - | ||
| 205 | - @Override | ||
| 206 | - public EditInfo getEditInfo(Integer xlid, Long ttid, Long maxfcno) throws ScheduleException { | ||
| 207 | - try { | ||
| 208 | - LOGGER.info("//---------------- 时刻表编辑用数据输出 start... ----------------//"); | ||
| 209 | - | ||
| 210 | - // 创建ktr转换所需参数 | ||
| 211 | - Map<String, Object> ktrParms = new HashMap<>(); | ||
| 212 | - File ktrFile = new File(this.getClass().getResource( | ||
| 213 | - dataToolsProperties.getTtinfodetailForeditktr()).toURI()); | ||
| 214 | - | ||
| 215 | - // 通用参数,转换文件路径,excel输出文件名,错误输出文件路径 | ||
| 216 | - ktrParms.put("transpath", ktrFile.getAbsolutePath()); | ||
| 217 | - ktrParms.put("filename", "todo"); | ||
| 218 | - | ||
| 219 | - // 附加参数 | ||
| 220 | - String outputFilePath = String.format("ttinfodetail_(id=%s)_foredit-%s", | ||
| 221 | - String.valueOf(ttid), new DateTime().toString("yyyyMMddHHmmss")); | ||
| 222 | - | ||
| 223 | - ktrParms.put("tempfilepath", dataToolsProperties.getTransTempdir() + File.separator + outputFilePath); // 数据输出文件路径 | ||
| 224 | - ktrParms.put("xlid", String.valueOf(xlid)); | ||
| 225 | - ktrParms.put("ttid", String.valueOf(ttid)); | ||
| 226 | - | ||
| 227 | - dataToolsService.exportData(ktrParms); | ||
| 228 | - | ||
| 229 | - EditInfo editInfo = new EditInfo(); // 输出数据 | ||
| 230 | - | ||
| 231 | - | ||
| 232 | - // 1.6、获取最大的发车数,用于输出数据的数量 | ||
| 233 | - LOGGER.info("最大发车顺序号={}", maxfcno); | ||
| 234 | - if (maxfcno != null) { | ||
| 235 | - // 2、读取ktr生成的excel数据,组织编辑用数据返回 | ||
| 236 | - // 2-1、读取Excel文件 | ||
| 237 | - Workbook book = Workbook.getWorkbook(new File(dataToolsProperties.getTransTempdir() + | ||
| 238 | - File.separator + outputFilePath + ".xls")); | ||
| 239 | - Sheet sheet = book.getSheet(0); | ||
| 240 | - | ||
| 241 | - // 2-2、处理数据 | ||
| 242 | - int all_bc_ks = 0; // 总空驶班次 | ||
| 243 | - int all_bc_yy = 0; // 总营运班次 | ||
| 244 | - double all_lc_ks = 0; // 总空驶里程 | ||
| 245 | - double all_lc_yy = 0; // 总营运里程 | ||
| 246 | - | ||
| 247 | - String[] headarrays = new String[maxfcno.intValue() + 3]; | ||
| 248 | - headarrays[0] = "路牌"; | ||
| 249 | - headarrays[maxfcno.intValue() + 1] = "空驶班次/空驶里程"; | ||
| 250 | - headarrays[maxfcno.intValue() + 2] = "运营班次/运营里程"; | ||
| 251 | - | ||
| 252 | - for (int r = 1; r < sheet.getRows(); r++) { | ||
| 253 | - List<FcInfo> fcInfos = new ArrayList<>(); | ||
| 254 | - // 每行第一列都是路牌 | ||
| 255 | - fcInfos.add(new FcInfo(null, null, sheet.getCell(0, r).getContents(), null, null, null, null)); // 用fcsj放置路牌显示 | ||
| 256 | - | ||
| 257 | - int bc_ks = 0; // 空驶班次 | ||
| 258 | - int bc_yy = 0; // 营运班次 | ||
| 259 | - double lc_ks = 0; // 空驶里程 | ||
| 260 | - double lc_yy = 0; // 营运里程 | ||
| 261 | - | ||
| 262 | - for (int c = 1; c <= maxfcno; c++) { | ||
| 263 | - String content_str = sheet.getCell(c, r).getContents(); | ||
| 264 | - try { | ||
| 265 | - String[] content = StringUtils.isEmpty(content_str) ? null : content_str.split(","); // 总的内容 | ||
| 266 | - | ||
| 267 | - String ttdid_str = content == null ? "" : content[0]; // 时刻表明细id | ||
| 268 | - String fcsj = content == null ? "" : content[1]; // 发车时间 | ||
| 269 | - String jhlc = content == null ? "" : content[2]; // 计划里程 | ||
| 270 | - String fzdname = content == null ? "" : content[3]; // 发车站点名称 | ||
| 271 | - String bctype = content == null ? "" : content[4]; // 班次类型 | ||
| 272 | - String xldir = content == null ? "" : content[5]; // 线路上下行 | ||
| 273 | - String isfb = content == null ? "" : content[6]; // 是否分班 | ||
| 274 | - | ||
| 275 | - String qdzCode = content == null ? "" : content[7]; // 起点站编码 | ||
| 276 | - String zdzCode = content == null ? "" : content[8]; // 终点站编码 | ||
| 277 | - | ||
| 278 | - FcInfo fcInfo = new FcInfo(ttdid_str, bctype, fcsj, xldir, isfb, qdzCode, zdzCode); | ||
| 279 | - | ||
| 280 | - if (StringUtils.isNotEmpty(fzdname)) | ||
| 281 | - headarrays[c] = fzdname; | ||
| 282 | - fcInfos.add(fcInfo); | ||
| 283 | - | ||
| 284 | - | ||
| 285 | - // 计算班次里程 | ||
| 286 | - if (StringUtils.isNotEmpty(jhlc)) { | ||
| 287 | - if ("in".equals(bctype) || "out".equals(bctype) || "ldks".equals(bctype)) { | ||
| 288 | - bc_ks += 1; | ||
| 289 | - lc_ks += Double.valueOf(jhlc); | ||
| 290 | - | ||
| 291 | - all_bc_ks += 1; | ||
| 292 | - all_lc_ks += Double.valueOf(jhlc); | ||
| 293 | - | ||
| 294 | - } else { | ||
| 295 | - bc_yy += 1; | ||
| 296 | - lc_yy += Double.valueOf(jhlc); | ||
| 297 | - | ||
| 298 | - all_bc_yy += 1; | ||
| 299 | - all_lc_yy += Double.valueOf(jhlc); | ||
| 300 | - } | ||
| 301 | - } | ||
| 302 | - | ||
| 303 | - } catch (Exception exp) { | ||
| 304 | - exp.printStackTrace(); | ||
| 305 | - LOGGER.info("第{}行,第{}列数据有问题,数据={},异常message={}", r, c, content_str, exp.getCause()); | ||
| 306 | - break; | ||
| 307 | - } | ||
| 308 | - | ||
| 309 | - } | ||
| 310 | - | ||
| 311 | - // 添加一列 空驶班次/空驶里程,fcsj放置数据 | ||
| 312 | - fcInfos.add(new FcInfo(null, null, String.format("%d/%.3f", bc_ks, lc_ks), null, null, null, null)); | ||
| 313 | - | ||
| 314 | - // 添加一列 营运班次/营运里程,fcsj放置数据 | ||
| 315 | - fcInfos.add(new FcInfo(null, null, String.format("%d/%.3f", bc_yy, lc_yy), null, null, null, null)); | ||
| 316 | - | ||
| 317 | - editInfo.getContents().add(fcInfos); | ||
| 318 | - } | ||
| 319 | - editInfo.getHeader().addAll(Arrays.asList(headarrays)); | ||
| 320 | - | ||
| 321 | - editInfo.setYy_desc(String.format("空驶班次=%d,营运班次=%d,空驶里程=%.3f,营运里程=%.3f,总里程=%.3f", all_bc_ks, all_bc_yy, all_lc_ks, all_lc_yy, all_lc_ks + all_lc_yy)); | ||
| 322 | - } | ||
| 323 | - | ||
| 324 | - LOGGER.info("//---------------- 时刻表编辑用数据输出 success... ----------------//"); | ||
| 325 | - | ||
| 326 | - return editInfo; | ||
| 327 | - } catch (Exception exp) { | ||
| 328 | - LOGGER.info("//---------------- 时刻表编辑用数据输出 failed... ----------------//"); | ||
| 329 | - | ||
| 330 | - StringWriter sw = new StringWriter(); | ||
| 331 | - exp.printStackTrace(new PrintWriter(sw)); | ||
| 332 | - LOGGER.info(sw.toString()); | ||
| 333 | - | ||
| 334 | - throw new ScheduleException(exp.getMessage()); | ||
| 335 | - } | ||
| 336 | - } | ||
| 337 | - | ||
| 338 | -} | 1 | +package com.bsth.service.schedule.datatools; |
| 2 | + | ||
| 3 | +import com.bsth.service.schedule.exception.ScheduleException; | ||
| 4 | +import com.bsth.service.schedule.utils.DataToolsProperties; | ||
| 5 | +import com.bsth.service.schedule.utils.DataToolsService; | ||
| 6 | +import jxl.Cell; | ||
| 7 | +import jxl.Sheet; | ||
| 8 | +import jxl.Workbook; | ||
| 9 | +import jxl.write.Label; | ||
| 10 | +import jxl.write.WritableSheet; | ||
| 11 | +import jxl.write.WritableWorkbook; | ||
| 12 | +import org.apache.commons.lang3.StringUtils; | ||
| 13 | +import org.joda.time.DateTime; | ||
| 14 | +import org.slf4j.Logger; | ||
| 15 | +import org.slf4j.LoggerFactory; | ||
| 16 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 17 | +import org.springframework.beans.factory.annotation.Qualifier; | ||
| 18 | +import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
| 19 | +import org.springframework.stereotype.Service; | ||
| 20 | + | ||
| 21 | +import java.io.File; | ||
| 22 | +import java.io.PrintWriter; | ||
| 23 | +import java.io.StringWriter; | ||
| 24 | +import java.util.*; | ||
| 25 | + | ||
| 26 | +/** | ||
| 27 | + * Created by xu on 17/5/16. | ||
| 28 | + */ | ||
| 29 | +@EnableConfigurationProperties(DataToolsProperties.class) | ||
| 30 | +@Service(value = "ttInfoDetail_dataTool") | ||
| 31 | +public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetailForEdit { | ||
| 32 | + /** 日志记录器 */ | ||
| 33 | + private final static Logger LOGGER = LoggerFactory.getLogger(TTInfoDetailDataToolsImpl.class); | ||
| 34 | + | ||
| 35 | + @Autowired | ||
| 36 | + @Qualifier(value = "dataToolsServiceImpl") | ||
| 37 | + private DataToolsService dataToolsService; | ||
| 38 | + | ||
| 39 | + @Autowired | ||
| 40 | + private DataToolsProperties dataToolsProperties; | ||
| 41 | + | ||
| 42 | + @Override | ||
| 43 | + public File uploadFile(String filename, byte[] filedata) throws ScheduleException { | ||
| 44 | + try { | ||
| 45 | + // 对上传的excel文件做处理,将第一个sheet名字设定为工作表1 | ||
| 46 | + File file = dataToolsService.uploadFile(filename, filedata); | ||
| 47 | + Workbook workbook = Workbook.getWorkbook(file); | ||
| 48 | + Sheet sheet = workbook.getSheet(0); | ||
| 49 | + | ||
| 50 | + File fileCal = new File(file.getAbsolutePath() + "_sheetChange.xls"); | ||
| 51 | + WritableWorkbook writableWorkbook = Workbook.createWorkbook(fileCal); | ||
| 52 | + WritableSheet writableSheet = writableWorkbook.createSheet("工作表1", 0); | ||
| 53 | + for (int i = 0; i < sheet.getRows(); i++) { | ||
| 54 | + Cell[] cells = sheet.getRow(i); | ||
| 55 | + for (int j = 0; j < cells.length; j++) { | ||
| 56 | + writableSheet.addCell(new Label(j, i, cells[j].getContents())); | ||
| 57 | + } | ||
| 58 | + } | ||
| 59 | + writableWorkbook.write(); | ||
| 60 | + writableWorkbook.close(); | ||
| 61 | + | ||
| 62 | + return fileCal; | ||
| 63 | + | ||
| 64 | + } catch (Exception exp) { | ||
| 65 | + throw new ScheduleException(exp); | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + @Override | ||
| 70 | + public void importData(File file, Map<String, Object> params) throws ScheduleException { | ||
| 71 | + try { | ||
| 72 | + LOGGER.info("//---------------- 导入时刻表明细 start... ----------------//"); | ||
| 73 | + | ||
| 74 | + String filename = file.getAbsolutePath(); // xls文件名 | ||
| 75 | + String sheetname = String.valueOf(params.get("sheetname")); // sheet名字 | ||
| 76 | + Long ttid = Long.valueOf(String.valueOf(params.get("ttid"))); // 时刻表id | ||
| 77 | + Long xlid = Long.valueOf(String.valueOf(params.get("xlid"))); // 线路id | ||
| 78 | + Integer lineid = Integer.valueOf(String.valueOf(params.get("lineinfo"))); // 线路标准id | ||
| 79 | + String xlname = String.valueOf(params.get("xlname")); // 线路名字 | ||
| 80 | + String ttname = String.valueOf(params.get("ttname")); // 时刻表名字 | ||
| 81 | + | ||
| 82 | + LOGGER.info("参数1, xls文件名={},sheet名字={}", filename, sheetname); | ||
| 83 | + LOGGER.info("参数2, 线路id={},线路名字={}", xlid, xlname); | ||
| 84 | + LOGGER.info("参数3, 时刻表id={},时刻表名字={}", ttid, ttname); | ||
| 85 | + | ||
| 86 | + LOGGER.info("转换xls文件格式成文本格式..."); | ||
| 87 | + // 1、修改已经上传的excel文件,在每个起点站后标示数字,表示第几个班次 | ||
| 88 | + // 2、由于格式问题,需要把内容都转换成字符串 | ||
| 89 | + List<String> colList = new ArrayList<>(); | ||
| 90 | + Workbook workbook = Workbook.getWorkbook(new File(filename)); | ||
| 91 | + Sheet sheet = workbook.getSheet(sheetname); | ||
| 92 | + Cell[] cells = sheet.getRow(0); | ||
| 93 | + for (int i = 0; i < cells.length; i++) { | ||
| 94 | + if (i == 0) { | ||
| 95 | + colList.add(cells[i].getContents().trim()); | ||
| 96 | + } else { | ||
| 97 | + colList.add(cells[i].getContents() + i); | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + File fileCal = new File(filename + "_stringType.xls"); | ||
| 102 | + WritableWorkbook writableWorkbook = Workbook.createWorkbook(fileCal, workbook); | ||
| 103 | + WritableSheet sheet1 = writableWorkbook.getSheet(sheetname); | ||
| 104 | + for (int i = 0; i < sheet1.getColumns(); i++) { // 第一行数据 | ||
| 105 | + sheet1.addCell(new Label(i, 0, colList.get(i))); | ||
| 106 | + } | ||
| 107 | + for (int i = 1; i < sheet1.getRows(); i++) { // 第二行开始 | ||
| 108 | + Cell[] cells1 = sheet.getRow(i); | ||
| 109 | + for (int j = 0; j < cells1.length; j++) { | ||
| 110 | + sheet1.addCell(new Label(j, i, cells1[j].getContents())); | ||
| 111 | + } | ||
| 112 | + } | ||
| 113 | + writableWorkbook.write(); | ||
| 114 | + writableWorkbook.close(); | ||
| 115 | + | ||
| 116 | + // 2、删除原有数据 | ||
| 117 | + // 操作在ktr内部执行 | ||
| 118 | + | ||
| 119 | + // 3、导入时刻表 | ||
| 120 | + | ||
| 121 | + // 计算表头参数 | ||
| 122 | + Workbook book = Workbook.getWorkbook(fileCal); | ||
| 123 | + Sheet sheet_exp = book.getSheet(sheetname); | ||
| 124 | + List<String> columnames = new ArrayList<>(); | ||
| 125 | + for (int i = 0; i < sheet_exp.getColumns(); i++) { // 获取第一行,数据,作为列名 | ||
| 126 | + columnames.add(sheet_exp.getCell(i, 0).getContents()); | ||
| 127 | + } | ||
| 128 | + LOGGER.info("表头={}", StringUtils.join(columnames.toArray(), ",")); | ||
| 129 | + | ||
| 130 | + // 创建ktr转换所需参数 | ||
| 131 | + Map<String, Object> ktrParms = new HashMap<>(); | ||
| 132 | + File ktrFile = new File(this.getClass().getResource( | ||
| 133 | + dataToolsProperties.getTtinfodetailMetadatainputktr()).toURI()); | ||
| 134 | +// File ktrFile2 = new File(this.getClass().getResource( | ||
| 135 | +// dataToolsProperties.getTtinfodetailDatainputktr()).toURI()); | ||
| 136 | + File ktrFile2 = new File(this.getClass().getResource( | ||
| 137 | + dataToolsProperties.getTtinfodetailDatainputktr2()).toURI()); | ||
| 138 | + | ||
| 139 | + // 通用参数,转换文件路径,excel输入文件路径,错误输出文件路径 | ||
| 140 | + ktrParms.put("transpath", ktrFile.getAbsolutePath()); | ||
| 141 | + ktrParms.put("filepath", fileCal.getAbsolutePath()); | ||
| 142 | + ktrParms.put("erroroutputdir", dataToolsProperties.getTransErrordir()); | ||
| 143 | + | ||
| 144 | + // 附加参数 | ||
| 145 | + ktrParms.put("injectktrfile", ktrFile2.getAbsolutePath()); // 注入元数据的ktr文件 | ||
| 146 | + ktrParms.put("sheetname", sheetname); // sheet工作区的名字 | ||
| 147 | + ktrParms.put("lineinfoid", lineid); // 线路标准id | ||
| 148 | + ktrParms.put("xlname", xlname); // 线路名称 | ||
| 149 | + ktrParms.put("ttinfoname", ttname); // 时刻表名称 | ||
| 150 | + ktrParms.put("ttid", ttid.intValue()); // 时刻表id | ||
| 151 | + ktrParms.put("excelfieldnames", StringUtils.join(columnames.toArray(), ",")); // 时刻表excel输入字段名,以逗号连接 | ||
| 152 | + columnames.remove(0); | ||
| 153 | + ktrParms.put("normalizefieldnames", StringUtils.join(columnames.toArray(), ",")); // 数据范式化字段名,以逗号连接 | ||
| 154 | + | ||
| 155 | + dataToolsService.importData(fileCal, ktrParms); | ||
| 156 | + | ||
| 157 | + LOGGER.info("//---------------- 导入时刻表明细 success... ----------------//"); | ||
| 158 | + } catch (Exception exp) { | ||
| 159 | + LOGGER.info("//---------------- 导入时刻表明细 failed... ----------------//"); | ||
| 160 | + | ||
| 161 | + StringWriter sw = new StringWriter(); | ||
| 162 | + exp.printStackTrace(new PrintWriter(sw)); | ||
| 163 | + LOGGER.info(sw.toString()); | ||
| 164 | + | ||
| 165 | + throw new ScheduleException(exp.getMessage()); | ||
| 166 | + } | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + @Override | ||
| 170 | + public File exportData(Map<String, Object> params) throws ScheduleException { | ||
| 171 | + try { | ||
| 172 | + LOGGER.info("//---------------- 导出时刻表明细 start... ----------------//"); | ||
| 173 | + | ||
| 174 | + // 创建ktr转换所需参数 | ||
| 175 | + Map<String, Object> ktrParms = new HashMap<>(); | ||
| 176 | + File ktrFile = new File(this.getClass().getResource( | ||
| 177 | + dataToolsProperties.getTtinfodetailMetaoutput()).toURI()); | ||
| 178 | + File ktrFile2 = new File(this.getClass().getResource( | ||
| 179 | + dataToolsProperties.getTtinfodetailOutput()).toURI()); | ||
| 180 | + | ||
| 181 | + // 通用参数,转换文件路径,excel输出文件名 | ||
| 182 | + ktrParms.put("transpath", ktrFile.getAbsolutePath()); | ||
| 183 | + ktrParms.put("filename", String.format("时刻表_(id=%s)_download-", String.valueOf(params.get("ttinfoid")))); | ||
| 184 | + | ||
| 185 | + // 附加参数 | ||
| 186 | + ktrParms.put("injectktrfile", ktrFile2.getAbsolutePath()); // 注入元数据的ktr文件 | ||
| 187 | + ktrParms.put("ttinfoid", String.valueOf(params.get("ttinfoid"))); | ||
| 188 | + | ||
| 189 | + File file = dataToolsService.exportData(ktrParms); | ||
| 190 | + | ||
| 191 | + LOGGER.info("//---------------- 导出时刻表明细 success... ----------------//"); | ||
| 192 | + | ||
| 193 | + return file; | ||
| 194 | + } catch (Exception exp) { | ||
| 195 | + LOGGER.info("//---------------- 导出时刻表明细 failed... ----------------//"); | ||
| 196 | + | ||
| 197 | + StringWriter sw = new StringWriter(); | ||
| 198 | + exp.printStackTrace(new PrintWriter(sw)); | ||
| 199 | + LOGGER.info(sw.toString()); | ||
| 200 | + | ||
| 201 | + throw new ScheduleException(exp.getMessage()); | ||
| 202 | + } | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + @Override | ||
| 206 | + public EditInfo getEditInfo(Integer xlid, Long ttid, Long maxfcno) throws ScheduleException { | ||
| 207 | + try { | ||
| 208 | + LOGGER.info("//---------------- 时刻表编辑用数据输出 start... ----------------//"); | ||
| 209 | + | ||
| 210 | + // 创建ktr转换所需参数 | ||
| 211 | + Map<String, Object> ktrParms = new HashMap<>(); | ||
| 212 | + File ktrFile = new File(this.getClass().getResource( | ||
| 213 | + dataToolsProperties.getTtinfodetailForeditktr()).toURI()); | ||
| 214 | + | ||
| 215 | + // 通用参数,转换文件路径,excel输出文件名,错误输出文件路径 | ||
| 216 | + ktrParms.put("transpath", ktrFile.getAbsolutePath()); | ||
| 217 | + ktrParms.put("filename", "todo"); | ||
| 218 | + | ||
| 219 | + // 附加参数 | ||
| 220 | + String outputFilePath = String.format("ttinfodetail_(id=%s)_foredit-%s", | ||
| 221 | + String.valueOf(ttid), new DateTime().toString("yyyyMMddHHmmss")); | ||
| 222 | + | ||
| 223 | + ktrParms.put("tempfilepath", dataToolsProperties.getTransTempdir() + File.separator + outputFilePath); // 数据输出文件路径 | ||
| 224 | + ktrParms.put("xlid", String.valueOf(xlid)); | ||
| 225 | + ktrParms.put("ttid", String.valueOf(ttid)); | ||
| 226 | + | ||
| 227 | + dataToolsService.exportData(ktrParms); | ||
| 228 | + | ||
| 229 | + EditInfo editInfo = new EditInfo(); // 输出数据 | ||
| 230 | + | ||
| 231 | + | ||
| 232 | + // 1.6、获取最大的发车数,用于输出数据的数量 | ||
| 233 | + LOGGER.info("最大发车顺序号={}", maxfcno); | ||
| 234 | + if (maxfcno != null) { | ||
| 235 | + // 2、读取ktr生成的excel数据,组织编辑用数据返回 | ||
| 236 | + // 2-1、读取Excel文件 | ||
| 237 | + Workbook book = Workbook.getWorkbook(new File(dataToolsProperties.getTransTempdir() + | ||
| 238 | + File.separator + outputFilePath + ".xls")); | ||
| 239 | + Sheet sheet = book.getSheet(0); | ||
| 240 | + | ||
| 241 | + // 2-2、处理数据 | ||
| 242 | + int all_bc_ks = 0; // 总空驶班次 | ||
| 243 | + int all_bc_yy = 0; // 总营运班次 | ||
| 244 | + double all_lc_ks = 0; // 总空驶里程 | ||
| 245 | + double all_lc_yy = 0; // 总营运里程 | ||
| 246 | + | ||
| 247 | + String[] headarrays = new String[maxfcno.intValue() + 3]; | ||
| 248 | + headarrays[0] = "路牌"; | ||
| 249 | + headarrays[maxfcno.intValue() + 1] = "空驶班次/空驶里程"; | ||
| 250 | + headarrays[maxfcno.intValue() + 2] = "运营班次/运营里程"; | ||
| 251 | + | ||
| 252 | + for (int r = 1; r < sheet.getRows(); r++) { | ||
| 253 | + List<FcInfo> fcInfos = new ArrayList<>(); | ||
| 254 | + // 每行第一列都是路牌 | ||
| 255 | + fcInfos.add(new FcInfo(null, null, sheet.getCell(0, r).getContents(), null, null, null, null)); // 用fcsj放置路牌显示 | ||
| 256 | + | ||
| 257 | + int bc_ks = 0; // 空驶班次 | ||
| 258 | + int bc_yy = 0; // 营运班次 | ||
| 259 | + double lc_ks = 0; // 空驶里程 | ||
| 260 | + double lc_yy = 0; // 营运里程 | ||
| 261 | + | ||
| 262 | + for (int c = 1; c <= maxfcno; c++) { | ||
| 263 | + String content_str = sheet.getCell(c, r).getContents(); | ||
| 264 | + try { | ||
| 265 | + String[] content = StringUtils.isEmpty(content_str) ? null : content_str.split(","); // 总的内容 | ||
| 266 | + | ||
| 267 | + String ttdid_str = content == null ? "" : content[0]; // 时刻表明细id | ||
| 268 | + String fcsj = content == null ? "" : content[1]; // 发车时间 | ||
| 269 | + String jhlc = content == null ? "" : content[2]; // 计划里程 | ||
| 270 | + String fzdname = content == null ? "" : content[3]; // 发车站点名称 | ||
| 271 | + String bctype = content == null ? "" : content[4]; // 班次类型 | ||
| 272 | + String xldir = content == null ? "" : content[5]; // 线路上下行 | ||
| 273 | + String isfb = content == null ? "" : content[6]; // 是否分班 | ||
| 274 | + | ||
| 275 | + String qdzCode = content == null ? "" : content[7]; // 起点站编码 | ||
| 276 | + String zdzCode = content == null ? "" : content[8]; // 终点站编码 | ||
| 277 | + | ||
| 278 | + FcInfo fcInfo = new FcInfo(ttdid_str, bctype, fcsj, xldir, isfb, qdzCode, zdzCode); | ||
| 279 | + | ||
| 280 | + if (StringUtils.isNotEmpty(fzdname)) | ||
| 281 | + headarrays[c] = fzdname; | ||
| 282 | + fcInfos.add(fcInfo); | ||
| 283 | + | ||
| 284 | + | ||
| 285 | + // 计算班次里程 | ||
| 286 | + if (StringUtils.isNotEmpty(jhlc)) { | ||
| 287 | + if ("in".equals(bctype) || "out".equals(bctype) || "ldks".equals(bctype)) { | ||
| 288 | + bc_ks += 1; | ||
| 289 | + lc_ks += Double.valueOf(jhlc); | ||
| 290 | + | ||
| 291 | + all_bc_ks += 1; | ||
| 292 | + all_lc_ks += Double.valueOf(jhlc); | ||
| 293 | + | ||
| 294 | + } else { | ||
| 295 | + bc_yy += 1; | ||
| 296 | + lc_yy += Double.valueOf(jhlc); | ||
| 297 | + | ||
| 298 | + all_bc_yy += 1; | ||
| 299 | + all_lc_yy += Double.valueOf(jhlc); | ||
| 300 | + } | ||
| 301 | + } | ||
| 302 | + | ||
| 303 | + } catch (Exception exp) { | ||
| 304 | + exp.printStackTrace(); | ||
| 305 | + LOGGER.info("第{}行,第{}列数据有问题,数据={},异常message={}", r, c, content_str, exp.getCause()); | ||
| 306 | + break; | ||
| 307 | + } | ||
| 308 | + | ||
| 309 | + } | ||
| 310 | + | ||
| 311 | + // 添加一列 空驶班次/空驶里程,fcsj放置数据 | ||
| 312 | + fcInfos.add(new FcInfo(null, null, String.format("%d/%.3f", bc_ks, lc_ks), null, null, null, null)); | ||
| 313 | + | ||
| 314 | + // 添加一列 营运班次/营运里程,fcsj放置数据 | ||
| 315 | + fcInfos.add(new FcInfo(null, null, String.format("%d/%.3f", bc_yy, lc_yy), null, null, null, null)); | ||
| 316 | + | ||
| 317 | + editInfo.getContents().add(fcInfos); | ||
| 318 | + } | ||
| 319 | + editInfo.getHeader().addAll(Arrays.asList(headarrays)); | ||
| 320 | + | ||
| 321 | + editInfo.setYy_desc(String.format("空驶班次=%d,营运班次=%d,空驶里程=%.3f,营运里程=%.3f,总里程=%.3f", all_bc_ks, all_bc_yy, all_lc_ks, all_lc_yy, all_lc_ks + all_lc_yy)); | ||
| 322 | + } | ||
| 323 | + | ||
| 324 | + LOGGER.info("//---------------- 时刻表编辑用数据输出 success... ----------------//"); | ||
| 325 | + | ||
| 326 | + return editInfo; | ||
| 327 | + } catch (Exception exp) { | ||
| 328 | + LOGGER.info("//---------------- 时刻表编辑用数据输出 failed... ----------------//"); | ||
| 329 | + | ||
| 330 | + StringWriter sw = new StringWriter(); | ||
| 331 | + exp.printStackTrace(new PrintWriter(sw)); | ||
| 332 | + LOGGER.info(sw.toString()); | ||
| 333 | + | ||
| 334 | + throw new ScheduleException(exp.getMessage()); | ||
| 335 | + } | ||
| 336 | + } | ||
| 337 | + | ||
| 338 | +} |
src/main/java/com/bsth/service/schedule/datatools/TTInfoDetailForEdit.java
| 1 | -package com.bsth.service.schedule.datatools; | ||
| 2 | - | ||
| 3 | -import com.bsth.service.schedule.exception.ScheduleException; | ||
| 4 | -import org.apache.commons.lang3.StringUtils; | ||
| 5 | - | ||
| 6 | -import java.util.ArrayList; | ||
| 7 | -import java.util.List; | ||
| 8 | - | ||
| 9 | -/** | ||
| 10 | - * Created by xu on 17/5/16. | ||
| 11 | - */ | ||
| 12 | -public interface TTInfoDetailForEdit { | ||
| 13 | - /** | ||
| 14 | - * 发车信息内部类。 | ||
| 15 | - */ | ||
| 16 | - public static class FcInfo { | ||
| 17 | - /** 时刻明细id */ | ||
| 18 | - private Long ttdid; | ||
| 19 | - /** 发车时间 */ | ||
| 20 | - private String fcsj; | ||
| 21 | - /** 班次类型 */ | ||
| 22 | - private String bc_type; | ||
| 23 | - /** 线路上下行 */ | ||
| 24 | - private String xldir; | ||
| 25 | - /** 是偶分班 */ | ||
| 26 | - private Boolean isfb; | ||
| 27 | - | ||
| 28 | - /** 起点站code */ | ||
| 29 | - private String qdzCode; | ||
| 30 | - /** 终点站code */ | ||
| 31 | - private String zdzCode; | ||
| 32 | - | ||
| 33 | - public FcInfo() { | ||
| 34 | - } | ||
| 35 | - | ||
| 36 | - public FcInfo( | ||
| 37 | - String ttdid_str, | ||
| 38 | - String bc_type, | ||
| 39 | - String fcsj, | ||
| 40 | - String xldir, | ||
| 41 | - String isfb, | ||
| 42 | - String qdzCode, | ||
| 43 | - String zdzCode) { | ||
| 44 | - this.ttdid = StringUtils.isEmpty(ttdid_str) ? null : Long.valueOf(ttdid_str); | ||
| 45 | - this.bc_type = bc_type; | ||
| 46 | - this.fcsj = fcsj; | ||
| 47 | - this.xldir = xldir; | ||
| 48 | - if ("N".equals(isfb)) | ||
| 49 | - this.isfb = false; | ||
| 50 | - else if ("Y".equals(isfb) || "true".equals(isfb)) | ||
| 51 | - this.isfb = true; | ||
| 52 | - else | ||
| 53 | - this.isfb = false; | ||
| 54 | - | ||
| 55 | - if (StringUtils.isNotEmpty(qdzCode) && !"null".equals(qdzCode)) { | ||
| 56 | - this.qdzCode = qdzCode; | ||
| 57 | - } | ||
| 58 | - if (StringUtils.isNotEmpty(zdzCode) && !"null".equals(zdzCode)) { | ||
| 59 | - this.zdzCode = zdzCode; | ||
| 60 | - } | ||
| 61 | - | ||
| 62 | - } | ||
| 63 | - | ||
| 64 | - public Long getTtdid() { | ||
| 65 | - return ttdid; | ||
| 66 | - } | ||
| 67 | - | ||
| 68 | - public void setTtdid(Long ttdid) { | ||
| 69 | - this.ttdid = ttdid; | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - public String getFcsj() { | ||
| 73 | - return fcsj; | ||
| 74 | - } | ||
| 75 | - | ||
| 76 | - public void setFcsj(String fcsj) { | ||
| 77 | - this.fcsj = fcsj; | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | - public String getBc_type() { | ||
| 81 | - return bc_type; | ||
| 82 | - } | ||
| 83 | - | ||
| 84 | - public void setBc_type(String bc_type) { | ||
| 85 | - this.bc_type = bc_type; | ||
| 86 | - } | ||
| 87 | - | ||
| 88 | - public String getXldir() { | ||
| 89 | - return xldir; | ||
| 90 | - } | ||
| 91 | - | ||
| 92 | - public void setXldir(String xldir) { | ||
| 93 | - this.xldir = xldir; | ||
| 94 | - } | ||
| 95 | - | ||
| 96 | - public Boolean getIsfb() { | ||
| 97 | - return isfb; | ||
| 98 | - } | ||
| 99 | - | ||
| 100 | - public void setIsfb(Boolean isfb) { | ||
| 101 | - this.isfb = isfb; | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | - public String getQdzCode() { | ||
| 105 | - return qdzCode; | ||
| 106 | - } | ||
| 107 | - | ||
| 108 | - public void setQdzCode(String qdzCode) { | ||
| 109 | - this.qdzCode = qdzCode; | ||
| 110 | - } | ||
| 111 | - | ||
| 112 | - public String getZdzCode() { | ||
| 113 | - return zdzCode; | ||
| 114 | - } | ||
| 115 | - | ||
| 116 | - public void setZdzCode(String zdzCode) { | ||
| 117 | - this.zdzCode = zdzCode; | ||
| 118 | - } | ||
| 119 | - } | ||
| 120 | - | ||
| 121 | - /** | ||
| 122 | - * 时刻表编辑用的返回数据。 | ||
| 123 | - */ | ||
| 124 | - public static class EditInfo { | ||
| 125 | - /** 标题数据 */ | ||
| 126 | - private List<String> header = new ArrayList<>(); | ||
| 127 | - /** 内容数据 */ | ||
| 128 | - private List<List<FcInfo>> contents = new ArrayList<>(); | ||
| 129 | - | ||
| 130 | - /** 营运描述 */ | ||
| 131 | - private String yy_desc; | ||
| 132 | - | ||
| 133 | - public List<String> getHeader() { | ||
| 134 | - return header; | ||
| 135 | - } | ||
| 136 | - | ||
| 137 | - public void setHeader(List<String> header) { | ||
| 138 | - this.header = header; | ||
| 139 | - } | ||
| 140 | - | ||
| 141 | - public List<List<FcInfo>> getContents() { | ||
| 142 | - return contents; | ||
| 143 | - } | ||
| 144 | - | ||
| 145 | - public void setContents(List<List<FcInfo>> contents) { | ||
| 146 | - this.contents = contents; | ||
| 147 | - } | ||
| 148 | - | ||
| 149 | - public String getYy_desc() { | ||
| 150 | - return yy_desc; | ||
| 151 | - } | ||
| 152 | - | ||
| 153 | - public void setYy_desc(String yy_desc) { | ||
| 154 | - this.yy_desc = yy_desc; | ||
| 155 | - } | ||
| 156 | - } | ||
| 157 | - | ||
| 158 | - /** | ||
| 159 | - * 获取待编辑的数据。 | ||
| 160 | - * @param xlid 线路id | ||
| 161 | - * @param ttid 时刻表id | ||
| 162 | - * @param maxfcno 最大发车顺序号 | ||
| 163 | - * @return | ||
| 164 | - */ | ||
| 165 | - EditInfo getEditInfo(Integer xlid, Long ttid, Long maxfcno) throws ScheduleException; | ||
| 166 | - | ||
| 167 | -} | ||
| 168 | - | 1 | +package com.bsth.service.schedule.datatools; |
| 2 | + | ||
| 3 | +import com.bsth.service.schedule.exception.ScheduleException; | ||
| 4 | +import org.apache.commons.lang3.StringUtils; | ||
| 5 | + | ||
| 6 | +import java.util.ArrayList; | ||
| 7 | +import java.util.List; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * Created by xu on 17/5/16. | ||
| 11 | + */ | ||
| 12 | +public interface TTInfoDetailForEdit { | ||
| 13 | + /** | ||
| 14 | + * 发车信息内部类。 | ||
| 15 | + */ | ||
| 16 | + public static class FcInfo { | ||
| 17 | + /** 时刻明细id */ | ||
| 18 | + private Long ttdid; | ||
| 19 | + /** 发车时间 */ | ||
| 20 | + private String fcsj; | ||
| 21 | + /** 班次类型 */ | ||
| 22 | + private String bc_type; | ||
| 23 | + /** 线路上下行 */ | ||
| 24 | + private String xldir; | ||
| 25 | + /** 是偶分班 */ | ||
| 26 | + private Boolean isfb; | ||
| 27 | + | ||
| 28 | + /** 起点站code */ | ||
| 29 | + private String qdzCode; | ||
| 30 | + /** 终点站code */ | ||
| 31 | + private String zdzCode; | ||
| 32 | + | ||
| 33 | + public FcInfo() { | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public FcInfo( | ||
| 37 | + String ttdid_str, | ||
| 38 | + String bc_type, | ||
| 39 | + String fcsj, | ||
| 40 | + String xldir, | ||
| 41 | + String isfb, | ||
| 42 | + String qdzCode, | ||
| 43 | + String zdzCode) { | ||
| 44 | + this.ttdid = StringUtils.isEmpty(ttdid_str) ? null : Long.valueOf(ttdid_str); | ||
| 45 | + this.bc_type = bc_type; | ||
| 46 | + this.fcsj = fcsj; | ||
| 47 | + this.xldir = xldir; | ||
| 48 | + if ("N".equals(isfb)) | ||
| 49 | + this.isfb = false; | ||
| 50 | + else if ("Y".equals(isfb) || "true".equals(isfb)) | ||
| 51 | + this.isfb = true; | ||
| 52 | + else | ||
| 53 | + this.isfb = false; | ||
| 54 | + | ||
| 55 | + if (StringUtils.isNotEmpty(qdzCode) && !"null".equals(qdzCode)) { | ||
| 56 | + this.qdzCode = qdzCode; | ||
| 57 | + } | ||
| 58 | + if (StringUtils.isNotEmpty(zdzCode) && !"null".equals(zdzCode)) { | ||
| 59 | + this.zdzCode = zdzCode; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + public Long getTtdid() { | ||
| 65 | + return ttdid; | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + public void setTtdid(Long ttdid) { | ||
| 69 | + this.ttdid = ttdid; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + public String getFcsj() { | ||
| 73 | + return fcsj; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + public void setFcsj(String fcsj) { | ||
| 77 | + this.fcsj = fcsj; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + public String getBc_type() { | ||
| 81 | + return bc_type; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + public void setBc_type(String bc_type) { | ||
| 85 | + this.bc_type = bc_type; | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + public String getXldir() { | ||
| 89 | + return xldir; | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + public void setXldir(String xldir) { | ||
| 93 | + this.xldir = xldir; | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + public Boolean getIsfb() { | ||
| 97 | + return isfb; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + public void setIsfb(Boolean isfb) { | ||
| 101 | + this.isfb = isfb; | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + public String getQdzCode() { | ||
| 105 | + return qdzCode; | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + public void setQdzCode(String qdzCode) { | ||
| 109 | + this.qdzCode = qdzCode; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + public String getZdzCode() { | ||
| 113 | + return zdzCode; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + public void setZdzCode(String zdzCode) { | ||
| 117 | + this.zdzCode = zdzCode; | ||
| 118 | + } | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + /** | ||
| 122 | + * 时刻表编辑用的返回数据。 | ||
| 123 | + */ | ||
| 124 | + public static class EditInfo { | ||
| 125 | + /** 标题数据 */ | ||
| 126 | + private List<String> header = new ArrayList<>(); | ||
| 127 | + /** 内容数据 */ | ||
| 128 | + private List<List<FcInfo>> contents = new ArrayList<>(); | ||
| 129 | + | ||
| 130 | + /** 营运描述 */ | ||
| 131 | + private String yy_desc; | ||
| 132 | + | ||
| 133 | + public List<String> getHeader() { | ||
| 134 | + return header; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + public void setHeader(List<String> header) { | ||
| 138 | + this.header = header; | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + public List<List<FcInfo>> getContents() { | ||
| 142 | + return contents; | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + public void setContents(List<List<FcInfo>> contents) { | ||
| 146 | + this.contents = contents; | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + public String getYy_desc() { | ||
| 150 | + return yy_desc; | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + public void setYy_desc(String yy_desc) { | ||
| 154 | + this.yy_desc = yy_desc; | ||
| 155 | + } | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + /** | ||
| 159 | + * 获取待编辑的数据。 | ||
| 160 | + * @param xlid 线路id | ||
| 161 | + * @param ttid 时刻表id | ||
| 162 | + * @param maxfcno 最大发车顺序号 | ||
| 163 | + * @return | ||
| 164 | + */ | ||
| 165 | + EditInfo getEditInfo(Integer xlid, Long ttid, Long maxfcno) throws ScheduleException; | ||
| 166 | + | ||
| 167 | +} | ||
| 168 | + |
src/main/resources/static/pages/base/timesmodel/add.html
| @@ -4,9 +4,9 @@ | @@ -4,9 +4,9 @@ | ||
| 4 | } | 4 | } |
| 5 | .tagsDiv { | 5 | .tagsDiv { |
| 6 | border: 1px solid #c2cad8; | 6 | border: 1px solid #c2cad8; |
| 7 | - margin-left: 50px; | 7 | + margin-left: 15px; |
| 8 | padding: 4px 15px 4px 15px; | 8 | padding: 4px 15px 4px 15px; |
| 9 | - width: 69%; | 9 | + width: 50%; |
| 10 | } | 10 | } |
| 11 | </style> | 11 | </style> |
| 12 | <!-- 片段标题 START --> | 12 | <!-- 片段标题 START --> |
| @@ -58,7 +58,7 @@ | @@ -58,7 +58,7 @@ | ||
| 58 | <a href="#tab2" data-toggle="tab" class="step"> | 58 | <a href="#tab2" data-toggle="tab" class="step"> |
| 59 | <span class="number"> 2 </span> | 59 | <span class="number"> 2 </span> |
| 60 | <span class="desc"> | 60 | <span class="desc"> |
| 61 | - <i class="fa fa-check"></i> 获取参数方式 </span> | 61 | + <i class="fa fa-check"></i> 选择参数方案 </span> |
| 62 | </a> | 62 | </a> |
| 63 | </li> | 63 | </li> |
| 64 | <li> | 64 | <li> |
| @@ -121,28 +121,28 @@ | @@ -121,28 +121,28 @@ | ||
| 121 | </div> | 121 | </div> |
| 122 | <!-- 获取参数 --> | 122 | <!-- 获取参数 --> |
| 123 | <div class="tab-pane" id="tab2"> | 123 | <div class="tab-pane" id="tab2"> |
| 124 | - <h3 class="block"> 获取参数方式 </h3> | 124 | + <h3 class="block"> 参数方案 </h3> |
| 125 | <!-- 获取参数 --> | 125 | <!-- 获取参数 --> |
| 126 | <div class="form-group"> | 126 | <div class="form-group"> |
| 127 | - <label class="col-md-3 control-label"> <span class="required"> * </span> 获取参数方式:</label> | 127 | + <label class="col-md-3 control-label"> <span class="required"> * </span> 选择参数方案:</label> |
| 128 | <div class="col-md-9"> | 128 | <div class="col-md-9"> |
| 129 | <div class="icheck-list"> | 129 | <div class="icheck-list"> |
| 130 | <label > | 130 | <label > |
| 131 | - <input type="radio" class="icheck" name="baseRes" value=1 > 手动输入 | 131 | + <input type="radio" class="icheck" name="baseRes" value=1 checked> 班型/人次/车辆 |
| 132 | </label> | 132 | </label> |
| 133 | <label> | 133 | <label> |
| 134 | - <input type="radio" class="icheck" name="baseRes" value=0 checked> 客流大数据分析 | 134 | + <input type="radio" class="icheck" name="baseRes" value=0> 客流大数据分析 |
| 135 | </label> | 135 | </label> |
| 136 | </div> | 136 | </div> |
| 137 | </div> | 137 | </div> |
| 138 | </div> | 138 | </div> |
| 139 | <!-- 客容总量 --> | 139 | <!-- 客容总量 --> |
| 140 | - <div class="form-group" id="krlGroup"> | 140 | + <!-- <div class="form-group" id="krlGroup"> |
| 141 | <label class="col-md-3 control-label"><span class="required"> * </span>客容总量 :</label> | 141 | <label class="col-md-3 control-label"><span class="required"> * </span>客容总量 :</label> |
| 142 | <div class="col-md-9"> | 142 | <div class="col-md-9"> |
| 143 | <input type="text" class="form-control input-medium" name="krl" id="krlInput" placeholder="客容总量"> | 143 | <input type="text" class="form-control input-medium" name="krl" id="krlInput" placeholder="客容总量"> |
| 144 | </div> | 144 | </div> |
| 145 | - </div> | 145 | + </div> --> |
| 146 | </div> | 146 | </div> |
| 147 | <!-- 参数详情 --> | 147 | <!-- 参数详情 --> |
| 148 | <div class="tab-pane" id="tab3"> | 148 | <div class="tab-pane" id="tab3"> |
src/main/resources/static/pages/base/timesmodel/js/add-form-wizard.js
| @@ -328,10 +328,10 @@ var SKBFormWizard = function() { | @@ -328,10 +328,10 @@ var SKBFormWizard = function() { | ||
| 328 | map.lb = 15;// 定义例保时间. | 328 | map.lb = 15;// 定义例保时间. |
| 329 | map.workeLunch = 20;// 定义午餐时间. | 329 | map.workeLunch = 20;// 定义午餐时间. |
| 330 | map.workeDinner = 20;// 定义晚餐时间. | 330 | map.workeDinner = 20;// 定义晚餐时间. |
| 331 | - map.mixstopTime = 8;// 定义最小停站间隙 | ||
| 332 | - map.maxstopTime = 20;// 定义最大停站间隙. | ||
| 333 | - map.upStopTime = 10;// 定义上行停站时间. | ||
| 334 | - map.downStopTime = 10;// 定义下行停站时间. | 331 | + //map.mixstopTime = 8;// 定义最小停站间隙 |
| 332 | + //map.maxstopTime = 20;// 定义最大停站间隙. | ||
| 333 | + //map.upStopTime = 10;// 定义上行停站时间. | ||
| 334 | + //map.downStopTime = 10;// 定义下行停站时间. | ||
| 335 | if(n==0) { | 335 | if(n==0) { |
| 336 | // 定义一个周转时间. | 336 | // 定义一个周转时间. |
| 337 | var zzsj = parseInt(map.upTravelTime) + 10*2 + parseInt(map.downTravelTime); | 337 | var zzsj = parseInt(map.upTravelTime) + 10*2 + parseInt(map.downTravelTime); |
| @@ -456,7 +456,7 @@ var SKBFormWizard = function() { | @@ -456,7 +456,7 @@ var SKBFormWizard = function() { | ||
| 456 | rules : { | 456 | rules : { |
| 457 | 'skbName' : {required : true,},// 时刻表名称,必填项. | 457 | 'skbName' : {required : true,},// 时刻表名称,必填项. |
| 458 | 'lineName' : {required : true,},// 线路名称,必填项. | 458 | 'lineName' : {required : true,},// 线路名称,必填项. |
| 459 | - 'krl' : {isBaseRes : true,number : true,digits : true,},// 客容量,当选择为客流方式时必填项、整数 | 459 | + // 'krl' : {isBaseRes : true,number : true,digits : true,},// 客容量,当选择为客流方式时必填项、整数 |
| 460 | 'startStationFirstTime' : {required : true}, // 起始站首班时间,必填项. | 460 | 'startStationFirstTime' : {required : true}, // 起始站首班时间,必填项. |
| 461 | 'startStationEndTime' : {required : true}, // 起始站末班时间 ,必填项. | 461 | 'startStationEndTime' : {required : true}, // 起始站末班时间 ,必填项. |
| 462 | 'endStationFirstTime' : {required : true}, // 终点站首班时间 ,必填项. | 462 | 'endStationFirstTime' : {required : true}, // 终点站首班时间 ,必填项. |
| @@ -502,6 +502,7 @@ var SKBFormWizard = function() { | @@ -502,6 +502,7 @@ var SKBFormWizard = function() { | ||
| 502 | 'clzs':{required : true,number : true,digits : true, isBcType : true},// 车辆总数,必填项、必须为整数. | 502 | 'clzs':{required : true,number : true,digits : true, isBcType : true},// 车辆总数,必填项、必须为整数. |
| 503 | 'bxrc' : {required : true},// 班型人次,必填项 | 503 | 'bxrc' : {required : true},// 班型人次,必填项 |
| 504 | 'linePlayType' : {required : true},// 线路规划类型,必填项 | 504 | 'linePlayType' : {required : true},// 线路规划类型,必填项 |
| 505 | + 'zdzcrl' : {number : true,digits : true}, | ||
| 505 | }, | 506 | }, |
| 506 | 507 | ||
| 507 | /** | 508 | /** |
| @@ -557,7 +558,7 @@ var SKBFormWizard = function() { | @@ -557,7 +558,7 @@ var SKBFormWizard = function() { | ||
| 557 | var argus = form.serializeJSON(); | 558 | var argus = form.serializeJSON(); |
| 558 | console.log(argus); | 559 | console.log(argus); |
| 559 | // 获取站点路由. | 560 | // 获取站点路由. |
| 560 | - $get('/stationroute/all',{'line.id_eq':argus.lineName.split('_')[0]},function(result) { | 561 | + $get('/stationroute/all',{'line.id_eq':argus.lineName.split('_')[0],'destroy_eq':0},function(result) { |
| 561 | // 判断. | 562 | // 判断. |
| 562 | if(result) { | 563 | if(result) { |
| 563 | // 定义上行起点站,上行终点站,下行起点站,下行终点站. | 564 | // 定义上行起点站,上行终点站,下行起点站,下行终点站. |
| @@ -652,7 +653,7 @@ var SKBFormWizard = function() { | @@ -652,7 +653,7 @@ var SKBFormWizard = function() { | ||
| 652 | },function(){return '高峰时段配车数必须高于其它时段配车数!';}); | 653 | },function(){return '高峰时段配车数必须高于其它时段配车数!';}); |
| 653 | 654 | ||
| 654 | // 验证客流数据分析时客容量为必填项. | 655 | // 验证客流数据分析时客容量为必填项. |
| 655 | - $.validator.addMethod("isBaseRes", function(value,element) { | 656 | + /*$.validator.addMethod("isBaseRes", function(value,element) { |
| 656 | // 定义返回值. | 657 | // 定义返回值. |
| 657 | var tag = true; | 658 | var tag = true; |
| 658 | // 定义选择获取参数方式值 | 659 | // 定义选择获取参数方式值 |
| @@ -662,7 +663,7 @@ var SKBFormWizard = function() { | @@ -662,7 +663,7 @@ var SKBFormWizard = function() { | ||
| 662 | tag = false; | 663 | tag = false; |
| 663 | return tag; | 664 | return tag; |
| 664 | }, '客流大数据分析,客流总量为必填项!'); | 665 | }, '客流大数据分析,客流总量为必填项!'); |
| 665 | - | 666 | + */ |
| 666 | // 验证配车总数与班型人次搭配 | 667 | // 验证配车总数与班型人次搭配 |
| 667 | $.validator.addMethod('isBcType', function(value,element) { | 668 | $.validator.addMethod('isBcType', function(value,element) { |
| 668 | // 定义返回值. | 669 | // 定义返回值. |
| @@ -673,6 +674,14 @@ var SKBFormWizard = function() { | @@ -673,6 +674,14 @@ var SKBFormWizard = function() { | ||
| 673 | // 判断. | 674 | // 判断. |
| 674 | if(bxrc=='' || bxrc==null || clzs=='' || clzs==0) | 675 | if(bxrc=='' || bxrc==null || clzs=='' || clzs==0) |
| 675 | return false; | 676 | return false; |
| 677 | + var bxrcAr = bxrc.split(','),pczs = 0; | ||
| 678 | + for(var s = 0 ; s< bxrcAr.length;s++) { | ||
| 679 | + // 切割单个班型人次. | ||
| 680 | + pczs = pczs + parseInt(bxrcAr[s].split('/')[2]); | ||
| 681 | + } | ||
| 682 | + if(pczs!=clzs) | ||
| 683 | + tag = false; | ||
| 684 | + /** | ||
| 676 | // 定义首末班次开始结束时间集合. | 685 | // 定义首末班次开始结束时间集合. |
| 677 | var map = {'line':{'startStationFirstTime':$('#qdzsbsjInput').val(), | 686 | var map = {'line':{'startStationFirstTime':$('#qdzsbsjInput').val(), |
| 678 | 'startStationEndTime':$('#qdzmbsjInput').val(), | 687 | 'startStationEndTime':$('#qdzmbsjInput').val(), |
| @@ -706,19 +715,20 @@ var SKBFormWizard = function() { | @@ -706,19 +715,20 @@ var SKBFormWizard = function() { | ||
| 706 | // 判断 | 715 | // 判断 |
| 707 | if(parseFloat(countGs.toFixed(2))>maxGs || (bxrcAr.length==1 && countRc > parseInt(clzs)) ) | 716 | if(parseFloat(countGs.toFixed(2))>maxGs || (bxrcAr.length==1 && countRc > parseInt(clzs)) ) |
| 708 | tag = false; | 717 | tag = false; |
| 718 | + */ | ||
| 709 | return tag; | 719 | return tag; |
| 710 | - },function(){return '配车总数与班型人次搭配不合理!'; }); | 720 | + },function(){return '配车总数与【班型/人次/车辆】搭配不合理!'; }); |
| 711 | 721 | ||
| 712 | /** | 722 | /** |
| 713 | * @description : (TODO) 监听获取参数方式值改变事件. | 723 | * @description : (TODO) 监听获取参数方式值改变事件. |
| 714 | * | 724 | * |
| 715 | * */ | 725 | * */ |
| 716 | - $('input:radio[name="baseRes"]').on('change',function(v) { | 726 | + /*$('input:radio[name="baseRes"]').on('change',function(v) { |
| 717 | if($(this).val()=='1') | 727 | if($(this).val()=='1') |
| 718 | $('#krlGroup').hide(); | 728 | $('#krlGroup').hide(); |
| 719 | else if($(this).val()=='0') | 729 | else if($(this).val()=='0') |
| 720 | $('#krlGroup').show(); | 730 | $('#krlGroup').show(); |
| 721 | - }); | 731 | + });*/ |
| 722 | 732 | ||
| 723 | // 确认提交信息 | 733 | // 确认提交信息 |
| 724 | var displayConfirm = function() { | 734 | var displayConfirm = function() { |
| @@ -794,14 +804,17 @@ var SKBFormWizard = function() { | @@ -794,14 +804,17 @@ var SKBFormWizard = function() { | ||
| 794 | if (form.valid() == false) { | 804 | if (form.valid() == false) { |
| 795 | return false; | 805 | return false; |
| 796 | } | 806 | } |
| 797 | - if(index==1) { | 807 | + /*if(index==1) { |
| 798 | // 初始化客容量值. | 808 | // 初始化客容量值. |
| 799 | if($('#krlInput').val() == '') | 809 | if($('#krlInput').val() == '') |
| 800 | $('#krlInput').val(50); | 810 | $('#krlInput').val(50); |
| 801 | - }else if(index == 2) { | 811 | + }else */if(index == 2) { |
| 802 | var baseRes = $('#submit_argus_form input[name="baseRes"]:checked').val(),// 获取参数方式值. | 812 | var baseRes = $('#submit_argus_form input[name="baseRes"]:checked').val(),// 获取参数方式值. |
| 803 | lineId = $('#lineSelect').val().split('_')[0],// 线路ID. | 813 | lineId = $('#lineSelect').val().split('_')[0],// 线路ID. |
| 804 | - krl = $('#krlInput').val();// 客容量 | 814 | + krl = 50; |
| 815 | + // krl = $('#krlInput').val();// 客容量 | ||
| 816 | + // 弹出正在加载层 | ||
| 817 | + var i = layer.load(2); | ||
| 805 | getLineInfo(lineId,function(r) { | 818 | getLineInfo(lineId,function(r) { |
| 806 | getHtmlTemp(baseRes,r.content[0],lineId,krl,function(htlMap) { | 819 | getHtmlTemp(baseRes,r.content[0],lineId,krl,function(htlMap) { |
| 807 | $('#tab3').html(htlMap.forminput); | 820 | $('#tab3').html(htlMap.forminput); |
| @@ -831,6 +844,8 @@ var SKBFormWizard = function() { | @@ -831,6 +844,8 @@ var SKBFormWizard = function() { | ||
| 831 | options += '</optgroup>'; | 844 | options += '</optgroup>'; |
| 832 | $('#carParkSelect').html(options).select2(); | 845 | $('#carParkSelect').html(options).select2(); |
| 833 | $('#carParkSelect').select2("val",r.content[0].carPark); | 846 | $('#carParkSelect').select2("val",r.content[0].carPark); |
| 847 | + // 关闭弹出加载层 | ||
| 848 | + layer.close(i); | ||
| 834 | }); | 849 | }); |
| 835 | }); | 850 | }); |
| 836 | }); | 851 | }); |
src/main/resources/static/pages/base/timesmodel/js/base-fun.js
| @@ -324,6 +324,220 @@ var BaseFun = function() { | @@ -324,6 +324,220 @@ var BaseFun = function() { | ||
| 324 | 'bxrcgs':null}; | 324 | 'bxrcgs':null}; |
| 325 | }, | 325 | }, |
| 326 | 326 | ||
| 327 | + BXPplaceClassesTime01 : function(saa,cara,map,seMap,dataMap,lpNoA) { | ||
| 328 | + var allJsonD = baseF.plgfbc(saa,cara,map,seMap,dataMap); | ||
| 329 | + var jsonArray = baseF.tzsmbcsj01(baseF.setbcsAndfcno(allJsonD),dataMap.smbcsjArr,dataMap.ccsjArr,dataMap.cclcArr,dataMap.qdzArr,saa[0].lbsj),lpNoA,dataMap; | ||
| 330 | + var list = baseF.splitBxRc(map.bxrc); | ||
| 331 | + baseF.fprclp01(list,cara); | ||
| 332 | + console.log(list); | ||
| 333 | + var bxrclist = list.data; | ||
| 334 | + var rs = new Array(),bxrcgs= new Array(); | ||
| 335 | + // 遍历已分配好路牌的班型人次数组. | ||
| 336 | + for(var x = 0 ; x < bxrclist.length; x++) { | ||
| 337 | + // 定义当前班型人次下的路牌数组. | ||
| 338 | + var cla = bxrclist[x].sslp; | ||
| 339 | + var dsdnmb = bxrclist[x].rs/bxrclist[x].fpcls; | ||
| 340 | + // 定义当前班型人次下的工时. | ||
| 341 | + var hoursV = bxrclist[x].hoursV*dsdnmb; | ||
| 342 | + // 遍历路牌 | ||
| 343 | + for(var s = 0 ; s < cla.length; s++) { | ||
| 344 | + //cla[s].lpName = bxrclist[x].type; | ||
| 345 | + // 获取路牌编号. | ||
| 346 | + var lpNo = cla[s].lpNo; | ||
| 347 | + // 定义路牌下的所有班次. | ||
| 348 | + var lpbc = new Array(); | ||
| 349 | + bxrcgs.push({'lpNo':lpNo,'hoursV':hoursV,'type':bxrclist[x].type}); | ||
| 350 | + // 遍历班次数. | ||
| 351 | + for(var i =0 ; i <jsonArray.length; i++) { | ||
| 352 | + // 判断当期遍历的班次是否属于当前的路牌. | ||
| 353 | + if(jsonArray[i].lpNo == lpNo) | ||
| 354 | + lpbc.push(jsonArray[i]); | ||
| 355 | + } | ||
| 356 | + // 按照发车序号顺序排序. | ||
| 357 | + lpbc.sort(function(a,b){return b.fcno-a.fcno}); | ||
| 358 | + // 调整班次数.也就是说调整工时. | ||
| 359 | + baseF.tzlpgs01(lpbc,hoursV,map,dataMap,lpNo,saa); | ||
| 360 | + rs = rs.concat(lpbc); | ||
| 361 | + } | ||
| 362 | + } | ||
| 363 | + var jar = baseF.tzsmbcsj01(baseF.setbcsAndfcno(rs),dataMap.smbcsjArr,dataMap.ccsjArr,dataMap.cclcArr,dataMap.qdzArr,saa[0].lbsj),lpNoA,dataMap; | ||
| 364 | + //var jar = baseF.tzsmbcsj(baseF.setbcsAndfcno(rs),dataMap.smbcsjArr,dataMap.ccsjArr,dataMap.cclcArr,dataMap.qdzArr,saa[0].lbsj),lpNoA,dataMap; | ||
| 365 | + var resultJA = new Array(); | ||
| 366 | + for(var m = 0 ; m < cara.length; m++) { | ||
| 367 | + // 获取路牌编号. | ||
| 368 | + var lpNo_ = cara[m].lpNo; | ||
| 369 | + // 定义路牌下的所有班次. | ||
| 370 | + var lpbc_ = new Array(); | ||
| 371 | + // 遍历班次数. | ||
| 372 | + for(var j =0 ; j <jar.length; j++) { | ||
| 373 | + // 判断当期遍历的班次是否属于当前的路牌. | ||
| 374 | + if(jar[j].lpNo == lpNo_) | ||
| 375 | + lpbc_.push(jar[j]); | ||
| 376 | + } | ||
| 377 | + // 按照发车序号顺序排序. | ||
| 378 | + lpbc_.sort(function(a,b){return a.fcno-b.fcno}); | ||
| 379 | + resultJA = resultJA.concat(baseF.addjclbbc01(lpbc_,dataMap,saa[0].lbsj,map)); | ||
| 380 | + // resultJA = resultJA.concat(lpbc_); | ||
| 381 | + } | ||
| 382 | + return {'json':resultJA,'bxrcgs':null}; | ||
| 383 | + }, | ||
| 384 | + | ||
| 385 | + /** | ||
| 386 | + * @description : (TODO) 添加进出场班次、早晚例保班次. | ||
| 387 | + * | ||
| 388 | + * @param [bc--路牌下的所有班次;dataMap--参数信息;lbsj--例保时间] | ||
| 389 | + * | ||
| 390 | + */ | ||
| 391 | + addjclbbc01 : function(bc,dataMap,lbsj,gatps) { | ||
| 392 | + if(bc.length>0) | ||
| 393 | + bc[bc.length-1].STOPTIME = 0; | ||
| 394 | + var result = new Array(); | ||
| 395 | + var fcno = 0,dxfno = 0,stas = false; | ||
| 396 | + for(var b = 0 ; b < bc.length;b++) { | ||
| 397 | + var fxdm = baseF.dirDmToIndex(bc[b].xlDir); | ||
| 398 | + var car = {'lp':bc[b].lp, 'lpNo':bc[b].lpNo, 'lpName':bc[b].lpName, 'lpType':bc[b].lpType}; | ||
| 399 | + if(b==0) { | ||
| 400 | + var dqbcfcsj = baseF.getDateTime(bc[b].fcsj); | ||
| 401 | + result.push(baseF.getbcObj( | ||
| 402 | + dqbcfcsj,dataMap.ccsjArr[fxdm],car,dataMap.bcTypeArr.bd, | ||
| 403 | + dataMap.dira[fxdm],1,0,gatps,0,null,null,null,0,lbsj));// 早行例保班次 | ||
| 404 | + result.push(baseF.getbcObj( | ||
| 405 | + dqbcfcsj,dataMap.ccsjArr[fxdm],car,dataMap.bcTypeArr.out, | ||
| 406 | + dataMap.dira[fxdm],2,dataMap.cclcArr[fxdm],gatps,0,dataMap.qdzArr[fxdm],null,null,0,0));// 出场班次 | ||
| 407 | + fcno ++; | ||
| 408 | + }else if(b==bc.length-1){ | ||
| 409 | + var fcno_ = dxfno + 2; | ||
| 410 | + var qdbcddsj = baseF.getDateTime(bc[b].ARRIVALTIME); | ||
| 411 | + result.push(baseF.getbcObj( | ||
| 412 | + qdbcddsj,dataMap.jcsjArr[fxdm],car,dataMap.bcTypeArr.in_, | ||
| 413 | + dataMap.dira[fxdm],fcno_++,dataMap.jclcArr[fxdm],gatps,0,dataMap.qdzArr[fxdm],null,null,0,0));// 进场班次 | ||
| 414 | + result.push(baseF.getbcObj( | ||
| 415 | + qdbcddsj,dataMap.jcsjArr[fxdm],car,dataMap.bcTypeArr.lc, | ||
| 416 | + dataMap.dira[fxdm],fcno_++,0,gatps,0,null,null,null,0,lbsj));// 晚班例保班次 | ||
| 417 | + } | ||
| 418 | + dxfno = bc[b].fcno + fcno; | ||
| 419 | + bc[b].fcno = dxfno; | ||
| 420 | + if(stas) { | ||
| 421 | + fcno ++; | ||
| 422 | + stas = false; | ||
| 423 | + } | ||
| 424 | + result.push(bc[b]); | ||
| 425 | + } | ||
| 426 | + return result; | ||
| 427 | + }, | ||
| 428 | + | ||
| 429 | + /** | ||
| 430 | + * @description : (TODO) 调整某路牌下的工时. | ||
| 431 | + * | ||
| 432 | + * @param [arr--当前路牌下的班次数组;gs--当前路牌的总工时;dataMap--参数信息;lpNo--路牌编码;saa--参数信息] | ||
| 433 | + * | ||
| 434 | + * */ | ||
| 435 | + tzlpgs01 : function(arr,gs,map,dataMap,lpNo,saa) { | ||
| 436 | + // 定义当前路牌的进场时间、早晚例保时间. | ||
| 437 | + var jczwsj = saa[0].lbsj*2 + dataMap.ccsjArr[baseF.dirDmToIndex(arr[0].xlDir)] + | ||
| 438 | + dataMap.jcsjArr[baseF.dirDmToIndex(arr[arr.length-1].xlDir)]; | ||
| 439 | + // 定义开始、结束时间. | ||
| 440 | + //var st = null , ed = null; | ||
| 441 | + // 根据路牌编码依次轮流取高峰之间和晚高峰之后的时间段. | ||
| 442 | + /*if(lpNo%2!=0) { | ||
| 443 | + st = dataMap.gfzjsjd[0].st; | ||
| 444 | + ed = dataMap.gfzjsjd[0].ed; | ||
| 445 | + }else { | ||
| 446 | + st = dataMap.wgfzhsjd[0].st; | ||
| 447 | + ed = dataMap.wgfzhsjd[0].ed; | ||
| 448 | + }*/ | ||
| 449 | + // 定义路牌总工时.第一次切高峰之间和晚高峰之后的班次. | ||
| 450 | + var lpdqzgs = parseFloat(((baseF.getlpzgs(arr) + jczwsj)/60).toFixed(2)); | ||
| 451 | + while(lpdqzgs>gs) { | ||
| 452 | + for(var t = 0 ; t<arr.length;t++) { | ||
| 453 | + // 得到当前路牌下的发车时间. | ||
| 454 | + var dqbcfcsj = baseF.getDateTime(arr[t].fcsj); | ||
| 455 | + // 判断时间范围. | ||
| 456 | + if(!baseF.isgfsjd01(dqbcfcsj,dataMap)) { | ||
| 457 | + arr.splice(t,1); | ||
| 458 | + break; | ||
| 459 | + } | ||
| 460 | + } | ||
| 461 | + lpdqzgs = parseFloat(((baseF.getlpzgs(arr) + jczwsj)/60).toFixed(2)); | ||
| 462 | + } | ||
| 463 | + // 判断总工时是否大于班型对应的工时. | ||
| 464 | + /*if(lpdqzgs>gs) { | ||
| 465 | + // 定义相差值. | ||
| 466 | + var dx = parseFloat((lpdqzgs - gs).toFixed(2)); | ||
| 467 | + // 定义圈数. | ||
| 468 | + var qs = Math.round(dx*60/70); | ||
| 469 | + for(var t = 0 ; t<arr.length;t++) { | ||
| 470 | + // 得到当前路牌下的发车时间. | ||
| 471 | + var dqbcfcsj = baseF.getDateTime(arr[t].fcsj); | ||
| 472 | + // 判断时间范围. | ||
| 473 | + if(dqbcfcsj>st && dqbcfcsj<ed) { | ||
| 474 | + arr[t-1].STOPTIME = 0; | ||
| 475 | + // 切割. | ||
| 476 | + arr.splice(t,qs*2); | ||
| 477 | + break; | ||
| 478 | + } | ||
| 479 | + } | ||
| 480 | + }*/ | ||
| 481 | + }, | ||
| 482 | + | ||
| 483 | + /** | ||
| 484 | + * @description (TODO) 把班型人次合理的分配到不同的路牌上. | ||
| 485 | + * | ||
| 486 | + * @param [bxgs--班型人次数组长度;list--班型人次数组集合;clzs--路牌数组] | ||
| 487 | + * | ||
| 488 | + * @return 返回一个把路牌合理的分配到班型人次下组成的数据集合. | ||
| 489 | + * */ | ||
| 490 | + fprclp01 : function(list,clzs) { | ||
| 491 | + var bxgs = list.data.length; | ||
| 492 | + // 定义总车数. | ||
| 493 | + var dxcount = clzs.length; | ||
| 494 | + /*for(var t = 1 ; t<bxgs ; t++) { | ||
| 495 | + dxcount = dxcount + list.data[t].rs; | ||
| 496 | + }*/ | ||
| 497 | + // 最多车次与总车次的比例. | ||
| 498 | + var blnum = Math.round(dxcount/list.data[0].fpcls); | ||
| 499 | + var rs = new Array(); | ||
| 500 | + // 遍历 | ||
| 501 | + for(var r = 0 ; r<bxgs ;r++) { | ||
| 502 | + // 得到没有分配出去的路牌. | ||
| 503 | + var dxa = baseF.chaji_array(clzs,rs); | ||
| 504 | + // 定义当前车次数. | ||
| 505 | + var rsnum = list.data[r].fpcls; | ||
| 506 | + // 定义记录当前分割路牌的次数下标.分配到班型车次下的路牌数组. | ||
| 507 | + var index = 0,sslp = new Array(); | ||
| 508 | + // 当前车次所有占比例. | ||
| 509 | + var tempint = parseInt(rsnum/blnum); | ||
| 510 | + // 判断如果比例小1 则为当前车次数. | ||
| 511 | + blnum = tempint <=1 ? rsnum : blnum; | ||
| 512 | + // 判断当前班型车次数组下标值.如果为倒数第二个或者之前 | ||
| 513 | + if(r<bxgs-1) { | ||
| 514 | + // 遍历 | ||
| 515 | + for(var c = 0 ; c<tempint;c++) { | ||
| 516 | + // 创建新的没有分配出去的路牌数组. | ||
| 517 | + var temp = dxa.concat(); | ||
| 518 | + // 创建切割路牌数组. | ||
| 519 | + var tagA = new Array(); | ||
| 520 | + // 判断切割的下标值是否小于等于路牌数组的倒数第二个或者之前. | ||
| 521 | + if(index<=dxa.length-blnum) { | ||
| 522 | + tagA = temp.splice(index,blnum); | ||
| 523 | + }else { | ||
| 524 | + tagA = temp.splice(dxa.length-blnum,blnum); | ||
| 525 | + } | ||
| 526 | + // 组合切割路牌数组.赋值给已分配出去的路牌. | ||
| 527 | + rs = rs.concat(tagA); | ||
| 528 | + // 赋值给分配到班型车次下的路牌数组. | ||
| 529 | + sslp = sslp.concat(tagA); | ||
| 530 | + // 记录切割下标. | ||
| 531 | + index = index + 1 + blnum; | ||
| 532 | + } | ||
| 533 | + // 分配到班型车次下的路牌数组. | ||
| 534 | + list.data[r].sslp = sslp; | ||
| 535 | + }else { | ||
| 536 | + list.data[r].sslp = dxa; | ||
| 537 | + } | ||
| 538 | + } | ||
| 539 | + }, | ||
| 540 | + | ||
| 327 | /** | 541 | /** |
| 328 | * @description : (TODO) 根据班型人次与车辆总数排列班次时刻数据. | 542 | * @description : (TODO) 根据班型人次与车辆总数排列班次时刻数据. |
| 329 | * | 543 | * |
| @@ -758,7 +972,7 @@ var BaseFun = function() { | @@ -758,7 +972,7 @@ var BaseFun = function() { | ||
| 758 | for(var c = 0 ; c<len ; c++) { | 972 | for(var c = 0 ; c<len ; c++) { |
| 759 | // 铺出所有的班次 | 973 | // 铺出所有的班次 |
| 760 | var _mmstartTime = baseF.getDateTime(map.earlyStartTime);// 获取早高峰开始时间点,并转为时间对象. | 974 | var _mmstartTime = baseF.getDateTime(map.earlyStartTime);// 获取早高峰开始时间点,并转为时间对象. |
| 761 | - var tempTime = new Date(_mmstartTime.setMinutes(_mmstartTime.getMinutes()-(len - cara[c].lpNo)*saa[0].fcjx)); | 975 | + var tempTime = new Date(_mmstartTime.setMinutes(_mmstartTime.getMinutes()-(len - cara[c].lpNo)*saa[0].fcjx.gffcjx)); |
| 762 | var kssj = dataMap.zgfsjd[0].st; | 976 | var kssj = dataMap.zgfsjd[0].st; |
| 763 | var cctag = map.linePlayType=='1' ? 0 : baseF.getdefaultDir(dataMap.smbcsjArr);// 获取出场类型 [0--上行出场;1--下行出场] | 977 | var cctag = map.linePlayType=='1' ? 0 : baseF.getdefaultDir(dataMap.smbcsjArr);// 获取出场类型 [0--上行出场;1--下行出场] |
| 764 | var sjAndDir = baseF.getBeganTime(tempTime,kssj,null, saa,dataMap.zgfsjd,dataMap.wgfsjd,dataMap.pcxssjArr,dataMap.gfxxsjArr,cctag, dataMap.ztjxA);// 计算当前路牌第一个首班时间点. | 978 | var sjAndDir = baseF.getBeganTime(tempTime,kssj,null, saa,dataMap.zgfsjd,dataMap.wgfsjd,dataMap.pcxssjArr,dataMap.gfxxsjArr,cctag, dataMap.ztjxA);// 计算当前路牌第一个首班时间点. |
| @@ -781,9 +995,10 @@ var BaseFun = function() { | @@ -781,9 +995,10 @@ var BaseFun = function() { | ||
| 781 | kssj,dataMap.zwcArr[1],cara[c],dataMap.bcTypeArr.cf, | 995 | kssj,dataMap.zwcArr[1],cara[c],dataMap.bcTypeArr.cf, |
| 782 | dataMap.dira[cctag],xhNo++,0,map,0,null,null,null,0,0));// 晚餐班次 | 996 | dataMap.dira[cctag],xhNo++,0,map,0,null,null,null,0,0));// 晚餐班次 |
| 783 | } | 997 | } |
| 784 | - var tzsj = dataMap.ztjxA[cctag]; | 998 | + var tzsj = baseF.isgfsjd01(kssj,dataMap) ? dataMap.gftzsj[cctag] : dataMap.dgtzsj[cctag]; |
| 999 | + // var tzsj = dataMap.ztjxA[cctag]; | ||
| 785 | var _xxsj = baseF.getxssj(dataMap.zgfsjd,dataMap.wgfsjd,kssj,dataMap.pcxssjArr,dataMap.gfxxsjArr,cctag);// 获取行驶时间 | 1000 | var _xxsj = baseF.getxssj(dataMap.zgfsjd,dataMap.wgfsjd,kssj,dataMap.pcxssjArr,dataMap.gfxxsjArr,cctag);// 获取行驶时间 |
| 786 | - var tzsj = baseF.isLastbc(kssj,endTime,tzsj,_xxsj) ? 0 : tzsj; | 1001 | + tzsj = baseF.isLastbc(kssj,endTime,tzsj,_xxsj) ? 0 : tzsj; |
| 787 | rs.push(baseF.getbcObj( | 1002 | rs.push(baseF.getbcObj( |
| 788 | kssj,_xxsj,cara[c],dataMap.bcTypeArr.normal, | 1003 | kssj,_xxsj,cara[c],dataMap.bcTypeArr.normal, |
| 789 | dataMap.dira[cctag],xhNo++,dataMap.pcxslcArr[cctag],map,0, | 1004 | dataMap.dira[cctag],xhNo++,dataMap.pcxslcArr[cctag],map,0, |
| @@ -794,6 +1009,15 @@ var BaseFun = function() { | @@ -794,6 +1009,15 @@ var BaseFun = function() { | ||
| 794 | return rs; | 1009 | return rs; |
| 795 | }, | 1010 | }, |
| 796 | 1011 | ||
| 1012 | + isgfsjd01 : function(kssj,dataMap) { | ||
| 1013 | + | ||
| 1014 | + var tag = false; | ||
| 1015 | + if((dataMap.zgfsjd[0].st <=kssj && kssj<= dataMap.zgfsjd[0].ed ) || ( dataMap.wgfsjd[0].st <= kssj && kssj <= dataMap.wgfsjd[0].ed)) | ||
| 1016 | + tag = true; | ||
| 1017 | + return tag; | ||
| 1018 | + }, | ||
| 1019 | + | ||
| 1020 | + | ||
| 797 | /** | 1021 | /** |
| 798 | * @description : (TODO) 该方法可去除. | 1022 | * @description : (TODO) 该方法可去除. |
| 799 | * | 1023 | * |
| @@ -836,6 +1060,7 @@ var BaseFun = function() { | @@ -836,6 +1060,7 @@ var BaseFun = function() { | ||
| 836 | for(var s = 0 ; s< bxrcAr.length;s++) { | 1060 | for(var s = 0 ; s< bxrcAr.length;s++) { |
| 837 | var s1a = bxrcAr[s].split('/'); | 1061 | var s1a = bxrcAr[s].split('/'); |
| 838 | var rs = parseInt(s1a[1]); | 1062 | var rs = parseInt(s1a[1]); |
| 1063 | + var fpcls = parseInt(s1a[2]); | ||
| 839 | var gsgdIndex = 0,hoursV = 0.0,minueV='' ; | 1064 | var gsgdIndex = 0,hoursV = 0.0,minueV='' ; |
| 840 | for(var g = 0 ; g < gsgd.length; g++) { | 1065 | for(var g = 0 ; g < gsgd.length; g++) { |
| 841 | if(gsgd[g].type == s1a[0]) { | 1066 | if(gsgd[g].type == s1a[0]) { |
| @@ -846,6 +1071,7 @@ var BaseFun = function() { | @@ -846,6 +1071,7 @@ var BaseFun = function() { | ||
| 846 | } | 1071 | } |
| 847 | list.push({'type':s1a[0], | 1072 | list.push({'type':s1a[0], |
| 848 | 'rs':rs, | 1073 | 'rs':rs, |
| 1074 | + 'fpcls':fpcls, | ||
| 849 | 'hoursV':hoursV, | 1075 | 'hoursV':hoursV, |
| 850 | 'minueV':minueV}); | 1076 | 'minueV':minueV}); |
| 851 | rsa.push(rs); | 1077 | rsa.push(rs); |
| @@ -945,12 +1171,49 @@ var BaseFun = function() { | @@ -945,12 +1171,49 @@ var BaseFun = function() { | ||
| 945 | baseF.tzqtbc(_obj.xxbc,_obj.qt,sj,cl,zd,lbsj); | 1171 | baseF.tzqtbc(_obj.xxbc,_obj.qt,sj,cl,zd,lbsj); |
| 946 | return _obj.sxbc.concat(_obj.xxbc).concat(_obj.qt); | 1172 | return _obj.sxbc.concat(_obj.xxbc).concat(_obj.qt); |
| 947 | }, | 1173 | }, |
| 948 | - tcbc : function(ar,kssj,jssj) { | 1174 | + /** |
| 1175 | + * @discription : (TODO) 调整首末班车时间点 | ||
| 1176 | + * | ||
| 1177 | + * @params : [list--时刻表明细数组;smbcsj--首末班车时间] | ||
| 1178 | + * | ||
| 1179 | + * @return : 返回一个数组对象。这里返回的是时刻表明细数据 | ||
| 1180 | + **/ | ||
| 1181 | + tzsmbcsj01 : function(list,smbcsj,sj,cl,zd,lbsj) { | ||
| 1182 | + var _obj = baseF.getsxAndxxbc(list); | ||
| 1183 | + baseF.tcbc(_obj.sxbc,smbcsj[0].kssj,smbcsj[0].jssj ,_obj.xxbc);// 剔除上行不在时间范围内的班次 | ||
| 1184 | + baseF.tcbc(_obj.xxbc,smbcsj[1].kssj,smbcsj[1].jssj,_obj.sxbc);// 剔除下行不在时间范围内的班次 | ||
| 1185 | + baseF.dzsmsj(_obj.sxbc,smbcsj[0].kssj,smbcsj[0].jssj,_obj.xxbc);// 调整上行首末班车时间 | ||
| 1186 | + baseF.dzsmsj(_obj.xxbc,smbcsj[1].kssj,smbcsj[1].jssj,_obj.sxbc);// 调整下行首末班车时间 | ||
| 1187 | + return _obj.sxbc.concat(_obj.xxbc).concat(_obj.qt); | ||
| 1188 | + }, | ||
| 1189 | + tcbc : function(ar,kssj,jssj,ppar) { | ||
| 949 | for(var s = 0 ; s<ar.length;s++) { | 1190 | for(var s = 0 ; s<ar.length;s++) { |
| 950 | if(baseF.isDelete(baseF.getDateTime(kssj), | 1191 | if(baseF.isDelete(baseF.getDateTime(kssj), |
| 951 | baseF.getDateTime(jssj), | 1192 | baseF.getDateTime(jssj), |
| 952 | baseF.getDateTime(ar[s].fcsj))) { | 1193 | baseF.getDateTime(ar[s].fcsj))) { |
| 1194 | + var tempa = ar.concat(ppar),sslpA = new Array(); | ||
| 1195 | + for(var r = 0 ; r<tempa.length;r++) { | ||
| 1196 | + if(tempa[r].lpNo == ar[s].lpNo) | ||
| 1197 | + sslpA.push(tempa[r]); | ||
| 1198 | + } | ||
| 1199 | + sslpA.sort(function(a,b){return a.fcno-b.fcno}); | ||
| 1200 | + var lastBc = null; | ||
| 1201 | + for(var p = 0 ; p<sslpA.length;p++) { | ||
| 1202 | + if(sslpA[p].fcno == ar[s].fcno && sslpA[p].xlDir ==ar[s].xlDir && sslpA[p].fcsj == ar[s].fcsj ) { | ||
| 1203 | + lastBc = sslpA[p-1]; | ||
| 1204 | + break; | ||
| 1205 | + } | ||
| 1206 | + } | ||
| 1207 | + if(lastBc !=null) { | ||
| 1208 | + for(var t = 0 ;t < ppar.length;t++) { | ||
| 1209 | + if(ppar[t].fcno == lastBc.fcno && ppar[t].xlDir == lastBc.xlDir && ppar[t].fcsj == lastBc.fcsj ) { | ||
| 1210 | + ppar.splice(t, 1); | ||
| 1211 | + break; | ||
| 1212 | + } | ||
| 1213 | + } | ||
| 1214 | + } | ||
| 953 | ar.splice(s, 1); | 1215 | ar.splice(s, 1); |
| 1216 | + s--; | ||
| 954 | } | 1217 | } |
| 955 | } | 1218 | } |
| 956 | }, | 1219 | }, |
src/main/resources/static/pages/base/timesmodel/js/gantt.js
| @@ -32,13 +32,15 @@ | @@ -32,13 +32,15 @@ | ||
| 32 | }); | 32 | }); |
| 33 | $('.tipso-animation').tipso('show'); | 33 | $('.tipso-animation').tipso('show'); |
| 34 | setTimeout(function(){$('.tipso-animation').tipso('hide');},4000); | 34 | setTimeout(function(){$('.tipso-animation').tipso('hide');},4000); |
| 35 | + console.log(map); | ||
| 36 | + //debugger; | ||
| 35 | // 1、定义开始与结束时间点字符串. | 37 | // 1、定义开始与结束时间点字符串. |
| 36 | var seMap = getStartAndEndDate(map); | 38 | var seMap = getStartAndEndDate(map); |
| 37 | // 2、获取开始与结束时间对象. | 39 | // 2、获取开始与结束时间对象. |
| 38 | /*var seDate = getksjssj(null,seMap.s.split('-')[0]);*/ | 40 | /*var seDate = getksjssj(null,seMap.s.split('-')[0]);*/ |
| 39 | var seDate = getksjssj(null,seMap.s); | 41 | var seDate = getksjssj(null,seMap.s); |
| 40 | // 3、定义周转时间. | 42 | // 3、定义周转时间. |
| 41 | - map.zzsj = parseInt(getzzsj(map)); | 43 | + map.zzsj = getzzsj(map); |
| 42 | // 5、方向代码. | 44 | // 5、方向代码. |
| 43 | var dirA = getsxxDM(); | 45 | var dirA = getsxxDM(); |
| 44 | // 6、班次类型. | 46 | // 6、班次类型. |
| @@ -53,7 +55,7 @@ | @@ -53,7 +55,7 @@ | ||
| 53 | CSMap = getMaxCarAndStopSpace1(map); | 55 | CSMap = getMaxCarAndStopSpace1(map); |
| 54 | } | 56 | } |
| 55 | // 发车间隙 | 57 | // 发车间隙 |
| 56 | - map.stopSpace = CSMap.stopSpace; | 58 | + map.fcjx = CSMap.fcjx; |
| 57 | // 定义时间参数. | 59 | // 定义时间参数. |
| 58 | var stopAraay = getsj(map); | 60 | var stopAraay = getsj(map); |
| 59 | if(isNull(objD)) { | 61 | if(isNull(objD)) { |
| @@ -62,7 +64,8 @@ | @@ -62,7 +64,8 @@ | ||
| 62 | data = BaseFun.KLplaceClassesTime(CSMap.gattA,stopAraay,CSMap.maxCar,map,seMap,dataMap); | 64 | data = BaseFun.KLplaceClassesTime(CSMap.gattA,stopAraay,CSMap.maxCar,map,seMap,dataMap); |
| 63 | }else if(map.baseRes== '1') { | 65 | }else if(map.baseRes== '1') { |
| 64 | // 采用班型人次数据获取渲染时刻表明细图形的配置参数数据. | 66 | // 采用班型人次数据获取渲染时刻表明细图形的配置参数数据. |
| 65 | - data = BaseFun.BXPplaceClassesTime(stopAraay,CSMap.maxCar,map,seMap,dataMap,getylp(CSMap.maxCar).lpNoA); | 67 | + // data = BaseFun.BXPplaceClassesTime(stopAraay,CSMap.maxCar,map,seMap,dataMap,getylp(CSMap.maxCar).lpNoA); |
| 68 | + data = BaseFun.BXPplaceClassesTime01(stopAraay,CSMap.maxCar,map,seMap,dataMap,getylp(CSMap.maxCar).lpNoA); | ||
| 66 | } | 69 | } |
| 67 | 70 | ||
| 68 | }else { | 71 | }else { |
| @@ -107,7 +110,7 @@ | @@ -107,7 +110,7 @@ | ||
| 107 | * @returns 返回一个分装发车间隙、车辆数的最大值集合. | 110 | * @returns 返回一个分装发车间隙、车辆数的最大值集合. |
| 108 | * */ | 111 | * */ |
| 109 | function getMaxCarAndStopSpace1(map) { | 112 | function getMaxCarAndStopSpace1(map) { |
| 110 | - return {'gattA':null,'stopSpace': Math.round(map.zzsj/map.clzs),'maxCar':BaseFun.getYAxisCarArray(parseInt(map.clzs))}; | 113 | + return {'gattA':null,'fcjx': {'gffcjx': Math.round(map.zzsj.gfzzsj/map.clzs) , 'dgfcjx': Math.round(map.zzsj.dgzzsj/map.clzs)},'maxCar':BaseFun.getYAxisCarArray(parseInt(map.clzs))}; |
| 111 | } | 114 | } |
| 112 | 115 | ||
| 113 | /** | 116 | /** |
| @@ -143,9 +146,11 @@ | @@ -143,9 +146,11 @@ | ||
| 143 | 'dira' : dira,// 方向集合 [下标0代表上;下标1代表下] | 146 | 'dira' : dira,// 方向集合 [下标0代表上;下标1代表下] |
| 144 | 'bcTypeArr' : bcTypeArr,// 班次类型 | 147 | 'bcTypeArr' : bcTypeArr,// 班次类型 |
| 145 | 'lbsj' : gatps.lb=='' ? 0:parseInt(gatps.lb),// 例保时间. | 148 | 'lbsj' : gatps.lb=='' ? 0:parseInt(gatps.lb),// 例保时间. |
| 146 | - 'minztjx' : parseInt(gatps.mixstopTime), // 最小停站时间. | ||
| 147 | - 'ztjxA' : BaseFun.formatPairing(gatps.upStopTime,gatps.downStopTime), // 停站时间. | ||
| 148 | - 'maxztjx' : parseInt(gatps.maxstopTime), // 最大停站时间. | 149 | + // 'minztjx' : parseInt(gatps.mixstopTime), // 最小停站时间. |
| 150 | + // 'ztjxA' : BaseFun.formatPairing(gatps.upStopTime,gatps.downStopTime), // 停站时间. | ||
| 151 | + // 'maxztjx' : parseInt(gatps.maxstopTime), // 最大停站时间. | ||
| 152 | + 'gftzsj': BaseFun.formatPairing(gatps.gfupStopTime,gatps.gfdownStopTime),// 高峰停站时间. | ||
| 153 | + 'dgtzsj' : BaseFun.formatPairing(gatps.dgupStopTime,gatps.dgdownStopTime),// 低谷停站时间. | ||
| 149 | 'map' : gatps, | 154 | 'map' : gatps, |
| 150 | 'zzsj':gatps.zzsj,// 周转时间. | 155 | 'zzsj':gatps.zzsj,// 周转时间. |
| 151 | }; | 156 | }; |
| @@ -160,7 +165,14 @@ | @@ -160,7 +165,14 @@ | ||
| 160 | * */ | 165 | * */ |
| 161 | function getzzsj(map) { | 166 | function getzzsj(map) { |
| 162 | // 一圈所用时间 (上行+下行+停歇时间) | 167 | // 一圈所用时间 (上行+下行+停歇时间) |
| 163 | - return parseInt(map.upTravelTime) + parseInt(map.upStopTime) + parseInt(map.downStopTime) + parseInt(map.downTravelTime); | 168 | + return { |
| 169 | + 'gfzzsj': parseInt(map.earlyUpTime =='' ? map.upTravelTime : map.earlyUpTime) + | ||
| 170 | + parseInt(map.gfupStopTime) + parseInt(map.gfdownStopTime) + | ||
| 171 | + parseInt(map.earlyDownTime =='' ? map.downTravelTime : map.earlyDownTime ), // 高峰周转时间 | ||
| 172 | + 'dgzzsj': parseInt(map.troughUpTime==''? map.upTravelTime : map.troughUpTime) + | ||
| 173 | + parseInt(map.dgupStopTime) + parseInt(map.dgdownStopTime) + | ||
| 174 | + parseInt(map.troughDownTime==''? map.downTravelTime: map.troughDownTime),// 低谷周转时间 | ||
| 175 | + }; | ||
| 164 | } | 176 | } |
| 165 | 177 | ||
| 166 | /** | 178 | /** |
| @@ -171,8 +183,8 @@ | @@ -171,8 +183,8 @@ | ||
| 171 | * @return 返回开始与结束时间字符串集合. | 183 | * @return 返回开始与结束时间字符串集合. |
| 172 | * */ | 184 | * */ |
| 173 | function getStartAndEndDate(map) { | 185 | function getStartAndEndDate(map) { |
| 174 | - return {'s': map.linePlayType=='1'? map.startStationFirstTime : getMinDate(map.startStationFirstTime,map.endStationFirstTime), | ||
| 175 | - 'e': map.linePlayType=='1'? map.startStationEndTime : getMaxDate(map.startStationEndTime,map.endStationEndTime)} | 186 | + return {'s': map.linePlayType == '1' ? map.startStationFirstTime : getMinDate(map.startStationFirstTime,map.endStationFirstTime), |
| 187 | + 'e': map.linePlayType == '1' ? map.startStationEndTime : getMaxDate(map.startStationEndTime,map.endStationEndTime)} | ||
| 176 | } | 188 | } |
| 177 | 189 | ||
| 178 | /** | 190 | /** |
| @@ -259,7 +271,6 @@ | @@ -259,7 +271,6 @@ | ||
| 259 | year = newDate.getFullYear(); | 271 | year = newDate.getFullYear(); |
| 260 | var jssj = BaseFun.getEndDate(year + '-' + month + '-' + dt + ' ' + '00:00'); | 272 | var jssj = BaseFun.getEndDate(year + '-' + month + '-' + dt + ' ' + '00:00'); |
| 261 | return {'kssj' : kssj, 'jssj' : jssj}; | 273 | return {'kssj' : kssj, 'jssj' : jssj}; |
| 262 | - | ||
| 263 | } | 274 | } |
| 264 | 275 | ||
| 265 | /** | 276 | /** |
| @@ -272,9 +283,11 @@ | @@ -272,9 +283,11 @@ | ||
| 272 | function getsj(map) { | 283 | function getsj(map) { |
| 273 | var sxsj = parseInt(map.upTravelTime);// 上行时间. | 284 | var sxsj = parseInt(map.upTravelTime);// 上行时间. |
| 274 | var xxsj = parseInt(map.downTravelTime);// 下行时间. | 285 | var xxsj = parseInt(map.downTravelTime);// 下行时间. |
| 275 | - return [{'sxtzjx':parseInt(map.upStopTime), // 上行停站间隙. | ||
| 276 | - 'xxtzjx':parseInt(map.downStopTime), // 下行停站间隙. | ||
| 277 | - 'fcjx':parseInt(map.stopSpace),// 发车间隙. | 286 | + return [{'gfsxtzjx':parseInt(map.gfupStopTime), // 高峰上行停站间隙. |
| 287 | + 'gfxxtzjx':parseInt(map.gfdownStopTime), // 高峰下行停站间隙. | ||
| 288 | + 'dgsxtzjx':parseInt(map.dgupStopTime), // 低谷上行停站间隙. | ||
| 289 | + 'dgxxtzjx':parseInt(map.dgdownStopTime),// 低谷下行停站间隙. | ||
| 290 | + 'fcjx':map.fcjx,// 发车间隙. | ||
| 278 | 'sxsj':sxsj,// 上行时间. | 291 | 'sxsj':sxsj,// 上行时间. |
| 279 | 'xxsj':xxsj,// 下行时间. | 292 | 'xxsj':xxsj,// 下行时间. |
| 280 | 'zzsj':map.zzsj,// 周转时间. | 293 | 'zzsj':map.zzsj,// 周转时间. |