Commit 6d8c8a5b998f1c89f4481156d814380b07433c0c
Merge branch 'minhang' of http://192.168.168.201:8888/panzhaov5/bsth_control into minhang
Showing
54 changed files
with
2349 additions
and
559 deletions
Too many changes to show.
To preserve performance only 54 of 1818 files are displayed.
src/main/java/com/bsth/WebAppConfiguration.java
| 1 | package com.bsth; | 1 | package com.bsth; |
| 2 | 2 | ||
| 3 | -import javax.servlet.Filter; | ||
| 4 | - | ||
| 5 | -import org.springframework.beans.factory.annotation.Autowired; | 3 | +import com.bsth.filter.ResourceFilter; |
| 4 | +import com.bsth.websocket.WebSocketHandshakeInterceptor; | ||
| 5 | +import com.bsth.websocket.handler.RealControlSocketHandler; | ||
| 6 | +import org.slf4j.Logger; | ||
| 7 | +import org.slf4j.LoggerFactory; | ||
| 6 | import org.springframework.boot.context.embedded.FilterRegistrationBean; | 8 | import org.springframework.boot.context.embedded.FilterRegistrationBean; |
| 7 | import org.springframework.context.annotation.Bean; | 9 | import org.springframework.context.annotation.Bean; |
| 8 | import org.springframework.context.annotation.ComponentScan; | 10 | import org.springframework.context.annotation.ComponentScan; |
| 9 | import org.springframework.context.annotation.Configuration; | 11 | import org.springframework.context.annotation.Configuration; |
| 10 | import org.springframework.web.filter.CharacterEncodingFilter; | 12 | import org.springframework.web.filter.CharacterEncodingFilter; |
| 11 | import org.springframework.web.filter.HttpPutFormContentFilter; | 13 | import org.springframework.web.filter.HttpPutFormContentFilter; |
| 12 | -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; | ||
| 13 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; | 14 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; |
| 14 | import org.springframework.web.socket.config.annotation.EnableWebSocket; | 15 | import org.springframework.web.socket.config.annotation.EnableWebSocket; |
| 15 | import org.springframework.web.socket.config.annotation.WebSocketConfigurer; | 16 | import org.springframework.web.socket.config.annotation.WebSocketConfigurer; |
| 16 | import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; | 17 | import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; |
| 18 | +import org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean; | ||
| 17 | 19 | ||
| 18 | -import com.bsth.filter.ResourceFilter; | ||
| 19 | -import com.bsth.oplog.http.HttpOpLogInterceptor; | ||
| 20 | -import com.bsth.websocket.WebSocketHandshakeInterceptor; | ||
| 21 | -import com.bsth.websocket.handler.RealControlSocketHandler; | 20 | +import javax.servlet.Filter; |
| 22 | 21 | ||
| 23 | @Configuration | 22 | @Configuration |
| 24 | @EnableWebSocket | 23 | @EnableWebSocket |
| @@ -27,6 +26,8 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS | @@ -27,6 +26,8 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS | ||
| 27 | 26 | ||
| 28 | // @Autowired | 27 | // @Autowired |
| 29 | // HttpOpLogInterceptor httpOpLogInterceptor; | 28 | // HttpOpLogInterceptor httpOpLogInterceptor; |
| 29 | + | ||
| 30 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 30 | 31 | ||
| 31 | /** | 32 | /** |
| 32 | * @Title: httpPutFormContentFilter | 33 | * @Title: httpPutFormContentFilter |
| @@ -75,4 +76,17 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS | @@ -75,4 +76,17 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS | ||
| 75 | registry.addHandler(new RealControlSocketHandler(), "/sockjs/realcontrol").addInterceptors(new WebSocketHandshakeInterceptor()) | 76 | registry.addHandler(new RealControlSocketHandler(), "/sockjs/realcontrol").addInterceptors(new WebSocketHandshakeInterceptor()) |
| 76 | .withSockJS(); | 77 | .withSockJS(); |
| 77 | } | 78 | } |
| 79 | + | ||
| 80 | + /** | ||
| 81 | + * 增加websocket的输出缓冲区 | ||
| 82 | + * @return | ||
| 83 | + */ | ||
| 84 | + @Bean | ||
| 85 | + public ServletServerContainerFactoryBean createServletServerContainerFactoryBean() { | ||
| 86 | + ServletServerContainerFactoryBean container = new ServletServerContainerFactoryBean(); | ||
| 87 | + container.setMaxTextMessageBufferSize(52768); | ||
| 88 | + container.setMaxBinaryMessageBufferSize(52768); | ||
| 89 | + logger.info("Websocket factory returned"); | ||
| 90 | + return container; | ||
| 91 | + } | ||
| 78 | } | 92 | } |
src/main/java/com/bsth/controller/SectionRouteController.java
| @@ -35,6 +35,17 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer | @@ -35,6 +35,17 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer | ||
| 35 | @Autowired | 35 | @Autowired |
| 36 | SectionRouteService routeService; | 36 | SectionRouteService routeService; |
| 37 | 37 | ||
| 38 | + /** | ||
| 39 | + * @param @param map | ||
| 40 | + * @throws | ||
| 41 | + * @Title: list | ||
| 42 | + * @Description: TODO(多条件查询) | ||
| 43 | + */ | ||
| 44 | + @RequestMapping(value = "/all", method = RequestMethod.GET) | ||
| 45 | + public Iterable<SectionRoute> list(@RequestParam Map<String, Object> map) { | ||
| 46 | + return routeService.list(map); | ||
| 47 | + } | ||
| 48 | + | ||
| 38 | /** | 49 | /** |
| 39 | * @Description :TODO(查询路段信息) | 50 | * @Description :TODO(查询路段信息) |
| 40 | * | 51 | * |
| @@ -67,7 +78,7 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer | @@ -67,7 +78,7 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer | ||
| 67 | * | 78 | * |
| 68 | * @return List<Map<String, Object>> | 79 | * @return List<Map<String, Object>> |
| 69 | */ | 80 | */ |
| 70 | - @RequestMapping(value = "/findUpStationRouteCode" , method = RequestMethod.GET) | 81 | + @RequestMapping(value = "/findUpSectionRouteCode" , method = RequestMethod.GET) |
| 71 | public List<Map<String, Object>> findUpStationRouteCode(@RequestParam Map<String, Object> map) { | 82 | public List<Map<String, Object>> findUpStationRouteCode(@RequestParam Map<String, Object> map) { |
| 72 | return routeService.findUpSectionRouteCode(map); | 83 | return routeService.findUpSectionRouteCode(map); |
| 73 | } | 84 | } |
src/main/java/com/bsth/controller/StationController.java
| @@ -107,13 +107,9 @@ public class StationController extends BaseController<Station, Integer> { | @@ -107,13 +107,9 @@ public class StationController extends BaseController<Station, Integer> { | ||
| 107 | */ | 107 | */ |
| 108 | @RequestMapping(value="stationUpdate" , method = RequestMethod.POST) | 108 | @RequestMapping(value="stationUpdate" , method = RequestMethod.POST) |
| 109 | public Map<String, Object> stationUpdate(@RequestParam Map<String, Object> map) { | 109 | public Map<String, Object> stationUpdate(@RequestParam Map<String, Object> map) { |
| 110 | - | ||
| 111 | map.put("updateBy", ""); | 110 | map.put("updateBy", ""); |
| 112 | - | ||
| 113 | return service.stationUpdate(map); | 111 | return service.stationUpdate(map); |
| 114 | - | ||
| 115 | } | 112 | } |
| 116 | - | ||
| 117 | /** | 113 | /** |
| 118 | * @Description :TODO(查询站点编码) | 114 | * @Description :TODO(查询站点编码) |
| 119 | * | 115 | * |
src/main/java/com/bsth/controller/realcontrol/ChildTaskPlanController.java
| 1 | package com.bsth.controller.realcontrol; | 1 | package com.bsth.controller.realcontrol; |
| 2 | 2 | ||
| 3 | +import com.bsth.controller.BaseController; | ||
| 4 | +import com.bsth.entity.realcontrol.ChildTaskPlan; | ||
| 5 | +import com.bsth.service.realcontrol.ChildTaskPlanService; | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.web.bind.annotation.PathVariable; | ||
| 3 | import org.springframework.web.bind.annotation.RequestMapping; | 8 | import org.springframework.web.bind.annotation.RequestMapping; |
| 9 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 4 | import org.springframework.web.bind.annotation.RestController; | 10 | import org.springframework.web.bind.annotation.RestController; |
| 5 | 11 | ||
| 6 | -import com.bsth.controller.BaseController; | ||
| 7 | -import com.bsth.entity.realcontrol.ChildTaskPlan; | 12 | +import java.util.Map; |
| 8 | 13 | ||
| 9 | @RestController | 14 | @RestController |
| 10 | @RequestMapping("/childTask") | 15 | @RequestMapping("/childTask") |
| 11 | public class ChildTaskPlanController extends BaseController<ChildTaskPlan, Long>{ | 16 | public class ChildTaskPlanController extends BaseController<ChildTaskPlan, Long>{ |
| 12 | 17 | ||
| 18 | + @Autowired | ||
| 19 | + ChildTaskPlanService childTaskPlanService; | ||
| 20 | + | ||
| 21 | + @RequestMapping(value = "history", method = RequestMethod.POST) | ||
| 22 | + public Map<String, Object> saveHistory(ChildTaskPlan childTask){ | ||
| 23 | + return childTaskPlanService.saveHistory(childTask); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + @RequestMapping(value = "history/{id}", method = RequestMethod.DELETE) | ||
| 27 | + public Map<String, Object> delHistory(@PathVariable("id") Long id){ | ||
| 28 | + return childTaskPlanService.delHistory(id); | ||
| 29 | + } | ||
| 13 | } | 30 | } |
src/main/java/com/bsth/controller/realcontrol/RealMapController.java
| @@ -45,8 +45,8 @@ public class RealMapController { | @@ -45,8 +45,8 @@ public class RealMapController { | ||
| 45 | * @Description: TODO(获取线路的站点,路段路由) | 45 | * @Description: TODO(获取线路的站点,路段路由) |
| 46 | */ | 46 | */ |
| 47 | @RequestMapping(value = "/findRouteByLine") | 47 | @RequestMapping(value = "/findRouteByLine") |
| 48 | - public Map<String, Object> findRouteByLine(@RequestParam String lineCode) { | ||
| 49 | - return realMapService.findRouteByLine(lineCode); | 48 | + public Map<String, Object> findRouteByLine(@RequestParam String idx) { |
| 49 | + return realMapService.findRouteByLine(idx); | ||
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | @RequestMapping(value = "/multiRouteByLine") | 52 | @RequestMapping(value = "/multiRouteByLine") |
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| @@ -419,10 +419,10 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -419,10 +419,10 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 419 | return scheduleRealInfoService.changeBcType(id, bcType, remarks); | 419 | return scheduleRealInfoService.changeBcType(id, bcType, remarks); |
| 420 | } | 420 | } |
| 421 | 421 | ||
| 422 | -/* @RequestMapping(value="/history", method=RequestMethod.POST) | 422 | + @RequestMapping(value="/history", method=RequestMethod.POST) |
| 423 | public Map<String,Object> historySave(ScheduleRealInfo sch){ | 423 | public Map<String,Object> historySave(ScheduleRealInfo sch){ |
| 424 | return scheduleRealInfoService.historySave(sch); | 424 | return scheduleRealInfoService.historySave(sch); |
| 425 | - }*/ | 425 | + } |
| 426 | 426 | ||
| 427 | 427 | ||
| 428 | private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"); | 428 | private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"); |
| @@ -435,7 +435,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -435,7 +435,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 435 | public List<String> dateArray(){ | 435 | public List<String> dateArray(){ |
| 436 | List<String> rs = new ArrayList<>(); | 436 | List<String> rs = new ArrayList<>(); |
| 437 | 437 | ||
| 438 | - long t = new Date().getTime() - ONE_DAY; | 438 | + long t = new Date().getTime() - ONE_DAY - (1000 * 60 * 60 * 2); |
| 439 | for(int i = 0; i < 5; i ++){ | 439 | for(int i = 0; i < 5; i ++){ |
| 440 | rs.add(fmtyyyyMMdd.print(t)); | 440 | rs.add(fmtyyyyMMdd.print(t)); |
| 441 | t -= ONE_DAY; | 441 | t -= ONE_DAY; |
| @@ -536,4 +536,24 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -536,4 +536,24 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 536 | public List<ScheduleRealInfo> allLate2(@RequestParam String idx){ | 536 | public List<ScheduleRealInfo> allLate2(@RequestParam String idx){ |
| 537 | return scheduleRealInfoService.allLate2(idx); | 537 | return scheduleRealInfoService.allLate2(idx); |
| 538 | } | 538 | } |
| 539 | + | ||
| 540 | + /** | ||
| 541 | + * 添加一个临加到历史库 | ||
| 542 | + * @param sch | ||
| 543 | + * @return | ||
| 544 | + */ | ||
| 545 | + @RequestMapping(value = "history/add", method = RequestMethod.POST) | ||
| 546 | + public Map<String, Object> addToHistory(ScheduleRealInfo sch){ | ||
| 547 | + return scheduleRealInfoService.addToHistory(sch); | ||
| 548 | + } | ||
| 549 | + | ||
| 550 | + /** | ||
| 551 | + * 从历史库里删除临加班次 | ||
| 552 | + * @param sch | ||
| 553 | + * @return | ||
| 554 | + */ | ||
| 555 | + @RequestMapping(value = "history/{id}", method = RequestMethod.DELETE) | ||
| 556 | + public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){ | ||
| 557 | + return scheduleRealInfoService.deleteToHistory(id); | ||
| 558 | + } | ||
| 539 | } | 559 | } |
src/main/java/com/bsth/controller/realcontrol/anomalyCheckController.java
| @@ -10,9 +10,9 @@ import org.springframework.web.bind.annotation.RequestMethod; | @@ -10,9 +10,9 @@ import org.springframework.web.bind.annotation.RequestMethod; | ||
| 10 | import org.springframework.web.bind.annotation.RequestParam; | 10 | import org.springframework.web.bind.annotation.RequestParam; |
| 11 | import org.springframework.web.bind.annotation.RestController; | 11 | import org.springframework.web.bind.annotation.RestController; |
| 12 | 12 | ||
| 13 | -import java.util.HashSet; | 13 | +import java.util.HashMap; |
| 14 | import java.util.List; | 14 | import java.util.List; |
| 15 | -import java.util.Set; | 15 | +import java.util.Map; |
| 16 | 16 | ||
| 17 | /** | 17 | /** |
| 18 | * 相关数据异常检测 | 18 | * 相关数据异常检测 |
| @@ -35,16 +35,19 @@ public class anomalyCheckController { | @@ -35,16 +35,19 @@ public class anomalyCheckController { | ||
| 35 | public void schRepeat(@RequestParam String nbbm){ | 35 | public void schRepeat(@RequestParam String nbbm){ |
| 36 | logger.info("前端通知,车辆 " + nbbm + "出现重复班次,开始检测..."); | 36 | logger.info("前端通知,车辆 " + nbbm + "出现重复班次,开始检测..."); |
| 37 | List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(nbbm); | 37 | List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(nbbm); |
| 38 | + logger.info("检测前,车辆班次数量:" + list.size()); | ||
| 38 | 39 | ||
| 39 | - Set<ScheduleRealInfo> set = new HashSet<>(); | 40 | + Map<Long, ScheduleRealInfo> map = new HashMap<>(); |
| 40 | for(ScheduleRealInfo sch : list){ | 41 | for(ScheduleRealInfo sch : list){ |
| 41 | - if(!set.add(sch)){ | ||
| 42 | - logger.info("出现一次重复班次,班次ID:" + sch.getId()); | 42 | + if(map.containsKey(sch.getId())){ |
| 43 | + logger.info("检测到重复ID: " + sch.getId()); | ||
| 43 | } | 44 | } |
| 45 | + map.put(sch.getId(), sch); | ||
| 44 | } | 46 | } |
| 45 | 47 | ||
| 46 | - if(set.size() > 0){ | ||
| 47 | - dayOfSchedule.replaceByNbbm(nbbm, set); | 48 | + logger.info("检测后,车辆班次数量:" + list.size()); |
| 49 | + if(map.values().size() > 0){ | ||
| 50 | + dayOfSchedule.replaceByNbbm(nbbm, map.values()); | ||
| 48 | } | 51 | } |
| 49 | } | 52 | } |
| 50 | } | 53 | } |
src/main/java/com/bsth/controller/schedule/SchedulePlanInfoController.java renamed to src/main/java/com/bsth/controller/schedule/core/SchedulePlanInfoController.java
| 1 | -package com.bsth.controller.schedule; | ||
| 2 | - | ||
| 3 | -import com.bsth.common.ResponseCode; | ||
| 4 | -import com.bsth.controller.BaseController; | ||
| 5 | -import com.bsth.entity.schedule.SchedulePlanInfo; | ||
| 6 | -import com.bsth.service.schedule.SchedulePlanInfoService; | ||
| 7 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | -import org.springframework.web.bind.annotation.*; | ||
| 9 | - | ||
| 10 | -import java.util.Date; | ||
| 11 | -import java.util.HashMap; | ||
| 12 | -import java.util.List; | ||
| 13 | -import java.util.Map; | ||
| 14 | - | ||
| 15 | -/** | ||
| 16 | - * Created by xu on 16/6/16. | ||
| 17 | - */ | ||
| 18 | -@RestController | ||
| 19 | -@RequestMapping("spic") | ||
| 20 | -public class SchedulePlanInfoController extends BaseController<SchedulePlanInfo, Long> { | ||
| 21 | - @Autowired | ||
| 22 | - private SchedulePlanInfoService schedulePlanInfoService; | ||
| 23 | - | ||
| 24 | - @RequestMapping(value = "/groupinfos/{xlid}/{date}", method = RequestMethod.GET) | ||
| 25 | - public List<SchedulePlanInfoService.GroupInfo> findGroupInfo( | ||
| 26 | - @PathVariable(value = "xlid") Integer xlid, | ||
| 27 | - @PathVariable(value = "date") Date scheduleDate) { | ||
| 28 | - return schedulePlanInfoService.findGroupInfo(xlid, scheduleDate); | ||
| 29 | - } | ||
| 30 | - | ||
| 31 | - @RequestMapping(value = "/groupinfos/update", method = RequestMethod.POST) | ||
| 32 | - public Map<String, Object> updateGroupInfo(@RequestBody SchedulePlanInfoService.GroupInfoUpdate groupInfoUpdate) { | ||
| 33 | - Map<String, Object> resultMap = new HashMap<>(); | ||
| 34 | - try { | ||
| 35 | - schedulePlanInfoService.updateGroupInfo(groupInfoUpdate); | ||
| 36 | - | ||
| 37 | - resultMap.put("status", ResponseCode.SUCCESS); | ||
| 38 | - resultMap.put("msg", "更新成功"); | ||
| 39 | - } catch (Exception exp) { | ||
| 40 | - exp.printStackTrace(); | ||
| 41 | - resultMap.put("status", ResponseCode.ERROR); | ||
| 42 | - resultMap.put("msg", exp.getLocalizedMessage()); | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | - return resultMap; | ||
| 46 | - } | ||
| 47 | -} | 1 | +package com.bsth.controller.schedule.core; |
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.controller.schedule.BController; | ||
| 5 | +import com.bsth.entity.schedule.SchedulePlanInfo; | ||
| 6 | +import com.bsth.service.schedule.SchedulePlanInfoService; | ||
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | +import org.springframework.web.bind.annotation.*; | ||
| 9 | + | ||
| 10 | +import java.util.Date; | ||
| 11 | +import java.util.HashMap; | ||
| 12 | +import java.util.List; | ||
| 13 | +import java.util.Map; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * Created by xu on 17/5/1. | ||
| 17 | + */ | ||
| 18 | +@RestController | ||
| 19 | +@RequestMapping("spic") | ||
| 20 | +public class SchedulePlanInfoController extends BController<SchedulePlanInfo, Long> { | ||
| 21 | + @Autowired | ||
| 22 | + private SchedulePlanInfoService schedulePlanInfoService; | ||
| 23 | + | ||
| 24 | + @RequestMapping(value = "/groupextinfos/{xlid}/{date}", method = RequestMethod.GET) | ||
| 25 | + public Map<String, Object> findGroupInfoExt( | ||
| 26 | + @PathVariable(value = "xlid") Integer xlid, | ||
| 27 | + @PathVariable(value = "date") Date scheduleDate) { | ||
| 28 | + Map<String, Object> resultMap = new HashMap<>(); | ||
| 29 | + try { | ||
| 30 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 31 | + resultMap.put("data", schedulePlanInfoService.findSchedulePlanGroupInfo(xlid, scheduleDate)); | ||
| 32 | + | ||
| 33 | + } catch (Exception exp) { | ||
| 34 | + exp.printStackTrace(); | ||
| 35 | + resultMap.put("status", ResponseCode.ERROR); | ||
| 36 | + resultMap.put("msg", exp.getLocalizedMessage()); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + return resultMap; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + | ||
| 43 | +// ------------------------ 老版本 ----------------------// | ||
| 44 | + @RequestMapping(value = "/groupinfos/{xlid}/{date}", method = RequestMethod.GET) | ||
| 45 | + public List<SchedulePlanInfoService.GroupInfo> findGroupInfo( | ||
| 46 | + @PathVariable(value = "xlid") Integer xlid, | ||
| 47 | + @PathVariable(value = "date") Date scheduleDate) { | ||
| 48 | + return schedulePlanInfoService.findGroupInfo(xlid, scheduleDate); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + @RequestMapping(value = "/groupinfos/update", method = RequestMethod.POST) | ||
| 52 | + public Map<String, Object> updateGroupInfo(@RequestBody SchedulePlanInfoService.GroupInfoUpdate groupInfoUpdate) { | ||
| 53 | + Map<String, Object> resultMap = new HashMap<>(); | ||
| 54 | + try { | ||
| 55 | + schedulePlanInfoService.updateGroupInfo(groupInfoUpdate); | ||
| 56 | + | ||
| 57 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 58 | + resultMap.put("msg", "更新成功"); | ||
| 59 | + } catch (Exception exp) { | ||
| 60 | + exp.printStackTrace(); | ||
| 61 | + resultMap.put("status", ResponseCode.ERROR); | ||
| 62 | + resultMap.put("msg", exp.getLocalizedMessage()); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + return resultMap; | ||
| 66 | + } | ||
| 67 | +} |
src/main/java/com/bsth/data/BasicData.java
| @@ -31,7 +31,7 @@ public class BasicData implements CommandLineRunner { | @@ -31,7 +31,7 @@ public class BasicData implements CommandLineRunner { | ||
| 31 | //公司代码和公司名对照(K: 公司编码,V:公司名) | 31 | //公司代码和公司名对照(K: 公司编码,V:公司名) |
| 32 | public static Map<String, String> businessCodeNameMap; | 32 | public static Map<String, String> businessCodeNameMap; |
| 33 | 33 | ||
| 34 | - //分公司公司代码和分公司公司名对照(K: 公司编码+分公司编码,V:分公司公司名) | 34 | + //分公司公司代码和分公司公司名对照(K: 公司编码_分公司编码,V:分公司公司名) |
| 35 | public static Map<String, String> businessFgsCodeNameMap; | 35 | public static Map<String, String> businessFgsCodeNameMap; |
| 36 | 36 | ||
| 37 | //设备号和车辆自编号 (K: 设备编码 ,V:车辆自编号) | 37 | //设备号和车辆自编号 (K: 设备编码 ,V:车辆自编号) |
| @@ -333,7 +333,7 @@ public class BasicData implements CommandLineRunner { | @@ -333,7 +333,7 @@ public class BasicData implements CommandLineRunner { | ||
| 333 | 333 | ||
| 334 | perTempMap.put(jobCode, p); | 334 | perTempMap.put(jobCode, p); |
| 335 | 335 | ||
| 336 | - allPersonMap.put(jobCode.substring(jobCode.indexOf("-")+1), p.getPersonnelName()); | 336 | + allPersonMap.put(jobCode, p.getPersonnelName()); |
| 337 | } | 337 | } |
| 338 | 338 | ||
| 339 | jsyMap = jsyTempMap; | 339 | jsyMap = jsyTempMap; |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
| @@ -270,7 +270,7 @@ public class InOutStationSignalHandle extends SignalHandle{ | @@ -270,7 +270,7 @@ public class InOutStationSignalHandle extends SignalHandle{ | ||
| 270 | 270 | ||
| 271 | //通知客户端 | 271 | //通知客户端 |
| 272 | sendUtils.sendZdsj(sch, lpNext, doneSum); | 272 | sendUtils.sendZdsj(sch, lpNext, doneSum); |
| 273 | - | 273 | + logger.info("车辆:" + sch.getClZbh() + " 班次:" + sch.getDfsj() + "到终点, 时间:" + sch.getZdsjActual()); |
| 274 | //准备执行下一个班次 | 274 | //准备执行下一个班次 |
| 275 | if (next != null) { | 275 | if (next != null) { |
| 276 | //将gps转换为下一个班次走向的站内信号 | 276 | //将gps转换为下一个班次走向的站内信号 |
src/main/java/com/bsth/data/gpsdata/arrival/utils/GeoUtils.java
| @@ -96,7 +96,10 @@ public class GeoUtils { | @@ -96,7 +96,10 @@ public class GeoUtils { | ||
| 96 | public static double getDistanceFromLine(LineString line, Point p){ | 96 | public static double getDistanceFromLine(LineString line, Point p){ |
| 97 | Point s = line.getStartPoint(); | 97 | Point s = line.getStartPoint(); |
| 98 | Point e = line.getEndPoint(); | 98 | Point e = line.getEndPoint(); |
| 99 | + return getDistanceFromLine(s, e, p); | ||
| 100 | + } | ||
| 99 | 101 | ||
| 102 | + public static double getDistanceFromLine(Point s, Point e, Point p){ | ||
| 100 | double d1 = getDistance(s, p); | 103 | double d1 = getDistance(s, p); |
| 101 | double d2 = getDistance(p, e); | 104 | double d2 = getDistance(p, e); |
| 102 | double d3 = getDistance(s, e); | 105 | double d3 = getDistance(s, e); |
| @@ -147,4 +150,92 @@ public class GeoUtils { | @@ -147,4 +150,92 @@ public class GeoUtils { | ||
| 147 | public static boolean overdue(GpsEntity prevGps, GpsEntity gps) { | 150 | public static boolean overdue(GpsEntity prevGps, GpsEntity gps) { |
| 148 | return gps.getTimestamp() - prevGps.getTimestamp() < 120000; | 151 | return gps.getTimestamp() - prevGps.getTimestamp() < 120000; |
| 149 | } | 152 | } |
| 153 | + | ||
| 154 | + /** | ||
| 155 | + * 计算2条直线的最短距离 | ||
| 156 | + * @param p1 | ||
| 157 | + * @param p2 | ||
| 158 | + * @param p3 | ||
| 159 | + * @param p4 | ||
| 160 | + * @return | ||
| 161 | + */ | ||
| 162 | + public static double getDistanceLineToLine(Point p1, Point p2, Point p3, Point p4){ | ||
| 163 | + double distance; | ||
| 164 | + double x1 = p1.getX(); //A点坐标(x1,y1,z1) | ||
| 165 | + double y1 = p1.getY(); | ||
| 166 | + double z1 = 0; | ||
| 167 | + double x2 = p2.getX(); //B点坐标(x2,y2,z2) | ||
| 168 | + double y2 = p2.getY(); | ||
| 169 | + double z2 = 0; | ||
| 170 | + double x3 = p3.getX(); //C点坐标(x3,y3,z3) | ||
| 171 | + double y3 = p3.getY(); | ||
| 172 | + double z3 = 0; | ||
| 173 | + double x4 = p4.getX(); //D点坐标(x4,y4,z4) | ||
| 174 | + double y4 = p4.getY(); | ||
| 175 | + double z4 = 0; | ||
| 176 | + | ||
| 177 | + double a = (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)+(z2-z1)*(z2-z1); | ||
| 178 | + double b = -((x2-x1)*(x4-x3)+(y2-y1)*(y4-y3)+(z2-z1)*(z4-z3)); | ||
| 179 | + double c = -((x1-x2)*(x1-x3)+(y1-y2)*(y1-y3)+(z1-z2)*(z1-z3)); | ||
| 180 | + | ||
| 181 | + double d = -((x2-x1)*(x4-x3)+(y2-y1)*(y4-y3)+(z2-z1)*(z4-z3)); | ||
| 182 | + double e = (x4-x3)*(x4-x3)+(y4-y3)*(y4-y3)+(z4-z3)*(z4-z3); | ||
| 183 | + double f = -((x1-x3)*(x4-x3)+(y1-y3)*(y4-y3)+(z1-z3)*(z4-z3)); | ||
| 184 | + | ||
| 185 | + //平行 | ||
| 186 | + if ((a*e-b*d)==0&&(b*d-a*e)==0) | ||
| 187 | + { | ||
| 188 | + double d1 = getDistance(p1, p3); | ||
| 189 | + double d2 = getDistance(p1, p4); | ||
| 190 | + distance = (d1<d2)?d1:d2; | ||
| 191 | + return distance; | ||
| 192 | + } | ||
| 193 | + | ||
| 194 | + double s = (b*f-e*c)/(a*e-b*d); | ||
| 195 | + double t = (a*f-d*c)/(b*d-a*e); | ||
| 196 | + | ||
| 197 | + //说明P点落在线段AB上,Q点落在线段CD上 | ||
| 198 | + if(0<=s&&s<=1&&0<=t&&t<=1) | ||
| 199 | + { | ||
| 200 | + //2条线段的公垂线段PQ; | ||
| 201 | + //P点坐标 | ||
| 202 | + double X = x1+s*(x2-x1); | ||
| 203 | + double Y = y1+s*(y2-y1); | ||
| 204 | + double Z = z1+s*(z2-z1); | ||
| 205 | + //Q点坐标 | ||
| 206 | + double U = x3+t*(x4-x3); | ||
| 207 | + double V = y3+t*(y4-y3); | ||
| 208 | + double W = z3+t*(z4-z3); | ||
| 209 | + Point p = geometryFactory.createPoint(new Coordinate(X, Y, Z)); | ||
| 210 | + Point q = geometryFactory.createPoint(new Coordinate(U, V, W)); | ||
| 211 | + distance = getDistance(p, q); | ||
| 212 | + } | ||
| 213 | + else | ||
| 214 | + { | ||
| 215 | + double d1 = getDistanceFromLine(p3,p4,p1); | ||
| 216 | + double d2 = getDistanceFromLine(p3,p4,p2); | ||
| 217 | + double d3 = getDistanceFromLine(p1,p2,p3); | ||
| 218 | + double d4 = getDistanceFromLine(p1,p2,p4); | ||
| 219 | + distance = (d1<d2)?d1:d2; | ||
| 220 | + distance = (distance<d3)?distance:d3; | ||
| 221 | + distance = (distance<d4)?distance:d4; | ||
| 222 | + } | ||
| 223 | + | ||
| 224 | + return distance; | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + /** | ||
| 228 | + * 计算点 到 线的垂直交点 | ||
| 229 | + * @param lp1 | ||
| 230 | + * @param lp2 | ||
| 231 | + * @param p | ||
| 232 | + * @return | ||
| 233 | + */ | ||
| 234 | + public static Point perpendularPoint(Point lp1, Point lp2, Point p){ | ||
| 235 | + double a = lp1.getX() - lp2.getX(), b = lp2.getY() - lp1.getY(), c = lp1.getY() * lp2.getX() - lp2.getY() * lp1.getX(); | ||
| 236 | + double lon = (Math.pow(b, 2) * p.getY() - a * b * p.getX() - a * c) / (Math.pow(a, 2) + Math.pow(b, 2)); | ||
| 237 | + double lat = (Math.pow(a, 2) * p.getX() - a * b * p.getY() - b * c) / (Math.pow(a, 2) + Math.pow(b, 2)); | ||
| 238 | + | ||
| 239 | + return geometryFactory.createPoint(new Coordinate(lat, lon)); | ||
| 240 | + } | ||
| 150 | } | 241 | } |
src/main/java/com/bsth/data/gpsdata/arrival/utils/ScheduleSignalState.java
| @@ -72,7 +72,7 @@ public class ScheduleSignalState { | @@ -72,7 +72,7 @@ public class ScheduleSignalState { | ||
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | ScheduleRealInfo next = dayOfSchedule.next(sch); | 74 | ScheduleRealInfo next = dayOfSchedule.next(sch); |
| 75 | - if (next.getXlDir().equals(sch.getXlDir())) | 75 | + if (next != null && next.getXlDir().equals(sch.getXlDir())) |
| 76 | return; | 76 | return; |
| 77 | 77 | ||
| 78 | //时间足够下一个班次待发时间运行到当前站 | 78 | //时间足够下一个班次待发时间运行到当前站 |
src/main/java/com/bsth/data/gpsdata/thread/GpsDataLoaderThread.java
| @@ -10,6 +10,7 @@ import com.bsth.data.gpsdata.recovery.GpsDataRecovery; | @@ -10,6 +10,7 @@ import com.bsth.data.gpsdata.recovery.GpsDataRecovery; | ||
| 10 | import com.bsth.util.ConfigUtil; | 10 | import com.bsth.util.ConfigUtil; |
| 11 | import org.apache.commons.lang3.StringUtils; | 11 | import org.apache.commons.lang3.StringUtils; |
| 12 | import org.apache.http.HttpEntity; | 12 | import org.apache.http.HttpEntity; |
| 13 | +import org.apache.http.client.config.RequestConfig; | ||
| 13 | import org.apache.http.client.methods.CloseableHttpResponse; | 14 | import org.apache.http.client.methods.CloseableHttpResponse; |
| 14 | import org.apache.http.client.methods.HttpGet; | 15 | import org.apache.http.client.methods.HttpGet; |
| 15 | import org.apache.http.impl.client.CloseableHttpClient; | 16 | import org.apache.http.impl.client.CloseableHttpClient; |
| @@ -69,6 +70,11 @@ public class GpsDataLoaderThread extends Thread { | @@ -69,6 +70,11 @@ public class GpsDataLoaderThread extends Thread { | ||
| 69 | try { | 70 | try { |
| 70 | httpClient = HttpClients.createDefault(); | 71 | httpClient = HttpClients.createDefault(); |
| 71 | HttpGet get = new HttpGet(url); | 72 | HttpGet get = new HttpGet(url); |
| 73 | + //超时时间 | ||
| 74 | + RequestConfig requestConfig = RequestConfig.custom() | ||
| 75 | + .setConnectTimeout(2000).setConnectionRequestTimeout(1000) | ||
| 76 | + .setSocketTimeout(2000).build(); | ||
| 77 | + get.setConfig(requestConfig); | ||
| 72 | 78 | ||
| 73 | response = httpClient.execute(get); | 79 | response = httpClient.execute(get); |
| 74 | 80 | ||
| @@ -108,6 +114,7 @@ public class GpsDataLoaderThread extends Thread { | @@ -108,6 +114,7 @@ public class GpsDataLoaderThread extends Thread { | ||
| 108 | //有更新的点位 | 114 | //有更新的点位 |
| 109 | updateList.add(gps); | 115 | updateList.add(gps); |
| 110 | } | 116 | } |
| 117 | + logger.info("全量点:"+ list.size() +",更新点" + updateList.size()); | ||
| 111 | //分析数据 | 118 | //分析数据 |
| 112 | gpsRealAnalyse.analyse(updateList); | 119 | gpsRealAnalyse.analyse(updateList); |
| 113 | } else | 120 | } else |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| @@ -480,7 +480,7 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -480,7 +480,7 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 480 | public List<ScheduleRealInfo> findByLineCode(String lineCode) { | 480 | public List<ScheduleRealInfo> findByLineCode(String lineCode) { |
| 481 | List<ScheduleRealInfo> rs = new ArrayList<>(); | 481 | List<ScheduleRealInfo> rs = new ArrayList<>(); |
| 482 | 482 | ||
| 483 | - Collection<ScheduleRealInfo> schs = nbbmScheduleMap.values(); | 483 | + Collection<ScheduleRealInfo> schs = id2SchedulMap.values(); |
| 484 | for (ScheduleRealInfo sch : schs) { | 484 | for (ScheduleRealInfo sch : schs) { |
| 485 | if (sch.getXlBm().equals(lineCode)) | 485 | if (sch.getXlBm().equals(lineCode)) |
| 486 | rs.add(sch); | 486 | rs.add(sch); |
| @@ -489,6 +489,22 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -489,6 +489,22 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 489 | } | 489 | } |
| 490 | 490 | ||
| 491 | /** | 491 | /** |
| 492 | + * @Title: findByLineCode | ||
| 493 | + * @Description: TODO(lineList 获取班次) | ||
| 494 | + */ | ||
| 495 | + public Map<String, Collection<ScheduleRealInfo>> findByLineCodes(List<String> lineList) { | ||
| 496 | + ArrayListMultimap<String, ScheduleRealInfo> mMap = ArrayListMultimap.create(); | ||
| 497 | + | ||
| 498 | + Collection<ScheduleRealInfo> schs = id2SchedulMap.values(); | ||
| 499 | + for (ScheduleRealInfo sch : schs) { | ||
| 500 | + if(lineList.contains(sch.getXlBm())){ | ||
| 501 | + mMap.put(sch.getXlBm(), sch); | ||
| 502 | + } | ||
| 503 | + } | ||
| 504 | + return mMap.asMap(); | ||
| 505 | + } | ||
| 506 | + | ||
| 507 | + /** | ||
| 492 | * @Title: findCarByLineCode | 508 | * @Title: findCarByLineCode |
| 493 | * @Description: TODO(线路下运营的车辆) | 509 | * @Description: TODO(线路下运营的车辆) |
| 494 | */ | 510 | */ |
| @@ -870,16 +886,14 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -870,16 +886,14 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 870 | */ | 886 | */ |
| 871 | public List<ScheduleRealInfo> changeCar(ScheduleRealInfo sch, String newClZbh) { | 887 | public List<ScheduleRealInfo> changeCar(ScheduleRealInfo sch, String newClZbh) { |
| 872 | List<ScheduleRealInfo> ups = new ArrayList<>(); | 888 | List<ScheduleRealInfo> ups = new ArrayList<>(); |
| 873 | - /*String oldClzbh = sch.getClZbh(); | ||
| 874 | - if (oldClzbh.equals(newClZbh)) | ||
| 875 | - return ups;*/ | ||
| 876 | - | ||
| 877 | 889 | ||
| 878 | //变更相关映射信息 | 890 | //变更相关映射信息 |
| 879 | nbbmScheduleMap.remove(sch.getClZbh(), sch); | 891 | nbbmScheduleMap.remove(sch.getClZbh(), sch); |
| 880 | 892 | ||
| 881 | sch.setClZbh(newClZbh); | 893 | sch.setClZbh(newClZbh); |
| 882 | - nbbmScheduleMap.put(newClZbh, sch); | 894 | + if(!nbbmScheduleMap.containsEntry(newClZbh, sch)){ |
| 895 | + nbbmScheduleMap.put(newClZbh, sch); | ||
| 896 | + } | ||
| 883 | 897 | ||
| 884 | //重新计算班次应到时间 | 898 | //重新计算班次应到时间 |
| 885 | //ups.addAll(updateQdzTimePlan(oldClzbh)); | 899 | //ups.addAll(updateQdzTimePlan(oldClzbh)); |
| @@ -996,11 +1010,9 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -996,11 +1010,9 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 996 | * @param nbbm | 1010 | * @param nbbm |
| 997 | * @param sets | 1011 | * @param sets |
| 998 | */ | 1012 | */ |
| 999 | - public void replaceByNbbm(String nbbm, Set<ScheduleRealInfo> sets){ | 1013 | + public void replaceByNbbm(String nbbm, Collection<ScheduleRealInfo> sets){ |
| 1000 | nbbmScheduleMap.removeAll(nbbm); | 1014 | nbbmScheduleMap.removeAll(nbbm); |
| 1001 | nbbmScheduleMap.putAll(nbbm, sets); | 1015 | nbbmScheduleMap.putAll(nbbm, sets); |
| 1002 | - //重新计算班次应到时间 | ||
| 1003 | - updateQdzTimePlan(nbbm); | ||
| 1004 | } | 1016 | } |
| 1005 | 1017 | ||
| 1006 | /** | 1018 | /** |
src/main/java/com/bsth/entity/schedule/SchedulePlanInfo.java
| @@ -2,6 +2,7 @@ package com.bsth.entity.schedule; | @@ -2,6 +2,7 @@ package com.bsth.entity.schedule; | ||
| 2 | 2 | ||
| 3 | import com.bsth.entity.Line; | 3 | import com.bsth.entity.Line; |
| 4 | import com.bsth.entity.sys.SysUser; | 4 | import com.bsth.entity.sys.SysUser; |
| 5 | +import com.bsth.service.schedule.rules.rerun.RerunRule_input; | ||
| 5 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; | 6 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; |
| 6 | import org.apache.commons.lang3.StringUtils; | 7 | import org.apache.commons.lang3.StringUtils; |
| 7 | 8 | ||
| @@ -164,6 +165,114 @@ public class SchedulePlanInfo { | @@ -164,6 +165,114 @@ public class SchedulePlanInfo { | ||
| 164 | 165 | ||
| 165 | public SchedulePlanInfo() {} | 166 | public SchedulePlanInfo() {} |
| 166 | 167 | ||
| 168 | + // 对应班车套跑 | ||
| 169 | + public void setRerunInfoDybc(RerunRule_input rerunRule_input) { | ||
| 170 | + this.cl = rerunRule_input.getCl(); | ||
| 171 | + this.clZbh = rerunRule_input.getZbh(); | ||
| 172 | + this.j = rerunRule_input.getJ(); | ||
| 173 | + this.jGh = rerunRule_input.getJgh(); | ||
| 174 | + this.jName = rerunRule_input.getJname(); | ||
| 175 | + this.s = rerunRule_input.getS(); | ||
| 176 | + this.sGh = rerunRule_input.getSgh(); | ||
| 177 | + this.sName = rerunRule_input.getSname(); | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + // 对应路牌套跑 | ||
| 181 | + public void setRerunInfoDylp(CarConfigInfo cc, List ec, String useType, String useHrType) { | ||
| 182 | + if ("hr".equals(useType)) { | ||
| 183 | + // 关联的驾驶员 | ||
| 184 | + EmployeeConfigInfo employeeConfigInfo = null; | ||
| 185 | + if ("all".equals(useHrType)) { | ||
| 186 | + employeeConfigInfo = (EmployeeConfigInfo) ec.get(0); | ||
| 187 | + } else if ("zb".equals(useHrType)) { | ||
| 188 | + employeeConfigInfo = (EmployeeConfigInfo) ec.get(0); | ||
| 189 | + } else if ("wb".equals(useHrType)) { | ||
| 190 | + if (ec.size() > 1) { | ||
| 191 | + employeeConfigInfo = (EmployeeConfigInfo) ec.get(1); | ||
| 192 | + } else { | ||
| 193 | + employeeConfigInfo = (EmployeeConfigInfo) ec.get(0); | ||
| 194 | + } | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + this.j = employeeConfigInfo.getJsy().getId(); | ||
| 198 | +// this.jGh = employeeConfigInfo.getJsy().getJobCode(); | ||
| 199 | + if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) { | ||
| 200 | + String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-"); | ||
| 201 | + if (jsy_temp.length > 1) { | ||
| 202 | + this.jGh = jsy_temp[1]; | ||
| 203 | + } else { | ||
| 204 | + this.jGh = jsy_temp[0]; | ||
| 205 | + } | ||
| 206 | + } | ||
| 207 | + this.jName = employeeConfigInfo.getJsy().getPersonnelName(); | ||
| 208 | + // 关联的售票员 | ||
| 209 | + if (employeeConfigInfo.getSpy() != null) { | ||
| 210 | + this.s = employeeConfigInfo.getSpy().getId(); | ||
| 211 | +// this.sGh = employeeConfigInfo.getSpy().getJobCode(); | ||
| 212 | + if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) { | ||
| 213 | + String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-"); | ||
| 214 | + if (spy_temp.length > 1) { | ||
| 215 | + this.sGh = spy_temp[1]; | ||
| 216 | + } else { | ||
| 217 | + this.sGh = spy_temp[0]; | ||
| 218 | + } | ||
| 219 | + } | ||
| 220 | + | ||
| 221 | + this.sName = employeeConfigInfo.getSpy().getPersonnelName(); | ||
| 222 | + } | ||
| 223 | + } else if ("hc".equals(useType)) { | ||
| 224 | + // 关联的车辆信息 | ||
| 225 | + this.cl = cc.getCl().getId(); // 车辆id | ||
| 226 | + this.clZbh = cc.getCl().getInsideCode(); // 自编号/内部编号 | ||
| 227 | + } else { // 所有的 | ||
| 228 | + // 关联的车辆信息 | ||
| 229 | + this.cl = cc.getCl().getId(); // 车辆id | ||
| 230 | + this.clZbh = cc.getCl().getInsideCode(); // 自编号/内部编号 | ||
| 231 | + | ||
| 232 | + // 关联的驾驶员 | ||
| 233 | + EmployeeConfigInfo employeeConfigInfo = null; | ||
| 234 | + if ("all".equals(useHrType)) { | ||
| 235 | + employeeConfigInfo = (EmployeeConfigInfo) ec.get(0); | ||
| 236 | + } else if ("zb".equals(useHrType)) { | ||
| 237 | + employeeConfigInfo = (EmployeeConfigInfo) ec.get(0); | ||
| 238 | + } else if ("wb".equals(useHrType)) { | ||
| 239 | + if (ec.size() > 1) { | ||
| 240 | + employeeConfigInfo = (EmployeeConfigInfo) ec.get(1); | ||
| 241 | + } else { | ||
| 242 | + employeeConfigInfo = (EmployeeConfigInfo) ec.get(0); | ||
| 243 | + } | ||
| 244 | + } | ||
| 245 | + | ||
| 246 | + this.j = employeeConfigInfo.getJsy().getId(); | ||
| 247 | +// this.jGh = employeeConfigInfo.getJsy().getJobCode(); | ||
| 248 | + if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) { | ||
| 249 | + String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-"); | ||
| 250 | + if (jsy_temp.length > 1) { | ||
| 251 | + this.jGh = jsy_temp[1]; | ||
| 252 | + } else { | ||
| 253 | + this.jGh = jsy_temp[0]; | ||
| 254 | + } | ||
| 255 | + } | ||
| 256 | + this.jName = employeeConfigInfo.getJsy().getPersonnelName(); | ||
| 257 | + // 关联的售票员 | ||
| 258 | + if (employeeConfigInfo.getSpy() != null) { | ||
| 259 | + this.s = employeeConfigInfo.getSpy().getId(); | ||
| 260 | +// this.sGh = employeeConfigInfo.getSpy().getJobCode(); | ||
| 261 | + if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) { | ||
| 262 | + String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-"); | ||
| 263 | + if (spy_temp.length > 1) { | ||
| 264 | + this.sGh = spy_temp[1]; | ||
| 265 | + } else { | ||
| 266 | + this.sGh = spy_temp[0]; | ||
| 267 | + } | ||
| 268 | + } | ||
| 269 | + | ||
| 270 | + this.sName = employeeConfigInfo.getSpy().getPersonnelName(); | ||
| 271 | + } | ||
| 272 | + } | ||
| 273 | + | ||
| 274 | + } | ||
| 275 | + | ||
| 167 | public SchedulePlanInfo( | 276 | public SchedulePlanInfo( |
| 168 | Line xl, | 277 | Line xl, |
| 169 | ScheduleResult_output scheduleResult_output, | 278 | ScheduleResult_output scheduleResult_output, |
src/main/java/com/bsth/entity/schedule/rule/RerunRule.java
| @@ -53,7 +53,7 @@ public class RerunRule extends BEntity { | @@ -53,7 +53,7 @@ public class RerunRule extends BEntity { | ||
| 53 | private GuideboardInfo rerunLp; | 53 | private GuideboardInfo rerunLp; |
| 54 | /** 套跑班次(时刻表明细ids,使用逗号连接) */ | 54 | /** 套跑班次(时刻表明细ids,使用逗号连接) */ |
| 55 | private String rerunTtinfodetailIds; | 55 | private String rerunTtinfodetailIds; |
| 56 | - /** 套跑班次(对应具体班次的发车时间,使用逗号连接,重复的时间会去除) */ | 56 | + /** 套跑班次(对应具体班次的发车时间,使用逗号连接) */ |
| 57 | private String rerunTtinfodetailFcsjs; | 57 | private String rerunTtinfodetailFcsjs; |
| 58 | 58 | ||
| 59 | 59 | ||
| @@ -68,15 +68,30 @@ public class RerunRule extends BEntity { | @@ -68,15 +68,30 @@ public class RerunRule extends BEntity { | ||
| 68 | /** 使用路牌 */ | 68 | /** 使用路牌 */ |
| 69 | @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY) | 69 | @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY) |
| 70 | private GuideboardInfo useLp; | 70 | private GuideboardInfo useLp; |
| 71 | + /** 对应路牌替换类型,hr;换人,hc:换车,all:换人换车 */ | ||
| 72 | + private String useType; | ||
| 73 | + /** 使用换人类型(zb:早班的人,wb:晚班的人,all:不分早晚班) */ | ||
| 74 | + private String useHrtype; | ||
| 71 | 75 | ||
| 72 | //--------- 对应班车 ----------/ | 76 | //--------- 对应班车 ----------/ |
| 73 | /** 车辆配置 */ | 77 | /** 车辆配置 */ |
| 74 | @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY) | 78 | @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY) |
| 75 | private CarConfigInfo useCarConfig; | 79 | private CarConfigInfo useCarConfig; |
| 80 | + | ||
| 81 | + private Integer cl; // 冗余字段(车辆id) | ||
| 82 | + private String clZbh; // 冗余字段(车辆自编号) | ||
| 83 | + | ||
| 76 | /** 人员配置 */ | 84 | /** 人员配置 */ |
| 77 | @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY) | 85 | @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY) |
| 78 | private EmployeeConfigInfo useEmployeeConfig; | 86 | private EmployeeConfigInfo useEmployeeConfig; |
| 79 | 87 | ||
| 88 | + private Integer j; // 冗余字段(驾驶员Id) | ||
| 89 | + private String jGh; // 冗余字段(驾驶员工号) | ||
| 90 | + private String jName; // 冗余字段(驾驶员姓名) | ||
| 91 | + private Integer s; // 冗余字段(售票员Id) | ||
| 92 | + private String sGh; // 冗余字段(售票员工号) | ||
| 93 | + private String sName; // 冗余字段(售票员姓名) | ||
| 94 | + | ||
| 80 | /** 是否删除(标记) */ | 95 | /** 是否删除(标记) */ |
| 81 | @Column(nullable = false) | 96 | @Column(nullable = false) |
| 82 | private Boolean isCancel = false; | 97 | private Boolean isCancel = false; |
| @@ -176,4 +191,84 @@ public class RerunRule extends BEntity { | @@ -176,4 +191,84 @@ public class RerunRule extends BEntity { | ||
| 176 | public void setRerunTtinfodetailFcsjs(String rerunTtinfodetailFcsjs) { | 191 | public void setRerunTtinfodetailFcsjs(String rerunTtinfodetailFcsjs) { |
| 177 | this.rerunTtinfodetailFcsjs = rerunTtinfodetailFcsjs; | 192 | this.rerunTtinfodetailFcsjs = rerunTtinfodetailFcsjs; |
| 178 | } | 193 | } |
| 194 | + | ||
| 195 | + public Integer getCl() { | ||
| 196 | + return cl; | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + public void setCl(Integer cl) { | ||
| 200 | + this.cl = cl; | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + public String getClZbh() { | ||
| 204 | + return clZbh; | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + public void setClZbh(String clZbh) { | ||
| 208 | + this.clZbh = clZbh; | ||
| 209 | + } | ||
| 210 | + | ||
| 211 | + public Integer getJ() { | ||
| 212 | + return j; | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + public void setJ(Integer j) { | ||
| 216 | + this.j = j; | ||
| 217 | + } | ||
| 218 | + | ||
| 219 | + public String getjGh() { | ||
| 220 | + return jGh; | ||
| 221 | + } | ||
| 222 | + | ||
| 223 | + public void setjGh(String jGh) { | ||
| 224 | + this.jGh = jGh; | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + public String getjName() { | ||
| 228 | + return jName; | ||
| 229 | + } | ||
| 230 | + | ||
| 231 | + public void setjName(String jName) { | ||
| 232 | + this.jName = jName; | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + public Integer getS() { | ||
| 236 | + return s; | ||
| 237 | + } | ||
| 238 | + | ||
| 239 | + public void setS(Integer s) { | ||
| 240 | + this.s = s; | ||
| 241 | + } | ||
| 242 | + | ||
| 243 | + public String getsGh() { | ||
| 244 | + return sGh; | ||
| 245 | + } | ||
| 246 | + | ||
| 247 | + public void setsGh(String sGh) { | ||
| 248 | + this.sGh = sGh; | ||
| 249 | + } | ||
| 250 | + | ||
| 251 | + public String getsName() { | ||
| 252 | + return sName; | ||
| 253 | + } | ||
| 254 | + | ||
| 255 | + public void setsName(String sName) { | ||
| 256 | + this.sName = sName; | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + public String getUseType() { | ||
| 260 | + return useType; | ||
| 261 | + } | ||
| 262 | + | ||
| 263 | + public void setUseType(String useType) { | ||
| 264 | + this.useType = useType; | ||
| 265 | + } | ||
| 266 | + | ||
| 267 | + public String getUseHrtype() { | ||
| 268 | + return useHrtype; | ||
| 269 | + } | ||
| 270 | + | ||
| 271 | + public void setUseHrtype(String useHrtype) { | ||
| 272 | + this.useHrtype = useHrtype; | ||
| 273 | + } | ||
| 179 | } | 274 | } |
src/main/java/com/bsth/entity/schedule/rule/ScheduleRule1Flat.java
| @@ -76,6 +76,10 @@ public class ScheduleRule1Flat extends BEntity { | @@ -76,6 +76,10 @@ public class ScheduleRule1Flat extends BEntity { | ||
| 76 | /** 翻班格式(类似格式:1110011)*/ | 76 | /** 翻班格式(类似格式:1110011)*/ |
| 77 | private String fbgs; | 77 | private String fbgs; |
| 78 | 78 | ||
| 79 | + /** 备注 */ | ||
| 80 | + @Column(length = 1000) | ||
| 81 | + private String remark; | ||
| 82 | + | ||
| 79 | public Long getId() { | 83 | public Long getId() { |
| 80 | return id; | 84 | return id; |
| 81 | } | 85 | } |
| @@ -164,4 +168,11 @@ public class ScheduleRule1Flat extends BEntity { | @@ -164,4 +168,11 @@ public class ScheduleRule1Flat extends BEntity { | ||
| 164 | this.fbgs = fbgs; | 168 | this.fbgs = fbgs; |
| 165 | } | 169 | } |
| 166 | 170 | ||
| 171 | + public String getRemark() { | ||
| 172 | + return remark; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + public void setRemark(String remark) { | ||
| 176 | + this.remark = remark; | ||
| 177 | + } | ||
| 167 | } | 178 | } |
src/main/java/com/bsth/entity/schedule/temp/SchedulePlanRuleResult.java
| @@ -3,6 +3,8 @@ package com.bsth.entity.schedule.temp; | @@ -3,6 +3,8 @@ package com.bsth.entity.schedule.temp; | ||
| 3 | import com.bsth.entity.schedule.SchedulePlan; | 3 | import com.bsth.entity.schedule.SchedulePlan; |
| 4 | 4 | ||
| 5 | import javax.persistence.*; | 5 | import javax.persistence.*; |
| 6 | +import java.sql.PreparedStatement; | ||
| 7 | +import java.sql.SQLException; | ||
| 6 | import java.util.Date; | 8 | import java.util.Date; |
| 7 | 9 | ||
| 8 | /** | 10 | /** |
| @@ -72,6 +74,38 @@ public class SchedulePlanRuleResult { | @@ -72,6 +74,38 @@ public class SchedulePlanRuleResult { | ||
| 72 | this.createDate = new Date(); | 74 | this.createDate = new Date(); |
| 73 | } | 75 | } |
| 74 | 76 | ||
| 77 | + public static String generateInsertSql() { | ||
| 78 | + String sql = "insert into bsth_c_s_sp_rule_rst" + | ||
| 79 | + "(xl_id,xl_name,rule_id,cc_id,cc_zbh," + | ||
| 80 | + "gids,gnames,gidindex,ecids,ecdbbms,ecindex," + | ||
| 81 | + "ttinfo_id,ttinfo_name,schedule_date," + | ||
| 82 | + "sysuser_id,sysuser_name,create_date) " + | ||
| 83 | + "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; | ||
| 84 | + | ||
| 85 | + return sql; | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + public void preparedStatementSet(PreparedStatement ps) throws SQLException { | ||
| 89 | + ps.setInt(1, this.getXlId()); | ||
| 90 | + ps.setString(2, this.getXlName()); | ||
| 91 | + ps.setString(3, this.getRuleId()); | ||
| 92 | + ps.setString(4, this.getCcId()); | ||
| 93 | + ps.setString(5, this.getCcZbh()); | ||
| 94 | + ps.setString(6, this.getGids()); | ||
| 95 | + ps.setString(7, this.getGnames()); | ||
| 96 | + ps.setString(8, this.getGidindex()); | ||
| 97 | + ps.setString(9, this.getEcids()); | ||
| 98 | + ps.setString(10, this.getEcdbbms()); | ||
| 99 | + ps.setString(11, this.getEcindex()); | ||
| 100 | + ps.setString(12, this.getTtinfoId()); | ||
| 101 | + ps.setString(13, this.getTtinfoName()); | ||
| 102 | + ps.setDate(14, new java.sql.Date(this.getScheduleDate().getTime())); | ||
| 103 | + ps.setString(15, this.getSysuserId()); | ||
| 104 | + ps.setString(16, this.getSysuserName()); | ||
| 105 | + ps.setTimestamp(17, new java.sql.Timestamp(this.getCreateDate().getTime())); | ||
| 106 | + | ||
| 107 | + } | ||
| 108 | + | ||
| 75 | public Long getId() { | 109 | public Long getId() { |
| 76 | return id; | 110 | return id; |
| 77 | } | 111 | } |
src/main/java/com/bsth/repository/SectionRouteRepository.java
| @@ -65,7 +65,7 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int | @@ -65,7 +65,7 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int | ||
| 65 | " b.section_distance AS sectionDistance," + | 65 | " b.section_distance AS sectionDistance," + |
| 66 | " b.section_time AS sectionTime," + | 66 | " b.section_time AS sectionTime," + |
| 67 | " b.db_type AS sectiondbType," + | 67 | " b.db_type AS sectiondbType," + |
| 68 | - " b.speed_limit AS sectionSpeedLimet ,a.destroy,a.versions,a.descriptions FROM (" + | 68 | + " b.speed_limit AS sectionSpeedLimet ,a.destroy,a.versions,a.descriptions,a.isRoadeSpeed FROM (" + |
| 69 | "SELECT r.id AS sectionrouteId," + | 69 | "SELECT r.id AS sectionrouteId," + |
| 70 | "r.line AS sectionrouteLine," + | 70 | "r.line AS sectionrouteLine," + |
| 71 | "r.line_code AS sectionrouteLineCode," + | 71 | "r.line_code AS sectionrouteLineCode," + |
| @@ -75,7 +75,7 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int | @@ -75,7 +75,7 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int | ||
| 75 | "r.directions AS sectionrouteDirections," + | 75 | "r.directions AS sectionrouteDirections," + |
| 76 | "r.destroy AS destroy," + | 76 | "r.destroy AS destroy," + |
| 77 | "r.versions AS versions," + | 77 | "r.versions AS versions," + |
| 78 | - "r.descriptions AS descriptions" + | 78 | + "r.descriptions AS descriptions, r.is_roade_speed AS isRoadeSpeed" + |
| 79 | " FROM bsth_c_sectionroute r where r.line = ?1 and r.directions = ?2 and r.destroy=0 ) a " + | 79 | " FROM bsth_c_sectionroute r where r.line = ?1 and r.directions = ?2 and r.destroy=0 ) a " + |
| 80 | " LEFT JOIN bsth_c_section b ON a.sectionrouteSection = b.id order by a.sectionrouteCode asc", nativeQuery=true) | 80 | " LEFT JOIN bsth_c_section b ON a.sectionrouteSection = b.id order by a.sectionrouteCode asc", nativeQuery=true) |
| 81 | List<Object[]> getSectionRoute(int lineId, int directions); | 81 | List<Object[]> getSectionRoute(int lineId, int directions); |
| @@ -147,7 +147,7 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int | @@ -147,7 +147,7 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int | ||
| 147 | * | 147 | * |
| 148 | * @return List<Map<String, Object>> | 148 | * @return List<Map<String, Object>> |
| 149 | */ | 149 | */ |
| 150 | - @Query(value = " select MAX(r.sectionroute_code) as sectionrouteCode from bsth_c_sectionroute r WHERE r.line=?1 and r.directions =?2 and r.sectionroute_code< ?3", nativeQuery=true) | 150 | + @Query(value = " select MAX(r.sectionroute_code) as sectionrouteCode from bsth_c_sectionroute r WHERE r.line=?1 and r.directions =?2 and r.sectionroute_code< ?3 and r.destroy = 0", nativeQuery=true) |
| 151 | List<Object[]> findUpSectionRouteCode(Integer lineId,Integer direction,Integer stationRouteCode); | 151 | List<Object[]> findUpSectionRouteCode(Integer lineId,Integer direction,Integer stationRouteCode); |
| 152 | 152 | ||
| 153 | /** | 153 | /** |
src/main/java/com/bsth/repository/StationRepository.java
| @@ -37,9 +37,15 @@ public interface StationRepository extends BaseRepository<Station, Integer> { | @@ -37,9 +37,15 @@ public interface StationRepository extends BaseRepository<Station, Integer> { | ||
| 37 | , nativeQuery=true) | 37 | , nativeQuery=true) |
| 38 | long stationMaxId(); | 38 | long stationMaxId(); |
| 39 | 39 | ||
| 40 | - @Query(value = "SELECT s.b_jwpoints,s.id FROM bsth_c_station s where s.station_name like ?1" | 40 | + /*@Query(value = "SELECT s.b_jwpoints,s.id FROM bsth_c_station s where s.station_name like ?1" |
| 41 | , nativeQuery=true) | 41 | , nativeQuery=true) |
| 42 | - List<Object[]> findStationName(String stationName); | 42 | + List<Object[]> findStationName(String stationName);*/ |
| 43 | + @Query(value = " SELECT t.b_jwpoints,t.id FROM (" + | ||
| 44 | + " SELECT b.id,b.b_jwpoints,b.station_name,a.directions FROM (" + | ||
| 45 | + " SELECT s.station,s.station_name,s.directions FROM bsth_c_stationroute s where s.destroy = 0 and s.directions = ?1) a " + | ||
| 46 | + " LEFT JOIN bsth_c_station b on a.station = b. id) t where t.station_name LIKE ?2" | ||
| 47 | + , nativeQuery=true) | ||
| 48 | + List<Object[]> findStationName(Integer dir , String stationName); | ||
| 43 | 49 | ||
| 44 | /** | 50 | /** |
| 45 | * @Description :TODO(站点保存) | 51 | * @Description :TODO(站点保存) |
src/main/java/com/bsth/repository/StationRouteRepository.java
| @@ -99,7 +99,7 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | @@ -99,7 +99,7 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | ||
| 99 | @Query(value = "select t.station_route_code,t.station_mark from bsth_c_stationroute t where " + | 99 | @Query(value = "select t.station_route_code,t.station_mark from bsth_c_stationroute t where " + |
| 100 | " t.station_route_code =(" + | 100 | " t.station_route_code =(" + |
| 101 | "select MAX(station_route_code) as stationRouteCode from bsth_c_stationroute r WHERE " + | 101 | "select MAX(station_route_code) as stationRouteCode from bsth_c_stationroute r WHERE " + |
| 102 | - "r.line=?1 and r.directions =?2 and station_route_code< ?3 ) and t.line=?1 and t.directions = ?2", nativeQuery=true) | 102 | + "r.line=?1 and r.directions =?2 and station_route_code< ?3 and r.destroy = 0 ) and t.line=?1 and t.directions = ?2 AND t.destroy = 0", nativeQuery=true) |
| 103 | List<Object[]> findUpStationRouteCode(Integer lineId,Integer direction,Integer stationRouteCode); | 103 | List<Object[]> findUpStationRouteCode(Integer lineId,Integer direction,Integer stationRouteCode); |
| 104 | 104 | ||
| 105 | 105 | ||
| @@ -206,7 +206,7 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | @@ -206,7 +206,7 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | ||
| 206 | " b.create_date AS stationCreateDate," + | 206 | " b.create_date AS stationCreateDate," + |
| 207 | " b.update_by AS stationUpdateBy," + | 207 | " b.update_by AS stationUpdateBy," + |
| 208 | " b.update_date AS stationUpdateDate," + | 208 | " b.update_date AS stationUpdateDate," + |
| 209 | - " a.stationRouteId"+ | 209 | + " a.stationRouteId,b.station_name as zdmc "+ |
| 210 | " FROM ( SELECT s.id AS stationRouteId," + | 210 | " FROM ( SELECT s.id AS stationRouteId," + |
| 211 | " s.line AS stationRouteLine," + | 211 | " s.line AS stationRouteLine," + |
| 212 | " s.station as stationRouteStation," + | 212 | " s.station as stationRouteStation," + |
| @@ -276,4 +276,8 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | @@ -276,4 +276,8 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | ||
| 276 | @Modifying | 276 | @Modifying |
| 277 | @Query(value="update bsth_c_stationroute set distances =?2 where id = ?1 ", nativeQuery=true) | 277 | @Query(value="update bsth_c_stationroute set distances =?2 where id = ?1 ", nativeQuery=true) |
| 278 | public void upddis(Integer id,Double dis); | 278 | public void upddis(Integer id,Double dis); |
| 279 | + | ||
| 280 | + @Modifying | ||
| 281 | + @Query(value="UPDATE bsth_c_stationroute set station_route_code = (station_route_code+10) where line = ?1 and directions = ?2 and station_route_code >=?3 and destroy = 0", nativeQuery=true) | ||
| 282 | + public void stationUpdStationRouteCode(Integer line,Integer dir,Integer routeCod); | ||
| 279 | } | 283 | } |
src/main/java/com/bsth/repository/oil/YlbRepository.java
| @@ -27,6 +27,29 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | @@ -27,6 +27,29 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | ||
| 27 | + " xlbm like %?4% and nbbm like %?5% ",nativeQuery=true) | 27 | + " xlbm like %?4% and nbbm like %?5% ",nativeQuery=true) |
| 28 | List<Ylb> obtainYlbefore(String rq,String gsbm,String fgsbm,String xlbm,String nbbm); | 28 | List<Ylb> obtainYlbefore(String rq,String gsbm,String fgsbm,String xlbm,String nbbm); |
| 29 | 29 | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 获取当天日期前的最大的日期中最大进出顺序的数据 | ||
| 33 | + * | ||
| 34 | + */ | ||
| 35 | + @Transactional | ||
| 36 | + @Modifying | ||
| 37 | + @Query(value="select y.* from (select max(d.id) as id ,d.nbbm from (" | ||
| 38 | + + " select b.rq,b.nbbm,max(b.jcsx) as jcsx from (" | ||
| 39 | + + " select max(t.rq) as rq ,t.nbbm from bsth_c_ylb t " | ||
| 40 | + + " where to_days(t.rq)< to_days(?1) " | ||
| 41 | + + " and t.ssgsdm like %?2% and t.fgsdm like %?3% " | ||
| 42 | + + " and t.xlbm like %?4% and t.nbbm like %?5% group by nbbm ) a " | ||
| 43 | + + " left join bsth_c_ylb b on a.rq=b.rq and a.nbbm=b.nbbm " | ||
| 44 | + + " where b.ssgsdm like %?2% and b.fgsdm like %?3% and " | ||
| 45 | + + " b.xlbm like %?4% and b.nbbm like %?5% group by b.rq,b.nbbm) c" | ||
| 46 | + + " left join bsth_c_ylb d on c.rq=d.rq and c.nbbm=d.nbbm and c.jcsx=d.jcsx " | ||
| 47 | + + " where d.ssgsdm like %?2% and d.fgsdm like %?3% and d.xlbm like %?4% " | ||
| 48 | + + " and d.nbbm like %?5% group by d.nbbm) x left join " | ||
| 49 | + + " bsth_c_ylb y on x.id=y.id where y.ssgsdm like %?2% and y.fgsdm like %?3% " | ||
| 50 | + + " and y.xlbm like %?4% and y.nbbm like %?5%",nativeQuery=true) | ||
| 51 | + List<Ylb> listMaxRqJcsx(String rq,String gsbm,String fgsbm,String xlbm,String nbbm); | ||
| 52 | + | ||
| 30 | /** | 53 | /** |
| 31 | * 当天YLB信息 | 54 | * 当天YLB信息 |
| 32 | * @param rq | 55 | * @param rq |
| @@ -56,8 +79,8 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | @@ -56,8 +79,8 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | ||
| 56 | */ | 79 | */ |
| 57 | @Transactional | 80 | @Transactional |
| 58 | @Modifying | 81 | @Modifying |
| 59 | - @Query(value="select ifnull(jzl,0),ifnull(zlc,0),ifnull(sh,0) from bsth_c_ylb where nbbm=?1 and rq=?2 and xlbm like %?3%",nativeQuery=true) | ||
| 60 | - List<Object[]> sumLcYl(String nbbm,Date rq,String xlbm); | 82 | + @Query(value="select ifnull(jzl,0),ifnull(zlc,0),ifnull(sh,0) from bsth_c_ylb where nbbm=?1 and rq=?2 and xlbm like %?3% and ssgsdm like %?4% and fgsdm like %?5%",nativeQuery=true) |
| 83 | + List<Object[]> sumLcYl(String nbbm,Date rq,String xlbm,String fgsbm,String gsbm); | ||
| 61 | 84 | ||
| 62 | /** | 85 | /** |
| 63 | * | 86 | * |
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
| @@ -133,7 +133,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | @@ -133,7 +133,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | ||
| 133 | 133 | ||
| 134 | //去掉了 xlBm is not null | 134 | //去掉了 xlBm is not null |
| 135 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | 135 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 136 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.realExecDate,s.dfsj, (s.lpName+1)") | 136 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.xlDir,s.realExecDate,s.dfsj, (s.lpName+1)") |
| 137 | List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date); | 137 | List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date); |
| 138 | 138 | ||
| 139 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | 139 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| @@ -164,8 +164,8 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | @@ -164,8 +164,8 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | ||
| 164 | List<ScheduleRealInfo> scheduleByDateAndLineYbb(String line,String date,String date2); | 164 | List<ScheduleRealInfo> scheduleByDateAndLineYbb(String line,String date,String date2); |
| 165 | 165 | ||
| 166 | 166 | ||
| 167 | - @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,min(s.fcsj) as fcsj ) from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% GROUP BY xlBm,clZbh,jGh,scheduleDate,jGh ORDER BY clZbh,fcsj") | ||
| 168 | - List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm); | 167 | + @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,min(s.fcsj) as fcsj ) from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate,jGh ORDER BY clZbh,fcsj") |
| 168 | + List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm,String nbbm); | ||
| 169 | 169 | ||
| 170 | @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 ORDER BY xlBm,lpName,clZbh,xlDir") | 170 | @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 ORDER BY xlBm,lpName,clZbh,xlDir") |
| 171 | List<ScheduleRealInfo> setLD(String date); | 171 | List<ScheduleRealInfo> setLD(String date); |
src/main/java/com/bsth/security/WebSecurityConfig.java
| @@ -36,7 +36,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | @@ -36,7 +36,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | ||
| 36 | public void configure(WebSecurity web) throws Exception { | 36 | public void configure(WebSecurity web) throws Exception { |
| 37 | // 白名单 | 37 | // 白名单 |
| 38 | web.ignoring().antMatchers(Constants.LOGIN_PAGE, Constants.LOGIN, Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.CAPTCHA, | 38 | web.ignoring().antMatchers(Constants.LOGIN_PAGE, Constants.LOGIN, Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.CAPTCHA, |
| 39 | - Constants.SERVICE_INTERFACE, Constants.METRONIC_URL, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS); | 39 | + Constants.SERVICE_INTERFACE, Constants.METRONIC_URL, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | @Override | 42 | @Override |
src/main/java/com/bsth/security/filter/LoginInterceptor.java
| @@ -3,10 +3,11 @@ package com.bsth.security.filter; | @@ -3,10 +3,11 @@ package com.bsth.security.filter; | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import com.bsth.common.Constants; | 4 | import com.bsth.common.Constants; |
| 5 | import com.bsth.common.ResponseCode; | 5 | import com.bsth.common.ResponseCode; |
| 6 | -import com.bsth.filter.BaseFilter; | ||
| 7 | import com.bsth.util.RequestUtils; | 6 | import com.bsth.util.RequestUtils; |
| 8 | import org.springframework.security.core.Authentication; | 7 | import org.springframework.security.core.Authentication; |
| 9 | import org.springframework.security.core.context.SecurityContextHolder; | 8 | import org.springframework.security.core.context.SecurityContextHolder; |
| 9 | +import org.springframework.util.AntPathMatcher; | ||
| 10 | +import org.springframework.util.PathMatcher; | ||
| 10 | 11 | ||
| 11 | import javax.servlet.*; | 12 | import javax.servlet.*; |
| 12 | import javax.servlet.http.HttpServletRequest; | 13 | import javax.servlet.http.HttpServletRequest; |
| @@ -23,40 +24,67 @@ import java.util.Map; | @@ -23,40 +24,67 @@ import java.util.Map; | ||
| 23 | * @date 2016年3月24日 上午11:49:20 | 24 | * @date 2016年3月24日 上午11:49:20 |
| 24 | * | 25 | * |
| 25 | */ | 26 | */ |
| 26 | -public class LoginInterceptor extends BaseFilter { | 27 | +public class LoginInterceptor implements Filter { |
| 28 | + | ||
| 29 | + private final PathMatcher pathMatcher = new AntPathMatcher(); | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 白名单 | ||
| 33 | + * 相比于 BaseFilter,此处对线调GPS请求进行了拦截验证 | ||
| 34 | + */ | ||
| 35 | + private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.SERVICE_INTERFACE, | ||
| 36 | + Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES }; | ||
| 37 | + | ||
| 27 | 38 | ||
| 28 | @Override | 39 | @Override |
| 29 | public void destroy() { | 40 | public void destroy() { |
| 30 | 41 | ||
| 31 | } | 42 | } |
| 32 | 43 | ||
| 44 | + | ||
| 33 | @Override | 45 | @Override |
| 34 | public void init(FilterConfig filterConfig) throws ServletException { | 46 | public void init(FilterConfig filterConfig) throws ServletException { |
| 35 | 47 | ||
| 36 | } | 48 | } |
| 37 | 49 | ||
| 38 | @Override | 50 | @Override |
| 39 | - public void doFilter(HttpServletRequest request, | ||
| 40 | - HttpServletResponse response, FilterChain chain) | ||
| 41 | - throws IOException, ServletException { | ||
| 42 | - Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); | ||
| 43 | - | ||
| 44 | - if(null == authentication){ | ||
| 45 | - //没有登录 | ||
| 46 | - | ||
| 47 | - if(RequestUtils.isAjaxRequest(request)){ | ||
| 48 | - Map<String, Object> map = new HashMap<>(); | ||
| 49 | - map.put("status", | ||
| 50 | - ResponseCode.NO_AUTHENTICATION); | ||
| 51 | - response.getWriter().print(JSON.toJSONString(map)); | ||
| 52 | - } | ||
| 53 | - else | ||
| 54 | - response.sendRedirect(Constants.LOGIN_PAGE); | 51 | + public void doFilter(ServletRequest request, ServletResponse response, |
| 52 | + FilterChain chain) throws IOException, ServletException { | ||
| 53 | + | ||
| 54 | + HttpServletRequest httpRequest = (HttpServletRequest) request; | ||
| 55 | + HttpServletResponse httpResponse = (HttpServletResponse) response; | ||
| 56 | + | ||
| 57 | + String currentURL = httpRequest.getServletPath(); | ||
| 58 | + | ||
| 59 | + if (!isWhiteURL(currentURL)) { | ||
| 60 | + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); | ||
| 55 | 61 | ||
| 56 | - return; | 62 | + if(null == authentication){ |
| 63 | + //没有登录 | ||
| 64 | + | ||
| 65 | + if(RequestUtils.isAjaxRequest(httpRequest)){ | ||
| 66 | + Map<String, Object> map = new HashMap<>(); | ||
| 67 | + map.put("status", | ||
| 68 | + ResponseCode.NO_AUTHENTICATION); | ||
| 69 | + response.getWriter().print(JSON.toJSONString(map)); | ||
| 70 | + } | ||
| 71 | + else | ||
| 72 | + httpResponse.sendRedirect(Constants.LOGIN_PAGE); | ||
| 73 | + | ||
| 74 | + return; | ||
| 75 | + } | ||
| 57 | } | 76 | } |
| 58 | 77 | ||
| 59 | chain.doFilter(request, response); | 78 | chain.doFilter(request, response); |
| 60 | } | 79 | } |
| 61 | 80 | ||
| 81 | + private boolean isWhiteURL(String currentURL) { | ||
| 82 | + for (String whiteURL : whiteListURLs) { | ||
| 83 | + if (pathMatcher.match(whiteURL, currentURL)) { | ||
| 84 | + return true; | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | + return false; | ||
| 88 | + } | ||
| 89 | + | ||
| 62 | } | 90 | } |
src/main/java/com/bsth/service/SectionRouteService.java
| @@ -22,6 +22,14 @@ import com.bsth.entity.SectionRoute; | @@ -22,6 +22,14 @@ import com.bsth.entity.SectionRoute; | ||
| 22 | */ | 22 | */ |
| 23 | public interface SectionRouteService extends BaseService<SectionRoute, Integer> { | 23 | public interface SectionRouteService extends BaseService<SectionRoute, Integer> { |
| 24 | 24 | ||
| 25 | + /** | ||
| 26 | + * | ||
| 27 | + * @Title: list | ||
| 28 | + * @Description: TODO(多条件查询) | ||
| 29 | + * @throws | ||
| 30 | + */ | ||
| 31 | + Iterable<SectionRoute> list(Map<String, Object> map); | ||
| 32 | + | ||
| 25 | List<Map<String, Object>> getSectionRoute(Map<String, Object> map); | 33 | List<Map<String, Object>> getSectionRoute(Map<String, Object> map); |
| 26 | 34 | ||
| 27 | /** | 35 | /** |
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
| @@ -766,7 +766,7 @@ public class FormsServiceImpl implements FormsService { | @@ -766,7 +766,7 @@ public class FormsServiceImpl implements FormsService { | ||
| 766 | + map.get("endDate").toString() + "' and xl_bm='" + map.get("line").toString() | 766 | + map.get("endDate").toString() + "' and xl_bm='" + map.get("line").toString() |
| 767 | + "' AND gs_bm is not null " | 767 | + "' AND gs_bm is not null " |
| 768 | + " AND bc_type NOT IN ('in', 'out')" | 768 | + " AND bc_type NOT IN ('in', 'out')" |
| 769 | - + "GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type) b ON t.company=b.gs_bm) b on " | 769 | + + "GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type) b ON t.company=b.gs_bm and t.branche_company = b.fgs_bm) b on " |
| 770 | + " a.gs_bm=b.gs_bm and a.fgs_bm=b.fgs_bm and a.xl_bm=b.xl_bm "; | 770 | + " a.gs_bm=b.gs_bm and a.fgs_bm=b.fgs_bm and a.xl_bm=b.xl_bm "; |
| 771 | List<Turnoutrate> list = jdbcTemplate.query(sql, new RowMapper<Turnoutrate>() { | 771 | List<Turnoutrate> list = jdbcTemplate.query(sql, new RowMapper<Turnoutrate>() { |
| 772 | 772 | ||
| @@ -775,21 +775,24 @@ public class FormsServiceImpl implements FormsService { | @@ -775,21 +775,24 @@ public class FormsServiceImpl implements FormsService { | ||
| 775 | Turnoutrate tu = new Turnoutrate(); | 775 | Turnoutrate tu = new Turnoutrate(); |
| 776 | NumberFormat numberFormat = NumberFormat.getInstance(); | 776 | NumberFormat numberFormat = NumberFormat.getInstance(); |
| 777 | numberFormat.setMaximumFractionDigits(2); | 777 | numberFormat.setMaximumFractionDigits(2); |
| 778 | - String result1 = numberFormat.format((float) Integer.parseInt(arg0.getString("scl")) | ||
| 779 | - / (float) Integer.parseInt(arg0.getString("jcl")) * 100); | ||
| 780 | - String result2 = numberFormat.format((float) Integer.parseInt(arg0.getString("sbc")) | ||
| 781 | - / (float) Integer.parseInt(arg0.getString("jbc")) * 100); | 778 | + int scl = arg0.getString("scl")!=null&&arg0.getString("scl").trim().length()!=0?Integer.parseInt(arg0.getString("scl")):0; |
| 779 | + int jcl = arg0.getString("jcl")!=null&&arg0.getString("jcl").trim().length()!=0?Integer.parseInt(arg0.getString("jcl")):0; | ||
| 780 | + int sbc = arg0.getString("sbc")!=null&&arg0.getString("sbc").trim().length()!=0?Integer.parseInt(arg0.getString("sbc")):0; | ||
| 781 | + int jbc = arg0.getString("jbc")!=null&&arg0.getString("jbc").trim().length()!=0?Integer.parseInt(arg0.getString("jbc")):0; | ||
| 782 | + String result1 = numberFormat.format((float) scl / (float) jcl * 100); | ||
| 783 | + String result2 = numberFormat.format((float) sbc / (float) jbc * 100); | ||
| 782 | tu.setRq(rq); | 784 | tu.setRq(rq); |
| 783 | tu.setGs(arg0.getString("gs_name").toString()); | 785 | tu.setGs(arg0.getString("gs_name").toString()); |
| 784 | tu.setZhgs(arg0.getString("fgs_name").toString()); | 786 | tu.setZhgs(arg0.getString("fgs_name").toString()); |
| 785 | - tu.setXl(arg0.getString("xlgs")); | ||
| 786 | - tu.setXlmc(arg0.getString("sxl")); | ||
| 787 | - tu.setCchjh(arg0.getString("jcl").toString()); | ||
| 788 | - tu.setCchsj(arg0.getString("scl").toString()); | ||
| 789 | - tu.setCchqz(arg0.getString("sxl").toString()); | 787 | +// tu.setXl(arg0.getString("xlgs")!=null&&arg0.getString("xlgs").trim().length()!=0?arg0.getString("xlgs"):"0"); |
| 788 | + tu.setXl(arg0.getString("jxl")!=null&&arg0.getString("jxl").trim().length()!=0?arg0.getString("jxl"):"0"); | ||
| 789 | + tu.setXlmc(arg0.getString("sxl")!=null&&arg0.getString("sxl").trim().length()!=0?arg0.getString("sxl"):"0"); | ||
| 790 | + tu.setCchjh("" + jcl); | ||
| 791 | + tu.setCchsj("" + scl); | ||
| 792 | + tu.setCchqz(arg0.getString("sxl")!=null&&arg0.getString("sxl").trim().length()!=0?arg0.getString("sxl"):"0"); | ||
| 790 | tu.setChl(result1 + "%");// 出车率 | 793 | tu.setChl(result1 + "%");// 出车率 |
| 791 | - tu.setBcjh(arg0.getString("jbc").toString()); | ||
| 792 | - tu.setBcsj(arg0.getString("sbc").toString()); | 794 | + tu.setBcjh("" + jbc); |
| 795 | + tu.setBcsj("" + sbc); | ||
| 793 | tu.setBbzxl(result2 + "%");// 班次执行率 | 796 | tu.setBbzxl(result2 + "%");// 班次执行率 |
| 794 | tu.setSm(arg0.getString("gs_name").toString()); | 797 | tu.setSm(arg0.getString("gs_name").toString()); |
| 795 | tu.setGsgs(arg0.getString("gslsbm").toString()); | 798 | tu.setGsgs(arg0.getString("gslsbm").toString()); |
| @@ -799,7 +802,6 @@ public class FormsServiceImpl implements FormsService { | @@ -799,7 +802,6 @@ public class FormsServiceImpl implements FormsService { | ||
| 799 | 802 | ||
| 800 | }); | 803 | }); |
| 801 | 804 | ||
| 802 | - | ||
| 803 | return list; | 805 | return list; |
| 804 | } | 806 | } |
| 805 | 807 | ||
| @@ -836,7 +838,7 @@ public class FormsServiceImpl implements FormsService { | @@ -836,7 +838,7 @@ public class FormsServiceImpl implements FormsService { | ||
| 836 | + "where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '" + map.get("startDate").toString() + "' and '" | 838 | + "where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '" + map.get("startDate").toString() + "' and '" |
| 837 | + map.get("endDate").toString() + "' and xl_bm='" + map.get("line").toString() | 839 | + map.get("endDate").toString() + "' and xl_bm='" + map.get("line").toString() |
| 838 | + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out') " | 840 | + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out') " |
| 839 | - + "GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type) b ON t.company=b.gs_bm) b on " | 841 | + + "GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type) b ON t.company=b.gs_bm and t.branche_company = b.fgs_bm) b on " |
| 840 | + " a.gs_bm=b.gs_bm and a.fgs_bm=b.fgs_bm and a.xl_bm=b.xl_bm "; | 842 | + " a.gs_bm=b.gs_bm and a.fgs_bm=b.fgs_bm and a.xl_bm=b.xl_bm "; |
| 841 | List<Executionrate> list = jdbcTemplate.query(sql, new RowMapper<Executionrate>() { | 843 | List<Executionrate> list = jdbcTemplate.query(sql, new RowMapper<Executionrate>() { |
| 842 | 844 | ||
| @@ -845,24 +847,27 @@ public class FormsServiceImpl implements FormsService { | @@ -845,24 +847,27 @@ public class FormsServiceImpl implements FormsService { | ||
| 845 | Executionrate tu = new Executionrate(); | 847 | Executionrate tu = new Executionrate(); |
| 846 | NumberFormat numberFormat = NumberFormat.getInstance(); | 848 | NumberFormat numberFormat = NumberFormat.getInstance(); |
| 847 | numberFormat.setMaximumFractionDigits(2); | 849 | numberFormat.setMaximumFractionDigits(2); |
| 848 | - String result1 = numberFormat.format((float) Integer.parseInt(arg0.getString("scl")) | ||
| 849 | - / (float) Integer.parseInt(arg0.getString("jcl")) * 100); | ||
| 850 | - String result2 = numberFormat.format((float) Integer.parseInt(arg0.getString("sbc")) | ||
| 851 | - / (float) Integer.parseInt(arg0.getString("jbc")) * 100); | 850 | + int scl = arg0.getString("scl")!=null&&arg0.getString("scl").trim().length()!=0?Integer.parseInt(arg0.getString("scl")):0; |
| 851 | + int jcl = arg0.getString("jcl")!=null&&arg0.getString("jcl").trim().length()!=0?Integer.parseInt(arg0.getString("jcl")):0; | ||
| 852 | + int sbc = arg0.getString("sbc")!=null&&arg0.getString("sbc").trim().length()!=0?Integer.parseInt(arg0.getString("sbc")):0; | ||
| 853 | + int jbc = arg0.getString("jbc")!=null&&arg0.getString("jbc").trim().length()!=0?Integer.parseInt(arg0.getString("jbc")):0; | ||
| 854 | + String result1 = numberFormat.format((float) scl / (float) jcl * 100); | ||
| 855 | + String result2 = numberFormat.format((float) sbc / (float) jbc * 100); | ||
| 852 | tu.setRq(rq); | 856 | tu.setRq(rq); |
| 853 | tu.setGs(arg0.getString("gs_name").toString()); | 857 | tu.setGs(arg0.getString("gs_name").toString()); |
| 854 | tu.setZhgs(arg0.getString("fgs_name").toString()); | 858 | tu.setZhgs(arg0.getString("fgs_name").toString()); |
| 855 | - tu.setXl(arg0.getString("xlgs"));//这个是根据公司判断线路有几条 | 859 | +// tu.setXl(arg0.getString("xlgs")!=null&&arg0.getString("xlgs").trim().length()!=0?arg0.getString("xlgs"):"0");//这个是根据公司判断线路有几条 |
| 860 | + tu.setXl(arg0.getString("jxl")!=null&&arg0.getString("jxl").trim().length()!=0?arg0.getString("jxl"):"0"); | ||
| 856 | //tu.setXl(arg0.getString("sxl")); | 861 | //tu.setXl(arg0.getString("sxl")); |
| 857 | - tu.setXlmc(arg0.getString("sxl")); | ||
| 858 | - tu.setCchjh(arg0.getString("jcl").toString()); | ||
| 859 | - tu.setCchsj(arg0.getString("scl").toString()); | ||
| 860 | - tu.setCchqz(arg0.getString("sxl").toString()); | 862 | + tu.setXlmc(arg0.getString("sxl")!=null&&arg0.getString("sxl").trim().length()!=0?arg0.getString("sxl"):"0"); |
| 863 | + tu.setCchjh("" + jcl); | ||
| 864 | + tu.setCchsj("" + scl); | ||
| 865 | + tu.setCchqz(arg0.getString("sxl")!=null&&arg0.getString("sxl").trim().length()!=0?arg0.getString("sxl"):"0"); | ||
| 861 | tu.setChl(result1 + "%");// 出车率 | 866 | tu.setChl(result1 + "%");// 出车率 |
| 862 | - tu.setBcjh(arg0.getString("jbc").toString()); | ||
| 863 | - tu.setBcsj(arg0.getString("sbc").toString()); | 867 | + tu.setBcjh("" + jbc); |
| 868 | + tu.setBcsj("" + sbc); | ||
| 864 | tu.setBbzxl(result2 + "%");// 班次执行率 | 869 | tu.setBbzxl(result2 + "%");// 班次执行率 |
| 865 | - tu.setSm(arg0.getString("xl_name").toString()); | 870 | + tu.setSm(arg0.getString("xl_name")); |
| 866 | tu.setGsgs(arg0.getString("gslsbm").toString()); | 871 | tu.setGsgs(arg0.getString("gslsbm").toString()); |
| 867 | tu.setFgsgs(arg0.getString("fgsbm").toString()); | 872 | tu.setFgsgs(arg0.getString("fgsbm").toString()); |
| 868 | return tu; | 873 | return tu; |
| @@ -910,8 +915,9 @@ public class FormsServiceImpl implements FormsService { | @@ -910,8 +915,9 @@ public class FormsServiceImpl implements FormsService { | ||
| 910 | + map.get("endDate").toString() + "' and xl_bm='" + map.get | 915 | + map.get("endDate").toString() + "' and xl_bm='" + map.get |
| 911 | ("line").toString() | 916 | ("line").toString() |
| 912 | + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out')" | 917 | + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out')" |
| 913 | - + "GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type) b ON t.company=b.gs_bm) b on " | 918 | + + "GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type) b ON t.company=b.gs_bm and t.branche_company = b.fgs_bm) b on " |
| 914 | + " a.gs_bm=b.gs_bm and a.fgs_bm=b.fgs_bm and a.xl_bm=b.xl_bm "; | 919 | + " a.gs_bm=b.gs_bm and a.fgs_bm=b.fgs_bm and a.xl_bm=b.xl_bm "; |
| 920 | + System.out.println(sql); | ||
| 915 | List<Allline> list = jdbcTemplate.query(sql, new RowMapper<Allline>() { | 921 | List<Allline> list = jdbcTemplate.query(sql, new RowMapper<Allline>() { |
| 916 | 922 | ||
| 917 | @Override | 923 | @Override |
| @@ -919,28 +925,30 @@ public class FormsServiceImpl implements FormsService { | @@ -919,28 +925,30 @@ public class FormsServiceImpl implements FormsService { | ||
| 919 | Allline tu = new Allline(); | 925 | Allline tu = new Allline(); |
| 920 | NumberFormat numberFormat = NumberFormat.getInstance(); | 926 | NumberFormat numberFormat = NumberFormat.getInstance(); |
| 921 | numberFormat.setMaximumFractionDigits(2); | 927 | numberFormat.setMaximumFractionDigits(2); |
| 922 | - String result1 = numberFormat.format((float) Integer.parseInt(arg0.getString("scl")) | ||
| 923 | - / (float) Integer.parseInt(arg0.getString("jcl")) * 100); | ||
| 924 | - String result2 = numberFormat.format((float) Integer.parseInt(arg0.getString("sbc")) | ||
| 925 | - / (float) Integer.parseInt(arg0.getString("jbc")) * 100); | 928 | + int scl = arg0.getString("scl")!=null&&arg0.getString("scl").trim().length()!=0?Integer.parseInt(arg0.getString("scl")):0; |
| 929 | + int jcl = arg0.getString("jcl")!=null&&arg0.getString("jcl").trim().length()!=0?Integer.parseInt(arg0.getString("jcl")):0; | ||
| 930 | + int sbc = arg0.getString("sbc")!=null&&arg0.getString("sbc").trim().length()!=0?Integer.parseInt(arg0.getString("sbc")):0; | ||
| 931 | + int jbc = arg0.getString("jbc")!=null&&arg0.getString("jbc").trim().length()!=0?Integer.parseInt(arg0.getString("jbc")):0; | ||
| 932 | + String result1 = numberFormat.format((float) scl / (float) jcl * 100); | ||
| 933 | + String result2 = numberFormat.format((float) sbc / (float) jbc * 100); | ||
| 926 | tu.setRq(rq); | 934 | tu.setRq(rq); |
| 927 | tu.setGs(arg0.getString("gs_name").toString()); | 935 | tu.setGs(arg0.getString("gs_name").toString()); |
| 928 | tu.setZhgs(arg0.getString("fgs_name").toString()); | 936 | tu.setZhgs(arg0.getString("fgs_name").toString()); |
| 929 | tu.setXl(arg0.getString("xl_name")); | 937 | tu.setXl(arg0.getString("xl_name")); |
| 930 | - tu.setXlmc(arg0.getString("sxl")); | ||
| 931 | - tu.setCchjh(arg0.getString("jcl").toString()); | ||
| 932 | - tu.setCchsj(arg0.getString("scl").toString()); | ||
| 933 | - tu.setCchqz(arg0.getString("sxl").toString()); | 938 | + tu.setXlmc(arg0.getString("sxl")!=null&&arg0.getString("sxl").trim().length()!=0?arg0.getString("sxl"):"0"); |
| 939 | + tu.setCchjh("" + jcl); | ||
| 940 | + tu.setCchsj("" + scl); | ||
| 941 | + tu.setCchqz(arg0.getString("sxl")!=null&&arg0.getString("sxl").trim().length()!=0?arg0.getString("sxl"):"0"); | ||
| 934 | tu.setChl(result1 + "%");// 出车率 | 942 | tu.setChl(result1 + "%");// 出车率 |
| 935 | - tu.setBcjh(arg0.getString("jbc").toString()); | ||
| 936 | - tu.setBcsj(arg0.getString("sbc").toString()); | 943 | + tu.setBcjh("" + jbc); |
| 944 | + tu.setBcsj("" + sbc); | ||
| 937 | tu.setBbzxl(result2 + "%");// 班次执行率 | 945 | tu.setBbzxl(result2 + "%");// 班次执行率 |
| 938 | 946 | ||
| 939 | - tu.setSm(arg0.getString("xl_name").toString()); | 947 | + tu.setSm(arg0.getString("xl_name")); |
| 940 | tu.setGsgs(arg0.getString("gslsbm").toString()); | 948 | tu.setGsgs(arg0.getString("gslsbm").toString()); |
| 941 | tu.setFgsgs(arg0.getString("fgsbm").toString()); | 949 | tu.setFgsgs(arg0.getString("fgsbm").toString()); |
| 942 | return tu; | 950 | return tu; |
| 943 | - } | 951 | + } |
| 944 | }); | 952 | }); |
| 945 | 953 | ||
| 946 | return list; | 954 | return list; |
| @@ -960,13 +968,13 @@ public class FormsServiceImpl implements FormsService { | @@ -960,13 +968,13 @@ public class FormsServiceImpl implements FormsService { | ||
| 960 | } | 968 | } |
| 961 | 969 | ||
| 962 | String sql="select t.schedule_date_str," | 970 | String sql="select t.schedule_date_str," |
| 963 | - + " t.cl_zbh,t.j_gh,t.j_name,x.yh from (select r.schedule_date_str,r.xl_bm,r.xl_name," | 971 | + + " t.cl_zbh,t.j_gh,t.j_name,x.yh from (select r.schedule_date_str,r.xl_bm," |
| 964 | + " r.cl_zbh,r.j_gh,r.j_name from bsth_c_s_sp_info_real r WHERE " | 972 | + " r.cl_zbh,r.j_gh,r.j_name from bsth_c_s_sp_info_real r WHERE " |
| 965 | + " r.xl_bm='" + map.get("line").toString() + "' " | 973 | + " r.xl_bm='" + map.get("line").toString() + "' " |
| 966 | + " and to_days(r.schedule_date)=to_days('"+map.get("date").toString()+"') " | 974 | + " and to_days(r.schedule_date)=to_days('"+map.get("date").toString()+"') " |
| 967 | + " and r.gs_bm like '%"+gsbm+"%' " | 975 | + " and r.gs_bm like '%"+gsbm+"%' " |
| 968 | + " and r.fgs_bm like '%"+fgsbm+"%' " | 976 | + " and r.fgs_bm like '%"+fgsbm+"%' " |
| 969 | - + " GROUP BY r.schedule_date_str,r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name) t" | 977 | + + " GROUP BY r.schedule_date_str,r.xl_bm,r.cl_zbh,r.j_gh,r.j_name) t" |
| 970 | + " left join (select * from bsth_c_ylb y where " | 978 | + " left join (select * from bsth_c_ylb y where " |
| 971 | + " to_days(y.rq)=to_days('"+map.get("date").toString()+"') " | 979 | + " to_days(y.rq)=to_days('"+map.get("date").toString()+"') " |
| 972 | + " and y.xlbm= '" + map.get("line").toString() + "'" | 980 | + " and y.xlbm= '" + map.get("line").toString() + "'" |
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
| @@ -73,7 +73,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -73,7 +73,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 73 | if(normal){ | 73 | if(normal){ |
| 74 | sql += " and bc_type != 'in' and bc_type != 'out'"; | 74 | sql += " and bc_type != 'in' and bc_type != 'out'"; |
| 75 | } | 75 | } |
| 76 | - System.out.println(sql); | ||
| 77 | 76 | ||
| 78 | list = jdbcTemplate.query(sql, | 77 | list = jdbcTemplate.query(sql, |
| 79 | new RowMapper<ScheduleRealInfo>(){ | 78 | new RowMapper<ScheduleRealInfo>(){ |
| @@ -238,6 +237,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -238,6 +237,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 238 | 237 | ||
| 239 | String sql = "select start_station_name, end_station_name from bsth_c_line where line_code = '"+line+"'"; | 238 | String sql = "select start_station_name, end_station_name from bsth_c_line where line_code = '"+line+"'"; |
| 240 | 239 | ||
| 240 | + System.out.println(sql); | ||
| 241 | list = jdbcTemplate.query(sql, | 241 | list = jdbcTemplate.query(sql, |
| 242 | new RowMapper<Map<String, Object>>(){ | 242 | new RowMapper<Map<String, Object>>(){ |
| 243 | @Override | 243 | @Override |
| @@ -315,8 +315,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -315,8 +315,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 315 | String endDate = map.get("endDate").toString(); | 315 | String endDate = map.get("endDate").toString(); |
| 316 | String model = map.get("model").toString(); | 316 | String model = map.get("model").toString(); |
| 317 | String statu = map.get("statu").toString(); | 317 | String statu = map.get("statu").toString(); |
| 318 | -// String times = map.get("times").toString(); | 318 | + String times1 = map.get("times1").toString(); |
| 319 | + String times2 = map.get("times2").toString(); | ||
| 319 | String type = map.get("type").toString(); | 320 | String type = map.get("type").toString(); |
| 321 | + int sfqr = Integer.valueOf(map.get("sfqr").toString()); | ||
| 320 | 322 | ||
| 321 | if(startDate.length() == 0){ | 323 | if(startDate.length() == 0){ |
| 322 | startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | 324 | startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); |
| @@ -327,12 +329,18 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -327,12 +329,18 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 327 | if(statu.equals("0")){ | 329 | if(statu.equals("0")){ |
| 328 | line = ""; | 330 | line = ""; |
| 329 | } | 331 | } |
| 330 | -// if(times.length() == 0){ | ||
| 331 | -// times = "06:00-07:00"; | ||
| 332 | -// } | ||
| 333 | 332 | ||
| 334 | - List<ScheduleRealInfo> list = this.getSchedule(company, subCompany, line, startDate, endDate, model, "", true); | 333 | + List<ScheduleRealInfo> list = this.getSchedule(company, subCompany, line, |
| 334 | + startDate, endDate, model, sfqr==1?times1+"-"+times2:"", true); | ||
| 335 | 335 | ||
| 336 | + long time1 = 0; | ||
| 337 | + long time2 = 0; | ||
| 338 | + if(sfqr == 1){ | ||
| 339 | + String[] split1 = times1.split(":"); | ||
| 340 | + String[] split2 = times2.split(":"); | ||
| 341 | + time1 = Long.valueOf(split1[0])*60 + Long.valueOf(split1[1]); | ||
| 342 | + time2 = Long.valueOf(split2[0])*60 + Long.valueOf(split2[1]); | ||
| 343 | + } | ||
| 336 | String[] date1 = startDate.split("-"); | 344 | String[] date1 = startDate.split("-"); |
| 337 | String[] date2 = endDate.split("-"); | 345 | String[] date2 = endDate.split("-"); |
| 338 | // startDate = date1[0] + "年" + date1[1] + "月" + date1[2] + "日"; | 346 | // startDate = date1[0] + "年" + date1[1] + "月" + date1[2] + "日"; |
| @@ -349,6 +357,15 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -349,6 +357,15 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 349 | // int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]); | 357 | // int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]); |
| 350 | 358 | ||
| 351 | for(ScheduleRealInfo schedule : list){ | 359 | for(ScheduleRealInfo schedule : list){ |
| 360 | + String[] split1 = schedule.getFcsj().split(":"); | ||
| 361 | + String[] split2 = schedule.getZdsj().split(":"); | ||
| 362 | + long fcsj = Long.valueOf(split1[0])*60 + Long.valueOf(split1[1]); | ||
| 363 | + long zdsj = Long.valueOf(split2[0])*60 + Long.valueOf(split2[1]); | ||
| 364 | + if(sfqr == 1 && (zdsj < time1 || fcsj > time2)){ | ||
| 365 | + continue; | ||
| 366 | + } | ||
| 367 | + if(schedule.getXlName() == null || schedule.getXlName().trim().length() == 0) | ||
| 368 | + continue; | ||
| 352 | String key = schedule.getXlBm() + "/" + schedule.getXlName() + "/" + schedule.getQdzName(); | 369 | String key = schedule.getXlBm() + "/" + schedule.getXlName() + "/" + schedule.getQdzName(); |
| 353 | if(!keyMap.containsKey(key)) | 370 | if(!keyMap.containsKey(key)) |
| 354 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | 371 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); |
| @@ -566,8 +583,11 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -566,8 +583,11 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 566 | String statu = map.get("statu").toString(); | 583 | String statu = map.get("statu").toString(); |
| 567 | String startDate = map.get("startDate").toString(); | 584 | String startDate = map.get("startDate").toString(); |
| 568 | String endDate = map.get("endDate").toString(); | 585 | String endDate = map.get("endDate").toString(); |
| 586 | + String times1 = map.get("times1").toString(); | ||
| 587 | + String times2 = map.get("times2").toString(); | ||
| 569 | String model = map.get("model").toString(); | 588 | String model = map.get("model").toString(); |
| 570 | String type = map.get("type").toString(); | 589 | String type = map.get("type").toString(); |
| 590 | + int sfqr = Integer.valueOf(map.get("sfqr").toString()); | ||
| 571 | 591 | ||
| 572 | if(startDate.length() == 0){ | 592 | if(startDate.length() == 0){ |
| 573 | startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | 593 | startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); |
| @@ -588,6 +608,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -588,6 +608,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 588 | if(company.length() != 0){ | 608 | if(company.length() != 0){ |
| 589 | sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; | 609 | sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; |
| 590 | } | 610 | } |
| 611 | + if(sfqr == 1){ | ||
| 612 | + sql += " and zdsj >= '"+times1+"' and fcsj <= '"+times2+"'"; | ||
| 613 | + } | ||
| 591 | sql += " and bc_type != 'in' and bc_type != 'out' order by fcsj"; | 614 | sql += " and bc_type != 'in' and bc_type != 'out' order by fcsj"; |
| 592 | 615 | ||
| 593 | list = jdbcTemplate.query(sql, | 616 | list = jdbcTemplate.query(sql, |
| @@ -698,7 +721,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -698,7 +721,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 698 | e.printStackTrace(); | 721 | e.printStackTrace(); |
| 699 | } | 722 | } |
| 700 | 723 | ||
| 701 | - | 724 | + |
| 725 | + long time1 = 0; | ||
| 726 | + long time2 = 0; | ||
| 702 | String[] date1 = startDate.split("-"); | 727 | String[] date1 = startDate.split("-"); |
| 703 | String[] date2 = endDate.split("-"); | 728 | String[] date2 = endDate.split("-"); |
| 704 | String date = ""; | 729 | String date = ""; |
| @@ -710,6 +735,12 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -710,6 +735,12 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 710 | date = date1[0] + "年" + date1[1] + "月" + date1[2] + "日--" + | 735 | date = date1[0] + "年" + date1[1] + "月" + date1[2] + "日--" + |
| 711 | date2[0] + "年" + date2[1] + "月" + date2[2] + "日"; | 736 | date2[0] + "年" + date2[1] + "月" + date2[2] + "日"; |
| 712 | } | 737 | } |
| 738 | + if(sfqr == 1){ | ||
| 739 | + String[] split1 = times1.split(":"); | ||
| 740 | + String[] split2 = times2.split(":"); | ||
| 741 | + time1 = Long.valueOf(split1[0])*60 + Long.valueOf(split1[1]); | ||
| 742 | + time2 = Long.valueOf(split2[0])*60 + Long.valueOf(split2[1]); | ||
| 743 | + } | ||
| 713 | 744 | ||
| 714 | for(ChildTaskPlan cTask : cList){ | 745 | for(ChildTaskPlan cTask : cList){ |
| 715 | String key = cTask.getRemarks(); | 746 | String key = cTask.getRemarks(); |
| @@ -719,6 +750,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -719,6 +750,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 719 | } | 750 | } |
| 720 | 751 | ||
| 721 | for(ScheduleRealInfo schedule : list){ | 752 | for(ScheduleRealInfo schedule : list){ |
| 753 | + if(schedule.getXlName()==null || schedule.getXlName().trim().length()==0) | ||
| 754 | + continue; | ||
| 722 | if(model.length() != 0){ | 755 | if(model.length() != 0){ |
| 723 | for(Long tt : ttList) | 756 | for(Long tt : ttList) |
| 724 | if((long) tt == (long)schedule.getSpId()){ | 757 | if((long) tt == (long)schedule.getSpId()){ |
| @@ -744,6 +777,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -744,6 +777,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 744 | List<ScheduleRealInfo> list2 = keyMap.get(key); | 777 | List<ScheduleRealInfo> list2 = keyMap.get(key); |
| 745 | long jhyysj = 0, sjyysj = 0; | 778 | long jhyysj = 0, sjyysj = 0; |
| 746 | long jhyssj = 0, sjyssj = 0; | 779 | long jhyssj = 0, sjyssj = 0; |
| 780 | + long jhyysj1 = 0, sjyysj1 = 0; | ||
| 781 | + long jhyssj1 = 0, sjyssj1 = 0; | ||
| 747 | double jhlc = 0, sjlc = 0; | 782 | double jhlc = 0, sjlc = 0; |
| 748 | for(ScheduleRealInfo schedule : list2){ | 783 | for(ScheduleRealInfo schedule : list2){ |
| 749 | if(companyName.length() == 0 && schedule.getGsName() != null){ | 784 | if(companyName.length() == 0 && schedule.getGsName() != null){ |
| @@ -766,20 +801,40 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -766,20 +801,40 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 766 | for(int i = 1; i < keyList.size(); i++){ | 801 | for(int i = 1; i < keyList.size(); i++){ |
| 767 | ScheduleRealInfo schedule1 = sortMap.get(keyList.get(i - 1)); | 802 | ScheduleRealInfo schedule1 = sortMap.get(keyList.get(i - 1)); |
| 768 | ScheduleRealInfo schedule2 = sortMap.get(keyList.get(i)); | 803 | ScheduleRealInfo schedule2 = sortMap.get(keyList.get(i)); |
| 769 | - jhyysj += schedule2.getFcsjT() - schedule1.getFcsjT(); | ||
| 770 | - | 804 | + if(sfqr == 1 && time1 > schedule1.getFcsjT()){ |
| 805 | + jhyysj += schedule2.getFcsjT() - time1; | ||
| 806 | + }else if(sfqr == 1 && time2 < schedule2.getFcsjT()){ | ||
| 807 | + jhyysj += time2 - schedule1.getFcsjT(); | ||
| 808 | + }else{ | ||
| 809 | + jhyysj += schedule2.getFcsjT() - schedule1.getFcsjT(); | ||
| 810 | + } | ||
| 811 | + jhyysj1 += schedule2.getFcsjT() - schedule1.getFcsjT(); | ||
| 771 | long zdsj2 = schedule2.getZdsjT(); | 812 | long zdsj2 = schedule2.getZdsjT(); |
| 772 | long fcsj2 = schedule2.getFcsjT(); | 813 | long fcsj2 = schedule2.getFcsjT(); |
| 773 | if(fcsj2 > zdsj2) | 814 | if(fcsj2 > zdsj2) |
| 774 | zdsj2 += 1440l; | 815 | zdsj2 += 1440l; |
| 775 | - jhyssj += zdsj2 - fcsj2; | 816 | + if(sfqr == 1 && time1 > fcsj2){ |
| 817 | + jhyssj += zdsj2 - time1; | ||
| 818 | + }else if(sfqr == 1 && time2 < zdsj2){ | ||
| 819 | + jhyssj += time2 - fcsj2; | ||
| 820 | + }else{ | ||
| 821 | + jhyssj += zdsj2 - fcsj2; | ||
| 822 | + } | ||
| 823 | + jhyssj1 += zdsj2 - fcsj2; | ||
| 776 | jhlc += schedule2.getJhlc()==null?0:schedule2.getJhlc(); | 824 | jhlc += schedule2.getJhlc()==null?0:schedule2.getJhlc(); |
| 777 | if(i == 1){ | 825 | if(i == 1){ |
| 778 | long zdsj1 = schedule1.getZdsjT(); | 826 | long zdsj1 = schedule1.getZdsjT(); |
| 779 | long fcsj1 = schedule1.getFcsjT(); | 827 | long fcsj1 = schedule1.getFcsjT(); |
| 780 | if(fcsj1 > zdsj1) | 828 | if(fcsj1 > zdsj1) |
| 781 | zdsj1 += 1440l; | 829 | zdsj1 += 1440l; |
| 782 | - jhyssj += zdsj1 - fcsj1; | 830 | + if(sfqr == 1 && time1 > fcsj1){ |
| 831 | + jhyssj += zdsj1 - time1; | ||
| 832 | + }else if(sfqr == 1 && time2 < zdsj1){ | ||
| 833 | + jhyssj += time1 - fcsj1; | ||
| 834 | + }else{ | ||
| 835 | + jhyssj += zdsj1 - fcsj1; | ||
| 836 | + } | ||
| 837 | + jhyssj1 += zdsj1 - fcsj1; | ||
| 783 | jhlc += schedule1.getJhlc()==null?0:schedule1.getJhlc(); | 838 | jhlc += schedule1.getJhlc()==null?0:schedule1.getJhlc(); |
| 784 | } | 839 | } |
| 785 | } | 840 | } |
| @@ -834,22 +889,45 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -834,22 +889,45 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 834 | Map<String, Object> m1 = mapList.get(i - 1); | 889 | Map<String, Object> m1 = mapList.get(i - 1); |
| 835 | Map<String, Object> m2 = mapList.get(i); | 890 | Map<String, Object> m2 = mapList.get(i); |
| 836 | if(m1.get("fcsj") != null && m2.get("fcsj") != null){ | 891 | if(m1.get("fcsj") != null && m2.get("fcsj") != null){ |
| 837 | - sjyysj += Long.valueOf(m2.get("fcsj").toString()) - Long.valueOf(m1.get("fcsj").toString()); | 892 | + long fcsj2 = Long.valueOf(m2.get("fcsj").toString()); |
| 893 | + long fcsj1 = Long.valueOf(m1.get("fcsj").toString()); | ||
| 894 | + if(sfqr == 1 && time1 > fcsj1){ | ||
| 895 | + sjyysj += fcsj2 - time1; | ||
| 896 | + }else if(sfqr == 1 && time2 < fcsj2){ | ||
| 897 | + sjyysj += time2 - fcsj1; | ||
| 898 | + }else{ | ||
| 899 | + sjyysj += fcsj2 - fcsj1; | ||
| 900 | + } | ||
| 901 | + sjyysj1 += fcsj2 - fcsj1; | ||
| 838 | } | 902 | } |
| 839 | - if(m2.get("fcsj") != null){ | 903 | + if(m2.get("fcsj") != null && m2.get("zdsj") != null){ |
| 840 | long zdsj = Long.valueOf(m2.get("zdsj").toString()); | 904 | long zdsj = Long.valueOf(m2.get("zdsj").toString()); |
| 841 | long fcsj = Long.valueOf(m2.get("fcsj").toString()); | 905 | long fcsj = Long.valueOf(m2.get("fcsj").toString()); |
| 842 | if(fcsj > zdsj) | 906 | if(fcsj > zdsj) |
| 843 | zdsj += 1440l; | 907 | zdsj += 1440l; |
| 844 | - sjyssj += zdsj - fcsj; | 908 | + if(sfqr == 1 && time1 > fcsj){ |
| 909 | + sjyssj += zdsj - time1; | ||
| 910 | + }else if(sfqr == 1 && time2 < zdsj){ | ||
| 911 | + sjyssj += zdsj - fcsj; | ||
| 912 | + }else{ | ||
| 913 | + sjyssj += zdsj - fcsj; | ||
| 914 | + } | ||
| 915 | + sjyssj1 += zdsj - fcsj; | ||
| 845 | sjlc += Double.valueOf(m2.get("lc").toString()); | 916 | sjlc += Double.valueOf(m2.get("lc").toString()); |
| 846 | } | 917 | } |
| 847 | - if(i == 1 && m1.get("fcsj") != null){ | 918 | + if(i == 1 && m1.get("fcsj") != null && m1.get("zdsj") != null){ |
| 848 | long zdsj = Long.valueOf(m1.get("zdsj").toString()); | 919 | long zdsj = Long.valueOf(m1.get("zdsj").toString()); |
| 849 | long fcsj = Long.valueOf(m1.get("fcsj").toString()); | 920 | long fcsj = Long.valueOf(m1.get("fcsj").toString()); |
| 850 | if(fcsj > zdsj) | 921 | if(fcsj > zdsj) |
| 851 | zdsj += 1440l; | 922 | zdsj += 1440l; |
| 852 | - sjyssj += zdsj - fcsj; | 923 | + if(sfqr == 1 && time1 > fcsj){ |
| 924 | + sjyssj += zdsj - time1; | ||
| 925 | + }else if(sfqr == 1 && time2 < zdsj){ | ||
| 926 | + sjyssj += time2 - fcsj; | ||
| 927 | + }else{ | ||
| 928 | + sjyssj += zdsj - fcsj; | ||
| 929 | + } | ||
| 930 | + sjyssj1 += zdsj - fcsj; | ||
| 853 | sjlc += Double.valueOf(m1.get("lc").toString()); | 931 | sjlc += Double.valueOf(m1.get("lc").toString()); |
| 854 | } | 932 | } |
| 855 | } | 933 | } |
| @@ -867,7 +945,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -867,7 +945,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 867 | tempMap.put("jhyycs", "0"); | 945 | tempMap.put("jhyycs", "0"); |
| 868 | } else { | 946 | } else { |
| 869 | tempMap.put("jhyysj", df.format((float)jhyysj / 60)); | 947 | tempMap.put("jhyysj", df.format((float)jhyysj / 60)); |
| 870 | - tempMap.put("jhyycs", df.format(jhlc == 0 ? 0 : jhlc / jhyysj * 60)); | 948 | + tempMap.put("jhyycs", df.format(jhlc == 0 ? 0 : jhlc / jhyysj1 * 60)); |
| 871 | } | 949 | } |
| 872 | 950 | ||
| 873 | if(jhyssj == 0){ | 951 | if(jhyssj == 0){ |
| @@ -875,7 +953,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -875,7 +953,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 875 | tempMap.put("jhyscs", "0"); | 953 | tempMap.put("jhyscs", "0"); |
| 876 | } else { | 954 | } else { |
| 877 | tempMap.put("jhyssj", df.format((float)jhyssj / 60)); | 955 | tempMap.put("jhyssj", df.format((float)jhyssj / 60)); |
| 878 | - tempMap.put("jhyscs", df.format(jhlc == 0 ? 0 : jhlc / jhyssj * 60)); | 956 | + tempMap.put("jhyscs", df.format(jhlc == 0 ? 0 : jhlc / jhyssj1 * 60)); |
| 879 | } | 957 | } |
| 880 | 958 | ||
| 881 | if(sjyysj == 0){ | 959 | if(sjyysj == 0){ |
| @@ -883,7 +961,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -883,7 +961,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 883 | tempMap.put("sjyycs", "0"); | 961 | tempMap.put("sjyycs", "0"); |
| 884 | } else { | 962 | } else { |
| 885 | tempMap.put("sjyysj", df.format((float)sjyysj / 60)); | 963 | tempMap.put("sjyysj", df.format((float)sjyysj / 60)); |
| 886 | - tempMap.put("sjyycs", df.format(sjlc == 0 ? 0 : sjlc / sjyysj * 60)); | 964 | + tempMap.put("sjyycs", df.format(sjlc == 0 ? 0 : sjlc / sjyysj1 * 60)); |
| 887 | } | 965 | } |
| 888 | 966 | ||
| 889 | if(sjyssj == 0){ | 967 | if(sjyssj == 0){ |
| @@ -891,8 +969,16 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -891,8 +969,16 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 891 | tempMap.put("sjyscs", "0"); | 969 | tempMap.put("sjyscs", "0"); |
| 892 | } else { | 970 | } else { |
| 893 | tempMap.put("sjyssj", df.format((float)sjyssj / 60)); | 971 | tempMap.put("sjyssj", df.format((float)sjyssj / 60)); |
| 894 | - tempMap.put("sjyscs", df.format(sjlc == 0 ? 0 : sjlc / sjyssj * 60)); | 972 | + tempMap.put("sjyscs", df.format(sjlc == 0 ? 0 : sjlc / sjyssj1 * 60)); |
| 895 | } | 973 | } |
| 974 | + if(!tempMap.get("jhyysj").equals("0")) | ||
| 975 | + if(!tempMap.get("jhyycs").equals("0")) | ||
| 976 | + if(!tempMap.get("jhyssj").equals("0")) | ||
| 977 | + if(!tempMap.get("jhyscs").equals("0")) | ||
| 978 | + if(!tempMap.get("sjyysj").equals("0")) | ||
| 979 | + if(!tempMap.get("sjyycs").equals("0")) | ||
| 980 | + if(!tempMap.get("sjyssj").equals("0")) | ||
| 981 | + if(!tempMap.get("sjyscs").equals("0")) | ||
| 896 | resList.add(tempMap); | 982 | resList.add(tempMap); |
| 897 | } | 983 | } |
| 898 | Map<String, List<Map<String, Object>>> keyMap2 = new HashMap<String, List<Map<String, Object>>>(); | 984 | Map<String, List<Map<String, Object>>> keyMap2 = new HashMap<String, List<Map<String, Object>>>(); |
| @@ -1124,7 +1210,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1124,7 +1210,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1124 | endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | 1210 | endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); |
| 1125 | } | 1211 | } |
| 1126 | if(times.length() == 0){ | 1212 | if(times.length() == 0){ |
| 1127 | - times = "06:00-07:00"; | 1213 | + times = "05:00-23:00"; |
| 1128 | } | 1214 | } |
| 1129 | 1215 | ||
| 1130 | list = getSchedule(company, subCompany, line, startDate, endDate, model, times, true); | 1216 | list = getSchedule(company, subCompany, line, startDate, endDate, model, times, true); |
| @@ -1387,6 +1473,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1387,6 +1473,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1387 | String model = map.get("model").toString(); | 1473 | String model = map.get("model").toString(); |
| 1388 | String times = map.get("times").toString(); | 1474 | String times = map.get("times").toString(); |
| 1389 | String type = map.get("type").toString(); | 1475 | String type = map.get("type").toString(); |
| 1476 | + int sfqr = Integer.valueOf(map.get("sfqr").toString()); | ||
| 1390 | 1477 | ||
| 1391 | if(startDate.length() == 0){ | 1478 | if(startDate.length() == 0){ |
| 1392 | startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | 1479 | startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); |
| @@ -1395,10 +1482,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1395,10 +1482,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1395 | endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | 1482 | endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); |
| 1396 | } | 1483 | } |
| 1397 | if(times.length() == 0){ | 1484 | if(times.length() == 0){ |
| 1398 | - times = "06:00-07:00"; | 1485 | + times = "05:00-23:00"; |
| 1399 | } | 1486 | } |
| 1400 | 1487 | ||
| 1401 | - list = getSchedule(company, subCompany, line, startDate, endDate, model, times, true); | 1488 | + list = getSchedule(company, subCompany, line, startDate, endDate, model, sfqr==1?times:"", true); |
| 1402 | 1489 | ||
| 1403 | String[] date1 = startDate.split("-"); | 1490 | String[] date1 = startDate.split("-"); |
| 1404 | String[] date2 = endDate.split("-"); | 1491 | String[] date2 = endDate.split("-"); |
| @@ -1417,7 +1504,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1417,7 +1504,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1417 | 1504 | ||
| 1418 | for(ScheduleRealInfo schedule : list){ | 1505 | for(ScheduleRealInfo schedule : list){ |
| 1419 | Long fcsj = schedule.getFcsjT(); | 1506 | Long fcsj = schedule.getFcsjT(); |
| 1420 | - if(!(endTime!=0?fcsj>=startTime&&fcsj<endTime:fcsj>=startTime)){ | 1507 | + if(sfqr == 1 && !(endTime!=0?fcsj>=startTime&&fcsj<endTime:fcsj>=startTime)){ |
| 1421 | continue; | 1508 | continue; |
| 1422 | } | 1509 | } |
| 1423 | String key = schedule.getXlName(); | 1510 | String key = schedule.getXlName(); |
| @@ -1571,6 +1658,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1571,6 +1658,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1571 | String endDate = map.get("endDate").toString(); | 1658 | String endDate = map.get("endDate").toString(); |
| 1572 | String times = map.get("times").toString(); | 1659 | String times = map.get("times").toString(); |
| 1573 | String type = map.get("type").toString(); | 1660 | String type = map.get("type").toString(); |
| 1661 | + int sfqr = Integer.valueOf(map.get("sfqr").toString()); | ||
| 1574 | 1662 | ||
| 1575 | if(startDate.length() == 0){ | 1663 | if(startDate.length() == 0){ |
| 1576 | startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | 1664 | startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); |
| @@ -1584,7 +1672,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1584,7 +1672,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1584 | if(line.length() != 0){ | 1672 | if(line.length() != 0){ |
| 1585 | sql += " and xl_bm = '"+line+"'"; | 1673 | sql += " and xl_bm = '"+line+"'"; |
| 1586 | } | 1674 | } |
| 1587 | - if(times.length() != 0){ | 1675 | + if(sfqr == 1 && times.length() != 0){ |
| 1588 | String[] split = times.split("-"); | 1676 | String[] split = times.split("-"); |
| 1589 | String[] split0 = split[0].split(":"); | 1677 | String[] split0 = split[0].split(":"); |
| 1590 | String[] split1 = split[1].split(":"); | 1678 | String[] split1 = split[1].split(":"); |
| @@ -1651,6 +1739,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1651,6 +1739,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1651 | date = startDate + "--" + endDate; | 1739 | date = startDate + "--" + endDate; |
| 1652 | 1740 | ||
| 1653 | for(ScheduleRealInfo schedule : list){ | 1741 | for(ScheduleRealInfo schedule : list){ |
| 1742 | + if(schedule.getXlName() == null || schedule.getXlName().trim().length() == 0) | ||
| 1743 | + continue; | ||
| 1654 | String key = schedule.getGsName() + "/" + schedule.getFgsName() + "/" + schedule.getXlName(); | 1744 | String key = schedule.getGsName() + "/" + schedule.getFgsName() + "/" + schedule.getXlName(); |
| 1655 | if(!keyMap.containsKey(key)) | 1745 | if(!keyMap.containsKey(key)) |
| 1656 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | 1746 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); |
src/main/java/com/bsth/service/impl/SectionRouteServiceImpl.java
| @@ -6,12 +6,15 @@ import java.util.List; | @@ -6,12 +6,15 @@ import java.util.List; | ||
| 6 | import java.util.Map; | 6 | import java.util.Map; |
| 7 | 7 | ||
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | +import org.springframework.data.domain.Sort; | ||
| 10 | +import org.springframework.data.domain.Sort.Direction; | ||
| 9 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
| 10 | 12 | ||
| 11 | import com.bsth.common.ResponseCode; | 13 | import com.bsth.common.ResponseCode; |
| 12 | import com.bsth.entity.Line; | 14 | import com.bsth.entity.Line; |
| 13 | import com.bsth.entity.Section; | 15 | import com.bsth.entity.Section; |
| 14 | import com.bsth.entity.SectionRoute; | 16 | import com.bsth.entity.SectionRoute; |
| 17 | +import com.bsth.entity.search.CustomerSpecs; | ||
| 15 | import com.bsth.repository.LineRepository; | 18 | import com.bsth.repository.LineRepository; |
| 16 | import com.bsth.repository.SectionRepository; | 19 | import com.bsth.repository.SectionRepository; |
| 17 | import com.bsth.repository.SectionRouteRepository; | 20 | import com.bsth.repository.SectionRouteRepository; |
| @@ -46,6 +49,14 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | @@ -46,6 +49,14 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | ||
| 46 | @Autowired | 49 | @Autowired |
| 47 | LineRepository lineRepository; | 50 | LineRepository lineRepository; |
| 48 | 51 | ||
| 52 | + @Override | ||
| 53 | + public Iterable<SectionRoute> list(Map<String, Object> map) { | ||
| 54 | + List<Sort.Order> orderList = new ArrayList<>(); | ||
| 55 | + orderList.add(new Sort.Order(Direction.ASC, "directions")); | ||
| 56 | + orderList.add(new Sort.Order(Direction.ASC, "sectionrouteCode")); | ||
| 57 | + return repository.findAll(new CustomerSpecs<SectionRoute>(map), new Sort(orderList)); | ||
| 58 | + } | ||
| 59 | + | ||
| 49 | /** | 60 | /** |
| 50 | * @Description :TODO(查询路段信息) | 61 | * @Description :TODO(查询路段信息) |
| 51 | * | 62 | * |
| @@ -88,6 +99,7 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | @@ -88,6 +99,7 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | ||
| 88 | tempM.put("destroy",listObjArray.get(i)[23]); | 99 | tempM.put("destroy",listObjArray.get(i)[23]); |
| 89 | tempM.put("versions",listObjArray.get(i)[24]); | 100 | tempM.put("versions",listObjArray.get(i)[24]); |
| 90 | tempM.put("descriptions",listObjArray.get(i)[25]); | 101 | tempM.put("descriptions",listObjArray.get(i)[25]); |
| 102 | + tempM.put("isRoadeSpeed",listObjArray.get(i)[26]); | ||
| 91 | resultList.add(tempM); | 103 | resultList.add(tempM); |
| 92 | } | 104 | } |
| 93 | } | 105 | } |
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
| @@ -201,9 +201,9 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -201,9 +201,9 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 201 | // 站点说明 | 201 | // 站点说明 |
| 202 | tempM.put("stationDescriptions", stationList.get(i)[31]); | 202 | tempM.put("stationDescriptions", stationList.get(i)[31]); |
| 203 | 203 | ||
| 204 | - tempM.put("name", stationList.get(i)[17]); | 204 | + tempM.put("name", stationList.get(i)[3]); |
| 205 | 205 | ||
| 206 | - tempM.put("text", stationList.get(i)[17]); | 206 | + tempM.put("text", stationList.get(i)[3]); |
| 207 | 207 | ||
| 208 | tempM.put("icon", "fa fa-bus"); | 208 | tempM.put("icon", "fa fa-bus"); |
| 209 | 209 | ||
| @@ -305,6 +305,8 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -305,6 +305,8 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 305 | 305 | ||
| 306 | // 说明 | 306 | // 说明 |
| 307 | tempM.put("descriptions",sectionList.get(i)[25]); | 307 | tempM.put("descriptions",sectionList.get(i)[25]); |
| 308 | + // 说明 | ||
| 309 | + tempM.put("isRoadeSpeed",sectionList.get(i)[26]); | ||
| 308 | 310 | ||
| 309 | tempM.put("name", sectionList.get(i)[9]); | 311 | tempM.put("name", sectionList.get(i)[9]); |
| 310 | 312 | ||
| @@ -413,34 +415,22 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -413,34 +415,22 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 413 | */ | 415 | */ |
| 414 | @Override | 416 | @Override |
| 415 | public List<Map<String, Object>> findUpStationRouteCode(Map<String, Object> map) { | 417 | public List<Map<String, Object>> findUpStationRouteCode(Map<String, Object> map) { |
| 416 | - | ||
| 417 | Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString()); | 418 | Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString()); |
| 418 | - | ||
| 419 | Integer direction = map.get("direction").equals("") ? null : Integer.parseInt(map.get("direction").toString()); | 419 | Integer direction = map.get("direction").equals("") ? null : Integer.parseInt(map.get("direction").toString()); |
| 420 | - | ||
| 421 | Integer stationRouteCode = map.get("stationRouteCode").equals("") ? null : Integer.parseInt(map.get("stationRouteCode").toString()); | 420 | Integer stationRouteCode = map.get("stationRouteCode").equals("") ? null : Integer.parseInt(map.get("stationRouteCode").toString()); |
| 422 | - | ||
| 423 | List<Object[]> reslutList = repository.findUpStationRouteCode(lineId, direction, stationRouteCode); | 421 | List<Object[]> reslutList = repository.findUpStationRouteCode(lineId, direction, stationRouteCode); |
| 424 | - | ||
| 425 | List<Map<String, Object>> list = new ArrayList<Map<String,Object>>(); | 422 | List<Map<String, Object>> list = new ArrayList<Map<String,Object>>(); |
| 426 | - | ||
| 427 | if(reslutList.size()>0) { | 423 | if(reslutList.size()>0) { |
| 428 | - | ||
| 429 | for(int i = 0 ; i <reslutList.size() ;i++){ | 424 | for(int i = 0 ; i <reslutList.size() ;i++){ |
| 430 | Map<String, Object> tempM = new HashMap<String, Object>(); | 425 | Map<String, Object> tempM = new HashMap<String, Object>(); |
| 431 | tempM.put("stationRouteCode", reslutList.get(i)[0]); | 426 | tempM.put("stationRouteCode", reslutList.get(i)[0]); |
| 432 | tempM.put("stationRouteMarke", reslutList.get(i)[1]); | 427 | tempM.put("stationRouteMarke", reslutList.get(i)[1]); |
| 433 | - | ||
| 434 | list.add(tempM); | 428 | list.add(tempM); |
| 435 | - | ||
| 436 | } | 429 | } |
| 437 | - | ||
| 438 | } | 430 | } |
| 439 | - | ||
| 440 | return list; | 431 | return list; |
| 441 | } | 432 | } |
| 442 | 433 | ||
| 443 | - | ||
| 444 | /** | 434 | /** |
| 445 | * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) | 435 | * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) |
| 446 | * | 436 | * |
| @@ -1042,6 +1032,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -1042,6 +1032,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 1042 | tempM.put("stationUpdateDate", objects.get(i)[38]); | 1032 | tempM.put("stationUpdateDate", objects.get(i)[38]); |
| 1043 | 1033 | ||
| 1044 | tempM.put("stationRouteId", objects.get(i)[39]); | 1034 | tempM.put("stationRouteId", objects.get(i)[39]); |
| 1035 | + tempM.put("zdmc", objects.get(i)[40]); | ||
| 1045 | 1036 | ||
| 1046 | resultList.add(tempM); | 1037 | resultList.add(tempM); |
| 1047 | } | 1038 | } |
src/main/java/com/bsth/service/impl/StationServiceImpl.java
| @@ -9,6 +9,7 @@ import org.slf4j.Logger; | @@ -9,6 +9,7 @@ import org.slf4j.Logger; | ||
| 9 | import org.slf4j.LoggerFactory; | 9 | import org.slf4j.LoggerFactory; |
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
| 12 | +import org.springframework.transaction.annotation.Transactional; | ||
| 12 | 13 | ||
| 13 | 14 | ||
| 14 | 15 | ||
| @@ -267,7 +268,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -267,7 +268,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 267 | // 百度坐标纬度 | 268 | // 百度坐标纬度 |
| 268 | String bLatx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lat").toString(); | 269 | String bLatx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lat").toString(); |
| 269 | bLatx = bLatx==null || bLatx.equals("") ? "0" : bLatx; | 270 | bLatx = bLatx==null || bLatx.equals("") ? "0" : bLatx; |
| 270 | - List<Object[]> stationNameList = repository.findStationName(stationName); | 271 | + List<Object[]> stationNameList = repository.findStationName(directions,stationName); |
| 271 | Map<String, Object> isHaveMap = isHaveStationname(bLonx,bLatx,stationNameList); | 272 | Map<String, Object> isHaveMap = isHaveStationname(bLonx,bLatx,stationNameList); |
| 272 | // 初始化站点对象 | 273 | // 初始化站点对象 |
| 273 | Station arg0 = new Station(); | 274 | Station arg0 = new Station(); |
| @@ -699,76 +700,103 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -699,76 +700,103 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 699 | * | 700 | * |
| 700 | * @return Map<String, Object> <SUCCESS ; ERROR> | 701 | * @return Map<String, Object> <SUCCESS ; ERROR> |
| 701 | */ | 702 | */ |
| 703 | + @Transactional | ||
| 702 | @Override | 704 | @Override |
| 703 | public Map<String, Object> stationSaveMap(Map<String, Object> map) { | 705 | public Map<String, Object> stationSaveMap(Map<String, Object> map) { |
| 704 | Map<String, Object> resultMap = new HashMap<String, Object>(); | 706 | Map<String, Object> resultMap = new HashMap<String, Object>(); |
| 705 | try { | 707 | try { |
| 706 | // 站点编码 | 708 | // 站点编码 |
| 707 | - String stationCod = map.get("stationCod").equals("") ? "" : map.get("stationCod").toString(); | 709 | + String stationCod = ""; |
| 708 | // 站点ID | 710 | // 站点ID |
| 709 | - int stationId = Integer.valueOf(stationCod); | 711 | + Integer stationId = null; |
| 710 | // 站点名称 | 712 | // 站点名称 |
| 711 | - String stationName = map.get("stationName").equals("") ? "" : map.get("stationName").toString(); | ||
| 712 | - // 道路编码 | ||
| 713 | - String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); | ||
| 714 | - // 原坐标类型 | ||
| 715 | - String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); | 713 | + String zdmc = map.get("zdmc").equals("") ? "" : map.get("zdmc").toString(); |
| 714 | + // 方向 | ||
| 715 | + Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString()); | ||
| 716 | // 原坐标点 | 716 | // 原坐标点 |
| 717 | String bJwpoints = map.get("bJwpoints").equals("") ? "" : map.get("bJwpoints").toString(); | 717 | String bJwpoints = map.get("bJwpoints").equals("") ? "" : map.get("bJwpoints").toString(); |
| 718 | String bJwpointsArray[] = null; | 718 | String bJwpointsArray[] = null; |
| 719 | if(bJwpoints!=null) { | 719 | if(bJwpoints!=null) { |
| 720 | bJwpointsArray = bJwpoints.split(" "); | 720 | bJwpointsArray = bJwpoints.split(" "); |
| 721 | } | 721 | } |
| 722 | - // WGS经纬度 | ||
| 723 | - Float gLonx = null; | ||
| 724 | - // WGS纬度 | ||
| 725 | - Float gLaty = null; | ||
| 726 | - if(bJwpointsArray.length>0) { | ||
| 727 | - Location resultPoint = FromBDPointToWGSPoint(bJwpointsArray[0],bJwpointsArray[1]); | ||
| 728 | - gLonx = (float)resultPoint.getLng(); | ||
| 729 | - gLaty = (float)resultPoint.getLat(); | ||
| 730 | - } | ||
| 731 | - // 方向 | ||
| 732 | - Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString()); | ||
| 733 | - // 距离 | ||
| 734 | - Double distances = map.get("distances").equals("") ? null : Double.parseDouble(map.get("distances").toString()); | ||
| 735 | - // 时间 | ||
| 736 | - Double toTime = map.get("toTime").equals("") ? null : Double.parseDouble(map.get("toTime").toString()); | ||
| 737 | - // 城建坐标经度 | ||
| 738 | - Float x = map.get("x").equals("") ? null : Float.parseFloat(map.get("x").toString()); | ||
| 739 | - // 城建坐标纬度 | ||
| 740 | - Float y = map.get("y").equals("") ? null : Float.parseFloat(map.get("y").toString()); | ||
| 741 | - // 多边形原坐标点集合 | ||
| 742 | - String bPloygonGrid = map.get("bPolygonGrid").equals("") ? "" : map.get("bPolygonGrid").toString(); | ||
| 743 | - // 多边形WGS坐标点集合 | ||
| 744 | - String gPloygonGrid =""; | ||
| 745 | - if(!bPloygonGrid.equals("")) { | ||
| 746 | - String bPloygonGridArray[] = bPloygonGrid.split(","); | ||
| 747 | - int bLen_ = bPloygonGridArray.length; | ||
| 748 | - for(int b = 0 ;b<bLen_;b++) { | ||
| 749 | - String tempArray[]= bPloygonGridArray[b].split(" "); | ||
| 750 | - Location resultPoint = FromBDPointToWGSPoint(tempArray[0],tempArray[1]); | ||
| 751 | - if(b==0) { | ||
| 752 | - gPloygonGrid = String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat()); | ||
| 753 | - }else { | ||
| 754 | - gPloygonGrid = gPloygonGrid + ',' + String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat()); | ||
| 755 | - } | ||
| 756 | - } | ||
| 757 | - } | 722 | + List<Object[]> stationNameList = repository.findStationName(directions,zdmc); |
| 723 | + Map<String, Object> isHaveMap = isHaveStationname(bJwpointsArray[0],bJwpointsArray[1],stationNameList); | ||
| 758 | // 是否撤销 | 724 | // 是否撤销 |
| 759 | Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString()); | 725 | Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString()); |
| 760 | - // 圆半径 | ||
| 761 | - Integer radius = map.get("radius").equals("") ? null : Integer.parseInt(map.get("radius").toString()); | ||
| 762 | - // 图形类型 | ||
| 763 | - String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString(); | ||
| 764 | // 版本 | 726 | // 版本 |
| 765 | Integer versions = map.get("versions").equals("") ? null : Integer.parseInt(map.get("versions").toString()); | 727 | Integer versions = map.get("versions").equals("") ? null : Integer.parseInt(map.get("versions").toString()); |
| 766 | // 说明 | 728 | // 说明 |
| 767 | String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString(); | 729 | String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString(); |
| 768 | - // 创建人 | ||
| 769 | - Integer createBy = map.get("createBy").equals("") ? null : Integer.parseInt(map.get("createBy").toString()); | ||
| 770 | - // 修改人 | ||
| 771 | - Integer updateBy = map.get("updateBy").equals("") ? null : Integer.parseInt(map.get("updateBy").toString()); | 730 | + if(Boolean.parseBoolean(isHaveMap.get("isHave").toString())) { |
| 731 | + stationId = Integer.parseInt(isHaveMap.get("id").toString()); | ||
| 732 | + }else { | ||
| 733 | + // 站点编码 | ||
| 734 | + stationCod = map.get("stationCod").equals("") ? "" : map.get("stationCod").toString(); | ||
| 735 | + // 站点ID | ||
| 736 | + stationId = Integer.valueOf(stationCod); | ||
| 737 | + // 圆半径 | ||
| 738 | + Integer radius = map.get("radius").equals("") ? null : Integer.parseInt(map.get("radius").toString()); | ||
| 739 | + // 图形类型 | ||
| 740 | + String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString(); | ||
| 741 | + // 创建人 | ||
| 742 | + Integer createBy = map.get("createBy").equals("") ? null : Integer.parseInt(map.get("createBy").toString()); | ||
| 743 | + // 修改人 | ||
| 744 | + Integer updateBy = map.get("updateBy").equals("") ? null : Integer.parseInt(map.get("updateBy").toString()); | ||
| 745 | + // 城建坐标经度 | ||
| 746 | + Float x = map.get("x").equals("") ? null : Float.parseFloat(map.get("x").toString()); | ||
| 747 | + // 城建坐标纬度 | ||
| 748 | + Float y = map.get("y").equals("") ? null : Float.parseFloat(map.get("y").toString()); | ||
| 749 | + // 道路编码 | ||
| 750 | + String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); | ||
| 751 | + // 原坐标类型 | ||
| 752 | + String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); | ||
| 753 | + // WGS经纬度 | ||
| 754 | + Float gLonx = null; | ||
| 755 | + // WGS纬度 | ||
| 756 | + Float gLaty = null; | ||
| 757 | + if(bJwpointsArray.length>0) { | ||
| 758 | + Location resultPoint = FromBDPointToWGSPoint(bJwpointsArray[0],bJwpointsArray[1]); | ||
| 759 | + gLonx = (float)resultPoint.getLng(); | ||
| 760 | + gLaty = (float)resultPoint.getLat(); | ||
| 761 | + } | ||
| 762 | + // 多边形原坐标点集合 | ||
| 763 | + String bPloygonGrid = map.get("bPolygonGrid").equals("") ? "" : map.get("bPolygonGrid").toString(); | ||
| 764 | + // 多边形WGS坐标点集合 | ||
| 765 | + String gPloygonGrid =""; | ||
| 766 | + if(!bPloygonGrid.equals("")) { | ||
| 767 | + String bPloygonGridArray[] = bPloygonGrid.split(","); | ||
| 768 | + int bLen_ = bPloygonGridArray.length; | ||
| 769 | + for(int b = 0 ;b<bLen_;b++) { | ||
| 770 | + String tempArray[]= bPloygonGridArray[b].split(" "); | ||
| 771 | + Location resultPoint = FromBDPointToWGSPoint(tempArray[0],tempArray[1]); | ||
| 772 | + if(b==0) { | ||
| 773 | + gPloygonGrid = String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat()); | ||
| 774 | + }else { | ||
| 775 | + gPloygonGrid = gPloygonGrid + ',' + String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat()); | ||
| 776 | + } | ||
| 777 | + } | ||
| 778 | + } | ||
| 779 | + if(bPloygonGrid.equals("")) | ||
| 780 | + bPloygonGrid = null; | ||
| 781 | + else | ||
| 782 | + bPloygonGrid = "POLYGON((" + bPloygonGrid +"))"; | ||
| 783 | + if(gPloygonGrid.equals("")) | ||
| 784 | + gPloygonGrid = null; | ||
| 785 | + else | ||
| 786 | + gPloygonGrid = "POLYGON((" + gPloygonGrid +"))"; | ||
| 787 | + // 保存站点 | ||
| 788 | + repository.stationSave(stationCod, zdmc, roadCoding, dbType, bJwpoints, | ||
| 789 | + gLonx, gLaty, x, y, gPloygonGrid,bPloygonGrid, destroy, radius, | ||
| 790 | + shapesType, versions, descriptions, createBy, updateBy,stationId); | ||
| 791 | + } | ||
| 792 | + Station station = repository.findOne(stationId); | ||
| 793 | + StationRoute arg0 = new StationRoute(); | ||
| 794 | + // 距离 | ||
| 795 | + Double distances = map.get("distances").equals("") ? null : Double.parseDouble(map.get("distances").toString()); | ||
| 796 | + // 时间 | ||
| 797 | + Double toTime = map.get("toTime").equals("") ? null : Double.parseDouble(map.get("toTime").toString()); | ||
| 798 | + // 站点路由名称 | ||
| 799 | + String stationName = map.get("stationName").equals("") ? "" : map.get("stationName").toString(); | ||
| 772 | // 线路ID | 800 | // 线路ID |
| 773 | int line = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); | 801 | int line = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); |
| 774 | // 线路信息 | 802 | // 线路信息 |
| @@ -784,20 +812,6 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -784,20 +812,6 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 784 | }else { | 812 | }else { |
| 785 | stationRouteCode = 100; | 813 | stationRouteCode = 100; |
| 786 | } | 814 | } |
| 787 | - if(bPloygonGrid.equals("")) | ||
| 788 | - bPloygonGrid = null; | ||
| 789 | - else | ||
| 790 | - bPloygonGrid = "POLYGON((" + bPloygonGrid +"))"; | ||
| 791 | - if(gPloygonGrid.equals("")) | ||
| 792 | - gPloygonGrid = null; | ||
| 793 | - else | ||
| 794 | - gPloygonGrid = "POLYGON((" + gPloygonGrid +"))"; | ||
| 795 | - // 保存站点 | ||
| 796 | - repository.stationSave(stationCod, stationName, roadCoding, dbType, bJwpoints, | ||
| 797 | - gLonx, gLaty, x, y, gPloygonGrid,bPloygonGrid, destroy, radius, | ||
| 798 | - shapesType, versions, descriptions, createBy, updateBy,stationId); | ||
| 799 | - Station station = repository.findOne(stationId); | ||
| 800 | - StationRoute arg0 = new StationRoute(); | ||
| 801 | // 线路 | 815 | // 线路 |
| 802 | arg0.setLine(resultLine); | 816 | arg0.setLine(resultLine); |
| 803 | arg0.setLineCode(resultLine.getLineCode()); | 817 | arg0.setLineCode(resultLine.getLineCode()); |
| @@ -806,7 +820,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -806,7 +820,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 806 | // 站点路由名称 | 820 | // 站点路由名称 |
| 807 | arg0.setStationName(stationName); | 821 | arg0.setStationName(stationName); |
| 808 | // 站点路由编码 | 822 | // 站点路由编码 |
| 809 | - arg0.setStationCode(stationCod); | 823 | + arg0.setStationCode(station.getStationCod()); |
| 810 | // 站点路由序号 | 824 | // 站点路由序号 |
| 811 | arg0.setStationRouteCode(stationRouteCode); | 825 | arg0.setStationRouteCode(stationRouteCode); |
| 812 | // 站点路由类型 | 826 | // 站点路由类型 |
| @@ -823,6 +837,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -823,6 +837,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 823 | arg0.setDestroy(destroy); | 837 | arg0.setDestroy(destroy); |
| 824 | // 站点路由说明 | 838 | // 站点路由说明 |
| 825 | arg0.setDescriptions(descriptions); | 839 | arg0.setDescriptions(descriptions); |
| 840 | + routeRepository.stationUpdStationRouteCode(line, directions, stationRouteCode); | ||
| 826 | routeRepository.save(arg0); | 841 | routeRepository.save(arg0); |
| 827 | resultMap.put("status", ResponseCode.SUCCESS); | 842 | resultMap.put("status", ResponseCode.SUCCESS); |
| 828 | } catch (Exception e) { | 843 | } catch (Exception e) { |
| @@ -849,112 +864,54 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -849,112 +864,54 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 849 | */ | 864 | */ |
| 850 | @Override | 865 | @Override |
| 851 | public Map<String, Object> stationUpdate(Map<String, Object> map) { | 866 | public Map<String, Object> stationUpdate(Map<String, Object> map) { |
| 852 | - | ||
| 853 | Map<String, Object> resultMap = new HashMap<String, Object>(); | 867 | Map<String, Object> resultMap = new HashMap<String, Object>(); |
| 854 | - | ||
| 855 | try { | 868 | try { |
| 856 | - | ||
| 857 | // 站点Id | 869 | // 站点Id |
| 858 | Integer stationId = map.get("stationId").equals("") ? null : Integer.parseInt(map.get("stationId").toString()); | 870 | Integer stationId = map.get("stationId").equals("") ? null : Integer.parseInt(map.get("stationId").toString()); |
| 859 | - | ||
| 860 | String stationCod = map.get("stationCod").equals("") ? "" : map.get("stationCod").toString(); | 871 | String stationCod = map.get("stationCod").equals("") ? "" : map.get("stationCod").toString(); |
| 861 | - | 872 | + String zdmc = map.get("zdmc").equals("") ? "" : map.get("zdmc").toString(); |
| 862 | // 站点名称 | 873 | // 站点名称 |
| 863 | String stationName = map.get("stationName").equals("") ? "" : map.get("stationName").toString(); | 874 | String stationName = map.get("stationName").equals("") ? "" : map.get("stationName").toString(); |
| 864 | - | ||
| 865 | // 所在道路编码 | 875 | // 所在道路编码 |
| 866 | String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); | 876 | String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); |
| 867 | - | ||
| 868 | // 经纬坐标类型 | 877 | // 经纬坐标类型 |
| 869 | String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); | 878 | String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); |
| 870 | - | ||
| 871 | // 百度经纬度坐标 | 879 | // 百度经纬度坐标 |
| 872 | String bJwpoints = map.get("bJwpoints").equals("") ? "" : map.get("bJwpoints").toString(); | 880 | String bJwpoints = map.get("bJwpoints").equals("") ? "" : map.get("bJwpoints").toString(); |
| 873 | - | ||
| 874 | - // WGS经纬度坐标 | ||
| 875 | - // String gJwpoints = map.get("gJwpoints").equals("") ? "" : map.get("gJwpoints").toString(); | ||
| 876 | - | ||
| 877 | String bJwpointsArray[] =null; | 881 | String bJwpointsArray[] =null; |
| 878 | - | ||
| 879 | if(bJwpoints!=null) { | 882 | if(bJwpoints!=null) { |
| 880 | - | ||
| 881 | bJwpointsArray = bJwpoints.split(" "); | 883 | bJwpointsArray = bJwpoints.split(" "); |
| 882 | - | ||
| 883 | } | 884 | } |
| 884 | - | ||
| 885 | // WGS经纬度 | 885 | // WGS经纬度 |
| 886 | Float gLonx = null; | 886 | Float gLonx = null; |
| 887 | - | ||
| 888 | // WGS纬度 | 887 | // WGS纬度 |
| 889 | Float gLaty = null; | 888 | Float gLaty = null; |
| 890 | - | ||
| 891 | if(bJwpointsArray.length>0) { | 889 | if(bJwpointsArray.length>0) { |
| 892 | - | ||
| 893 | Location resultPoint = FromBDPointToWGSPoint(bJwpointsArray[0],bJwpointsArray[1]); | 890 | Location resultPoint = FromBDPointToWGSPoint(bJwpointsArray[0],bJwpointsArray[1]); |
| 894 | - | ||
| 895 | gLonx = (float)resultPoint.getLng(); | 891 | gLonx = (float)resultPoint.getLng(); |
| 896 | - | ||
| 897 | gLaty = (float)resultPoint.getLat(); | 892 | gLaty = (float)resultPoint.getLat(); |
| 898 | - | ||
| 899 | } | 893 | } |
| 900 | - | ||
| 901 | - /*// 站点地理位置WGS坐标经度 | ||
| 902 | - String gLonx = ""; | ||
| 903 | - | ||
| 904 | - // 站点地理位置WGS坐标纬度 | ||
| 905 | - String gLaty = ""; | ||
| 906 | - | ||
| 907 | - if(gJwpoints!=null) { | ||
| 908 | - | ||
| 909 | - String gJwpointsArray[] = gJwpoints.split(" "); | ||
| 910 | - | ||
| 911 | - gLonx = gJwpointsArray[0]; | ||
| 912 | - | ||
| 913 | - gLaty = gJwpointsArray[1]; | ||
| 914 | - | ||
| 915 | - }*/ | ||
| 916 | - | ||
| 917 | // 图形类型 | 894 | // 图形类型 |
| 918 | String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString(); | 895 | String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString(); |
| 919 | - | ||
| 920 | // 圆形半径 | 896 | // 圆形半径 |
| 921 | Integer radius = map.get("radius").equals("") ? null : Integer.parseInt(map.get("radius").toString()); | 897 | Integer radius = map.get("radius").equals("") ? null : Integer.parseInt(map.get("radius").toString()); |
| 922 | - | ||
| 923 | - // 多边形空间WGS坐标点集合 | ||
| 924 | - /*String gPolygonGrid = map.get("gPolygonGrid").equals("") ? "" : map.get("gPolygonGrid").toString();*/ | ||
| 925 | - | ||
| 926 | // 多边形空间原坐标坐标点集合 | 898 | // 多边形空间原坐标坐标点集合 |
| 927 | String bPloygonGrid = map.get("bPolygonGrid").equals("") ? "" : map.get("bPolygonGrid").toString(); | 899 | String bPloygonGrid = map.get("bPolygonGrid").equals("") ? "" : map.get("bPolygonGrid").toString(); |
| 928 | - | ||
| 929 | // 多边形WGS坐标点集合 | 900 | // 多边形WGS坐标点集合 |
| 930 | String gPloygonGrid =""; | 901 | String gPloygonGrid =""; |
| 931 | - | ||
| 932 | if(!bPloygonGrid.equals("")) { | 902 | if(!bPloygonGrid.equals("")) { |
| 933 | - | ||
| 934 | String bPloygonGridArray[] = bPloygonGrid.split(","); | 903 | String bPloygonGridArray[] = bPloygonGrid.split(","); |
| 935 | - | ||
| 936 | int bLen_ = bPloygonGridArray.length; | 904 | int bLen_ = bPloygonGridArray.length; |
| 937 | - | ||
| 938 | for(int b = 0 ;b<bLen_;b++) { | 905 | for(int b = 0 ;b<bLen_;b++) { |
| 939 | - | ||
| 940 | String tempArray[]= bPloygonGridArray[b].split(" "); | 906 | String tempArray[]= bPloygonGridArray[b].split(" "); |
| 941 | - | ||
| 942 | Location resultPoint = FromBDPointToWGSPoint(tempArray[0],tempArray[1]); | 907 | Location resultPoint = FromBDPointToWGSPoint(tempArray[0],tempArray[1]); |
| 943 | - | ||
| 944 | if(b==0) { | 908 | if(b==0) { |
| 945 | - | ||
| 946 | gPloygonGrid = resultPoint.getLng() + " " + resultPoint.getLat(); | 909 | gPloygonGrid = resultPoint.getLng() + " " + resultPoint.getLat(); |
| 947 | - | ||
| 948 | }else { | 910 | }else { |
| 949 | - | ||
| 950 | gPloygonGrid = gPloygonGrid + ',' + resultPoint.getLng() + " " + resultPoint.getLat(); | 911 | gPloygonGrid = gPloygonGrid + ',' + resultPoint.getLng() + " " + resultPoint.getLat(); |
| 951 | - | ||
| 952 | } | 912 | } |
| 953 | - | ||
| 954 | } | 913 | } |
| 955 | - | ||
| 956 | } | 914 | } |
| 957 | - | ||
| 958 | if(bPloygonGrid.equals("")) | 915 | if(bPloygonGrid.equals("")) |
| 959 | bPloygonGrid = null; | 916 | bPloygonGrid = null; |
| 960 | else | 917 | else |
| @@ -964,116 +921,62 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -964,116 +921,62 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 964 | gPloygonGrid = null; | 921 | gPloygonGrid = null; |
| 965 | else | 922 | else |
| 966 | gPloygonGrid = "POLYGON((" + gPloygonGrid +"))"; | 923 | gPloygonGrid = "POLYGON((" + gPloygonGrid +"))"; |
| 967 | - | ||
| 968 | - | ||
| 969 | // 是否撤销 | 924 | // 是否撤销 |
| 970 | Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString()); | 925 | Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString()); |
| 971 | - | ||
| 972 | // 版本号 | 926 | // 版本号 |
| 973 | Integer versions = map.get("versions").equals("") ? null : Integer.parseInt(map.get("versions").toString()); | 927 | Integer versions = map.get("versions").equals("") ? null : Integer.parseInt(map.get("versions").toString()); |
| 974 | - | ||
| 975 | // 描述与说明 | 928 | // 描述与说明 |
| 976 | String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString(); | 929 | String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString(); |
| 977 | - | ||
| 978 | Float x = map.get("x").equals("") ? null : Float.parseFloat(map.get("x").toString()); | 930 | Float x = map.get("x").equals("") ? null : Float.parseFloat(map.get("x").toString()); |
| 979 | - | ||
| 980 | Float y = map.get("y").equals("") ? null : Float.parseFloat(map.get("y").toString()); | 931 | Float y = map.get("y").equals("") ? null : Float.parseFloat(map.get("y").toString()); |
| 981 | - | ||
| 982 | // 更新 | 932 | // 更新 |
| 983 | - repository.stationUpdate(stationCod, stationName, roadCoding, dbType, bJwpoints, gLonx, gLaty, x, y, bPloygonGrid, gPloygonGrid, destroy, radius, shapesType, versions, descriptions, stationId); | ||
| 984 | - | ||
| 985 | - | 933 | + repository.stationUpdate(stationCod, zdmc, roadCoding, dbType, bJwpoints, gLonx, gLaty, x, y, bPloygonGrid, gPloygonGrid, destroy, radius, shapesType, versions, descriptions, stationId); |
| 986 | // 站点路由Id | 934 | // 站点路由Id |
| 987 | Integer stationRouteId = map.get("stationRouteId").equals("") ? null : Integer.parseInt(map.get("stationRouteId").toString()); | 935 | Integer stationRouteId = map.get("stationRouteId").equals("") ? null : Integer.parseInt(map.get("stationRouteId").toString()); |
| 988 | - | ||
| 989 | StationRoute resultS = routeRepository.findOne(stationRouteId); | 936 | StationRoute resultS = routeRepository.findOne(stationRouteId); |
| 990 | - | ||
| 991 | // 站点路由序号 | 937 | // 站点路由序号 |
| 992 | String stationRouteCodeStr = map.get("stationRouteCode").equals("") ? null : map.get("stationRouteCode").toString(); | 938 | String stationRouteCodeStr = map.get("stationRouteCode").equals("") ? null : map.get("stationRouteCode").toString(); |
| 993 | - | ||
| 994 | Integer stationRouteCode = null; | 939 | Integer stationRouteCode = null; |
| 995 | - | ||
| 996 | if(stationRouteCodeStr!=null) { | 940 | if(stationRouteCodeStr!=null) { |
| 997 | - | ||
| 998 | String stationRouteCodeAraay[] = stationRouteCodeStr.split("_"); | 941 | String stationRouteCodeAraay[] = stationRouteCodeStr.split("_"); |
| 999 | - | ||
| 1000 | int old_code = resultS.getStationRouteCode(); | 942 | int old_code = resultS.getStationRouteCode(); |
| 1001 | - | ||
| 1002 | int new_code = Integer.parseInt(stationRouteCodeAraay[0].toString())+100; | 943 | int new_code = Integer.parseInt(stationRouteCodeAraay[0].toString())+100; |
| 1003 | - | ||
| 1004 | if(new_code==old_code){ | 944 | if(new_code==old_code){ |
| 1005 | - | ||
| 1006 | stationRouteCode = new_code; | 945 | stationRouteCode = new_code; |
| 1007 | - | ||
| 1008 | }else { | 946 | }else { |
| 1009 | - | ||
| 1010 | stationRouteCode = new_code-100+1; | 947 | stationRouteCode = new_code-100+1; |
| 1011 | - | ||
| 1012 | } | 948 | } |
| 1013 | - | ||
| 1014 | }else { | 949 | }else { |
| 1015 | - | ||
| 1016 | stationRouteCode = resultS.getStationRouteCode(); | 950 | stationRouteCode = resultS.getStationRouteCode(); |
| 1017 | - | ||
| 1018 | } | 951 | } |
| 1019 | - | ||
| 1020 | stationRouteCode = stationRouteCode == null ? 100 : stationRouteCode; | 952 | stationRouteCode = stationRouteCode == null ? 100 : stationRouteCode; |
| 1021 | - | ||
| 1022 | Integer LineId = map.get("stationRouteLine").equals("") ? null : Integer.parseInt(map.get("stationRouteLine").toString()); | 953 | Integer LineId = map.get("stationRouteLine").equals("") ? null : Integer.parseInt(map.get("stationRouteLine").toString()); |
| 1023 | - | ||
| 1024 | String stationMark = map.get("stationMark").equals("") ? null : map.get("stationMark").toString(); | 954 | String stationMark = map.get("stationMark").equals("") ? null : map.get("stationMark").toString(); |
| 1025 | - | ||
| 1026 | Double distances = map.get("distances").equals("") ? null : Double.parseDouble(map.get("distances").toString()); | 955 | Double distances = map.get("distances").equals("") ? null : Double.parseDouble(map.get("distances").toString()); |
| 1027 | - | ||
| 1028 | Double toTime = map.get("toTime").equals("") ? null : Double.parseDouble(map.get("toTime").toString()); | 956 | Double toTime = map.get("toTime").equals("") ? null : Double.parseDouble(map.get("toTime").toString()); |
| 1029 | - | ||
| 1030 | Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString()); | 957 | Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString()); |
| 1031 | - | ||
| 1032 | Station station = repository.findOne(stationId); | 958 | Station station = repository.findOne(stationId); |
| 1033 | - | ||
| 1034 | Line line = lineRepository.findOne(LineId); | 959 | Line line = lineRepository.findOne(LineId); |
| 1035 | - | ||
| 1036 | - | ||
| 1037 | StationRoute stationRoute = new StationRoute(); | 960 | StationRoute stationRoute = new StationRoute(); |
| 1038 | - | ||
| 1039 | stationRoute.setStationName(stationName); | 961 | stationRoute.setStationName(stationName); |
| 1040 | - | ||
| 1041 | stationRoute.setId(stationRouteId); | 962 | stationRoute.setId(stationRouteId); |
| 1042 | - | ||
| 1043 | stationRoute.setStationRouteCode(stationRouteCode); | 963 | stationRoute.setStationRouteCode(stationRouteCode); |
| 1044 | - | ||
| 1045 | stationRoute.setStation(station); | 964 | stationRoute.setStation(station); |
| 1046 | - | ||
| 1047 | stationRoute.setStationCode(station.getStationCod()); | 965 | stationRoute.setStationCode(station.getStationCod()); |
| 1048 | - | ||
| 1049 | stationRoute.setLine(line); | 966 | stationRoute.setLine(line); |
| 1050 | - | ||
| 1051 | stationRoute.setLineCode(line.getLineCode()); | 967 | stationRoute.setLineCode(line.getLineCode()); |
| 1052 | - | ||
| 1053 | stationRoute.setStationMark(stationMark); | 968 | stationRoute.setStationMark(stationMark); |
| 1054 | - | ||
| 1055 | stationRoute.setDistances(distances); | 969 | stationRoute.setDistances(distances); |
| 1056 | - | ||
| 1057 | stationRoute.setToTime(toTime); | 970 | stationRoute.setToTime(toTime); |
| 1058 | - | ||
| 1059 | stationRoute.setDirections(directions); | 971 | stationRoute.setDirections(directions); |
| 1060 | - | ||
| 1061 | stationRoute.setVersions(versions); | 972 | stationRoute.setVersions(versions); |
| 1062 | - | ||
| 1063 | stationRoute.setDestroy(destroy); | 973 | stationRoute.setDestroy(destroy); |
| 1064 | - | ||
| 1065 | stationRoute.setDescriptions(descriptions); | 974 | stationRoute.setDescriptions(descriptions); |
| 1066 | - | ||
| 1067 | routeRepository.save(stationRoute); | 975 | routeRepository.save(stationRoute); |
| 1068 | - | ||
| 1069 | resultMap.put("status", ResponseCode.SUCCESS); | 976 | resultMap.put("status", ResponseCode.SUCCESS); |
| 1070 | - | ||
| 1071 | } catch (Exception e) { | 977 | } catch (Exception e) { |
| 1072 | - | ||
| 1073 | resultMap.put("status", ResponseCode.ERROR); | 978 | resultMap.put("status", ResponseCode.ERROR); |
| 1074 | - | ||
| 1075 | logger.error("save erro.", e); | 979 | logger.error("save erro.", e); |
| 1076 | - | ||
| 1077 | } | 980 | } |
| 1078 | return resultMap; | 981 | return resultMap; |
| 1079 | } | 982 | } |
src/main/java/com/bsth/service/oil/impl/CwjyServiceImpl.java
| @@ -276,17 +276,22 @@ public class CwjyServiceImpl extends BaseServiceImpl<Cwjy,Integer> implements Cw | @@ -276,17 +276,22 @@ public class CwjyServiceImpl extends BaseServiceImpl<Cwjy,Integer> implements Cw | ||
| 276 | // TODO Auto-generated method stub | 276 | // TODO Auto-generated method stub |
| 277 | String rq=map.get("rq").toString(); | 277 | String rq=map.get("rq").toString(); |
| 278 | String nbbm=map.get("nbbh").toString(); | 278 | String nbbm=map.get("nbbh").toString(); |
| 279 | + String gsdm=map.get("gsdm_like").toString(); | ||
| 280 | + | ||
| 281 | + String fgsdm=map.get("fgsdm_like").toString(); | ||
| 279 | String sql="SELECT a.gsdm as gsdm,a.fgsdm as fgsdm,a.nbbm as nbbm," | 282 | String sql="SELECT a.gsdm as gsdm,a.fgsdm as fgsdm,a.nbbm as nbbm," |
| 280 | + "b.jyggh as jyggh,b.jzl as jzl ,b.stationid as stationid,b.jsy as jsy," | 283 | + "b.jyggh as jyggh,b.jzl as jzl ,b.stationid as stationid,b.jsy as jsy," |
| 281 | + "b.nylx as nylx,b.yj as yj,b.bz as bz,b.id as id ,c.jsy as ldgh FROM bsth_c_cwjy a "+ | 284 | + "b.nylx as nylx,b.yj as yj,b.bz as bz,b.id as id ,c.jsy as ldgh FROM bsth_c_cwjy a "+ |
| 282 | " left join (" | 285 | " left join (" |
| 283 | + " select * from bsth_c_ylxxb b " | 286 | + " select * from bsth_c_ylxxb b " |
| 284 | - + "where to_days(b.yyrq)=to_days('"+rq+"') and jylx=1) b " + | 287 | + + "where to_days(b.yyrq)=to_days('"+rq+"') and jylx=1 " |
| 288 | + + " and gsdm = '"+gsdm+"') b " + | ||
| 285 | " on a.nbbm=b.nbbm " | 289 | " on a.nbbm=b.nbbm " |
| 286 | + "left join (select nbbm,group_concat(jsy) as jsy " | 290 | + "left join (select nbbm,group_concat(jsy) as jsy " |
| 287 | - + "from bsth_c_ylb where to_days(rq)= to_days('"+rq+"' ) group by nbbm "+ | 291 | + + "from bsth_c_ylb where to_days(rq)= to_days('"+rq+"' ) " |
| 292 | + + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"' group by nbbm "+ | ||
| 288 | " ) c on a.nbbm=c.nbbm " | 293 | " ) c on a.nbbm=c.nbbm " |
| 289 | - + "where a.nbbm like '%"+nbbm+"%'"; | 294 | + + "where a.nbbm like '%"+nbbm+"%' and a.gsdm='"+gsdm+"' and a.fgsdm ='"+fgsdm+"'"; |
| 290 | 295 | ||
| 291 | List<Ylxxb> yList= jdbcTemplate.query(sql, | 296 | List<Ylxxb> yList= jdbcTemplate.query(sql, |
| 292 | new RowMapper<Ylxxb>(){ | 297 | new RowMapper<Ylxxb>(){ |
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
| @@ -102,7 +102,8 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -102,7 +102,8 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 102 | //当天YLXXB信息 | 102 | //当天YLXXB信息 |
| 103 | // List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq); | 103 | // List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq); |
| 104 | //前一天所有车辆最后进场班次信息 | 104 | //前一天所有车辆最后进场班次信息 |
| 105 | - List<Ylb> ylListBe=repository.obtainYlbefore(rq,"","","",""); | 105 | +// List<Ylb> ylListBe=repository.obtainYlbefore(rq,"","","",""); |
| 106 | + List<Ylb> ylListBe=repository.listMaxRqJcsx(rq, "", "", "", ""); | ||
| 106 | List<Cyl> clyList=cylRepository.obtainCyl("",""); | 107 | List<Cyl> clyList=cylRepository.obtainCyl("",""); |
| 107 | //从排班表中计算出行驶的总里程 | 108 | //从排班表中计算出行驶的总里程 |
| 108 | List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("", rq, "", "", "", ""); | 109 | List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("", rq, "", "", "", ""); |
| @@ -180,7 +181,10 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -180,7 +181,10 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 180 | t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | 181 | t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); |
| 181 | t.setRq(sdf.parse(rq)); | 182 | t.setRq(sdf.parse(rq)); |
| 182 | t.setCreatetime(dNow); | 183 | t.setCreatetime(dNow); |
| 183 | - repository.save(t); | 184 | + if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ |
| 185 | + repository.save(t); | ||
| 186 | + } | ||
| 187 | + | ||
| 184 | 188 | ||
| 185 | } | 189 | } |
| 186 | result = "success"; | 190 | result = "success"; |
| @@ -237,7 +241,8 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -237,7 +241,8 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 237 | // 当天YLXXB信息 | 241 | // 当天YLXXB信息 |
| 238 | List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0,gsbm); | 242 | List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0,gsbm); |
| 239 | // 前一天所有车辆最后进场班次信息 | 243 | // 前一天所有车辆最后进场班次信息 |
| 240 | - List<Ylb> ylListBe = repository.obtainYlbefore(rq, gsbm, fgsbm, line, nbbm); | 244 | +// List<Ylb> ylListBe = repository.obtainYlbefore(rq, gsbm, fgsbm, line, nbbm); |
| 245 | + List<Ylb> ylListBe =repository.listMaxRqJcsx(rq, gsbm, fgsbm, line, nbbm); | ||
| 241 | List<Cyl> clyList = cylRepository.obtainCyl(nbbm,gsbm); | 246 | List<Cyl> clyList = cylRepository.obtainCyl(nbbm,gsbm); |
| 242 | // 从排班表中计算出行驶的总里程 | 247 | // 从排班表中计算出行驶的总里程 |
| 243 | List<Map<String, Object>> listpb = scheduleRealInfoService.yesterdayDataList(line, rq, gsbm, fgsbm, "", nbbm); | 248 | List<Map<String, Object>> listpb = scheduleRealInfoService.yesterdayDataList(line, rq, gsbm, fgsbm, "", nbbm); |
| @@ -322,7 +327,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -322,7 +327,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 322 | t.setNbbm(map.get("clZbh").toString()); | 327 | t.setNbbm(map.get("clZbh").toString()); |
| 323 | t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString()); | 328 | t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString()); |
| 324 | t.setZlc(map.get("totalKilometers") == null ? 0.0 | 329 | t.setZlc(map.get("totalKilometers") == null ? 0.0 |
| 325 | - : Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString())))); | 330 | + : Double.parseDouble(map.get("totalKilometers").toString())); |
| 326 | t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString()); | 331 | t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString()); |
| 327 | t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | 332 | t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); |
| 328 | t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString()); | 333 | t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString()); |
| @@ -330,12 +335,14 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -330,12 +335,14 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 330 | t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | 335 | t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); |
| 331 | t.setRq(sdf.parse(rq)); | 336 | t.setRq(sdf.parse(rq)); |
| 332 | t.setCreatetime(date); | 337 | t.setCreatetime(date); |
| 333 | - if(type.equals("add")){ | ||
| 334 | - addList.add(t); | ||
| 335 | - }else{ | ||
| 336 | - updateList.add(t); | ||
| 337 | - ins += t.getId().toString()+","; | ||
| 338 | - } | 338 | + if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ |
| 339 | + if(type.equals("add")){ | ||
| 340 | + addList.add(t); | ||
| 341 | + }else{ | ||
| 342 | + updateList.add(t); | ||
| 343 | + ins += t.getId().toString()+","; | ||
| 344 | + } | ||
| 345 | + } | ||
| 339 | // repository.save(t); | 346 | // repository.save(t); |
| 340 | newMap.put("status", ResponseCode.SUCCESS); | 347 | newMap.put("status", ResponseCode.SUCCESS); |
| 341 | 348 | ||
| @@ -405,7 +412,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -405,7 +412,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 405 | String nbbm_eq = ylb.getNbbm(); | 412 | String nbbm_eq = ylb.getNbbm(); |
| 406 | Date rq_eq = ylb.getRq(); | 413 | Date rq_eq = ylb.getRq(); |
| 407 | // 得到一天总的加油和里程(根据车,时间) | 414 | // 得到一天总的加油和里程(根据车,时间) |
| 408 | - List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq,ylb.getXlbm()); | 415 | + List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq,ylb.getXlbm(),gsbm,fgsbm); |
| 409 | // 保存总的加油量 | 416 | // 保存总的加油量 |
| 410 | Double jzl = 0.0; | 417 | Double jzl = 0.0; |
| 411 | // 保存总的里程 | 418 | // 保存总的里程 |
| @@ -436,40 +443,53 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -436,40 +443,53 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 436 | if(t.getNbbm().equals(ylb.getNbbm())){ | 443 | if(t.getNbbm().equals(ylb.getNbbm())){ |
| 437 | if (t.getJcsx() == 1) { | 444 | if (t.getJcsx() == 1) { |
| 438 | // 进场等于出场的操作 既 最后进场存油量等于第一次的出场存油量 | 445 | // 进场等于出场的操作 既 最后进场存油量等于第一次的出场存油量 |
| 439 | - Double yl = t.getCzyl(); | ||
| 440 | - Double jcyl = t.getCzyl(); | ||
| 441 | - zyl =Arith.sub( Arith.add(jcyl, jzl),yl); | 446 | +// Double yl = t.getCzyl(); |
| 447 | +// Double jcyl = t.getCzyl(); | ||
| 448 | + zyl =jzl; | ||
| 442 | Double yh=0.0; | 449 | Double yh=0.0; |
| 443 | if(zlc>0){ | 450 | if(zlc>0){ |
| 444 | yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | 451 | yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); |
| 445 | } | 452 | } |
| 446 | - nextJzyl =Arith.sub( Arith.add(t.getJzl(), t.getCzyl()),yh); | 453 | + nextJzyl =Arith.sub( Arith.add(Arith.sub(t.getJzl(),t.getSh()), t.getCzyl()),yh); |
| 447 | //把进场油量的小数和整数分别取出 | 454 | //把进场油量的小数和整数分别取出 |
| 448 | // int ylxs=(int) nextJzyl; 10.6--11 10.3--10 | 455 | // int ylxs=(int) nextJzyl; 10.6--11 10.3--10 |
| 449 | - long l=Math.round(nextJzyl); | ||
| 450 | - double ylxs=l*100/100; | ||
| 451 | -// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); | ||
| 452 | - yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl)); | ||
| 453 | - t.setYh(yh); | ||
| 454 | - t.setJzyl(ylxs); | ||
| 455 | - nextJzyl=ylxs; | 456 | + if(zlc>0){ |
| 457 | + long l=Math.round(nextJzyl); | ||
| 458 | + double ylxs=l*100/100; | ||
| 459 | +// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); | ||
| 460 | + yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl)); | ||
| 461 | + t.setYh(yh); | ||
| 462 | + t.setJzyl(ylxs); | ||
| 463 | + nextJzyl=ylxs; | ||
| 464 | + }else{ | ||
| 465 | + t.setYh(yh); | ||
| 466 | + t.setJzyl(nextJzyl); | ||
| 467 | + } | ||
| 468 | + | ||
| 469 | + | ||
| 470 | + | ||
| 456 | } else { | 471 | } else { |
| 457 | t.setCzyl(nextJzyl); | 472 | t.setCzyl(nextJzyl); |
| 458 | Double yh=0.0; | 473 | Double yh=0.0; |
| 459 | if(zlc>0){ | 474 | if(zlc>0){ |
| 460 | yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | 475 | yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); |
| 461 | } | 476 | } |
| 462 | - nextJzyl =Arith.sub( Arith.add(t.getJzl(),nextJzyl),yh); | ||
| 463 | - long l=Math.round(nextJzyl); | ||
| 464 | - double ylxs=l*100/100; | ||
| 465 | -// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); | ||
| 466 | - yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl)); | ||
| 467 | - t.setYh(yh); | ||
| 468 | - t.setJzyl(ylxs); | ||
| 469 | - nextJzyl= ylxs; | 477 | + nextJzyl =Arith.sub( Arith.add(Arith.sub(t.getJzl(),t.getSh()),nextJzyl),yh); |
| 478 | + if(zlc>0){ | ||
| 479 | + long l=Math.round(nextJzyl); | ||
| 480 | + double ylxs=l*100/100; | ||
| 481 | +// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); | ||
| 482 | + yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl)); | ||
| 483 | + t.setYh(yh); | ||
| 484 | + t.setJzyl(ylxs); | ||
| 485 | + nextJzyl=ylxs; | ||
| 486 | + }else{ | ||
| 487 | + t.setYh(yh); | ||
| 488 | + t.setJzyl(nextJzyl); | ||
| 489 | + } | ||
| 470 | } | 490 | } |
| 471 | repository.save(t); | 491 | repository.save(t); |
| 472 | - for (int z = 0; z < cylList.size(); z++) { | 492 | + /*for (int z = 0; z < cylList.size(); z++) { |
| 473 | Cyl cyl = cylList.get(z); | 493 | Cyl cyl = cylList.get(z); |
| 474 | if (t.getNbbm().equals(cyl.getNbbm())) { | 494 | if (t.getNbbm().equals(cyl.getNbbm())) { |
| 475 | cyl.setCyl(t.getJzyl()); | 495 | cyl.setCyl(t.getJzyl()); |
| @@ -477,7 +497,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -477,7 +497,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 477 | break; | 497 | break; |
| 478 | } | 498 | } |
| 479 | cylRepository.save(cyl); | 499 | cylRepository.save(cyl); |
| 480 | - } | 500 | + }*/ |
| 481 | } | 501 | } |
| 482 | map2.put("status", ResponseCode.SUCCESS); | 502 | map2.put("status", ResponseCode.SUCCESS); |
| 483 | } | 503 | } |
| @@ -682,7 +702,8 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -682,7 +702,8 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 682 | if(map.get("nbbm_eq")!=null){ | 702 | if(map.get("nbbm_eq")!=null){ |
| 683 | nbbm=map.get("nbbm_eq").toString(); | 703 | nbbm=map.get("nbbm_eq").toString(); |
| 684 | } | 704 | } |
| 685 | - List<Ylb> ylListBe=repository.obtainYlbefore(rq, gsbm, "", xlbm, nbbm); | 705 | +// List<Ylb> ylListBe=repository.obtainYlbefore(rq, gsbm, "", xlbm, nbbm); |
| 706 | + List<Ylb> ylListBe=repository.listMaxRqJcsx(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 686 | List<Cyl> cylList=cylRepository.obtainCyl(nbbm, gsbm); | 707 | List<Cyl> cylList=cylRepository.obtainCyl(nbbm, gsbm); |
| 687 | List<Ylb> ylbList=repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); | 708 | List<Ylb> ylbList=repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); |
| 688 | List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm); | 709 | List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm); |
| @@ -744,12 +765,13 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -744,12 +765,13 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 744 | // double jzyl=Arith.add(t.getJzl(), t.getCzyl()); | 765 | // double jzyl=Arith.add(t.getJzl(), t.getCzyl()); |
| 745 | t.setJzyl(Arith.add(t.getJzl(), t.getCzyl())); | 766 | t.setJzyl(Arith.add(t.getJzl(), t.getCzyl())); |
| 746 | t.setYh(0.0); | 767 | t.setYh(0.0); |
| 747 | - if(fgsdm.equals(fgsbm)){ | 768 | + if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ |
| 748 | repository.save(t); | 769 | repository.save(t); |
| 749 | - if(null!=cyl){ | 770 | + /*if(null!=cyl){ |
| 750 | cyl.setCyl(Arith.add(t.getJzl(), t.getCzyl())); | 771 | cyl.setCyl(Arith.add(t.getJzl(), t.getCzyl())); |
| 772 | + cyl.setUpdatetime(y1.getYyrq()); | ||
| 751 | cylRepository.save(cyl); | 773 | cylRepository.save(cyl); |
| 752 | - } | 774 | + }*/ |
| 753 | } | 775 | } |
| 754 | } | 776 | } |
| 755 | } | 777 | } |
| @@ -1042,7 +1064,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1042,7 +1064,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1042 | t.setRylx(rylx); | 1064 | t.setRylx(rylx); |
| 1043 | t.setId(jsonObject.getInteger("id"));*/ | 1065 | t.setId(jsonObject.getInteger("id"));*/ |
| 1044 | repository.ylbUpdate(id, czyl, jzyl, yh, sh, shyy, ns, rylx,yhlx); | 1066 | repository.ylbUpdate(id, czyl, jzyl, yh, sh, shyy, ns, rylx,yhlx); |
| 1045 | - for (int z = 0; z < cylList.size(); z++) { | 1067 | + /*for (int z = 0; z < cylList.size(); z++) { |
| 1046 | Cyl cyl = cylList.get(z); | 1068 | Cyl cyl = cylList.get(z); |
| 1047 | if (nbbm.equals(cyl.getNbbm())) { | 1069 | if (nbbm.equals(cyl.getNbbm())) { |
| 1048 | cyl.setCyl(jzyl); | 1070 | cyl.setCyl(jzyl); |
| @@ -1050,7 +1072,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1050,7 +1072,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1050 | break; | 1072 | break; |
| 1051 | } | 1073 | } |
| 1052 | cylRepository.save(cyl); | 1074 | cylRepository.save(cyl); |
| 1053 | - } | 1075 | + }*/ |
| 1054 | } | 1076 | } |
| 1055 | // List<Map<String, Object>> list=(List<Map<String, Object>>) map.get("ylbList"); | 1077 | // List<Map<String, Object>> list=(List<Map<String, Object>>) map.get("ylbList"); |
| 1056 | 1078 | ||
| @@ -1090,7 +1112,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1090,7 +1112,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1090 | String nbbm_eq = ylb.getNbbm(); | 1112 | String nbbm_eq = ylb.getNbbm(); |
| 1091 | Date rq_eq = ylb.getRq(); | 1113 | Date rq_eq = ylb.getRq(); |
| 1092 | // 得到一天总的加油和里程(根据车,时间) | 1114 | // 得到一天总的加油和里程(根据车,时间) |
| 1093 | - List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq,ylb.getXlbm()); | 1115 | + List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq,ylb.getXlbm(),ylb.getSsgsdm(),ylb.getFgsdm()); |
| 1094 | // 保存总的加油量 | 1116 | // 保存总的加油量 |
| 1095 | Double jzl = 0.0; | 1117 | Double jzl = 0.0; |
| 1096 | // 保存总的里程 | 1118 | // 保存总的里程 |
| @@ -1102,7 +1124,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1102,7 +1124,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1102 | zlc = Arith.add(zlc, Double.valueOf(sumList.get(j)[1].toString())); | 1124 | zlc = Arith.add(zlc, Double.valueOf(sumList.get(j)[1].toString())); |
| 1103 | zsh = Arith.add(zsh, Double.valueOf(sumList.get(j)[2].toString())); | 1125 | zsh = Arith.add(zsh, Double.valueOf(sumList.get(j)[2].toString())); |
| 1104 | } | 1126 | } |
| 1105 | - jzl = Arith.sub(jzl, zsh); | 1127 | +// jzl = Arith.sub(jzl, zsh); |
| 1106 | //新的 损耗不等于 旧的损耗 总损耗从新算 | 1128 | //新的 损耗不等于 旧的损耗 总损耗从新算 |
| 1107 | if(Arith.sub(ylb.getSh(),sh )!=0){ | 1129 | if(Arith.sub(ylb.getSh(),sh )!=0){ |
| 1108 | zsh =Arith.add(Arith.sub(zsh, ylb.getSh()), sh); | 1130 | zsh =Arith.add(Arith.sub(zsh, ylb.getSh()), sh); |
| @@ -1126,20 +1148,25 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1126,20 +1148,25 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1126 | t.setSh(sh); | 1148 | t.setSh(sh); |
| 1127 | t.setShyy(shyy); | 1149 | t.setShyy(shyy); |
| 1128 | } | 1150 | } |
| 1129 | - Double jcyl = t.getCzyl(); | ||
| 1130 | - zyl = Arith.sub(Arith.add(jcyl, jzl), yl); | 1151 | +// Double jcyl = t.getCzyl(); |
| 1152 | + zyl = jzl; | ||
| 1131 | Double yh = 0.0; | 1153 | Double yh = 0.0; |
| 1132 | if (zlc > 0 && t.getZlc() > 0) { | 1154 | if (zlc > 0 && t.getZlc() > 0) { |
| 1133 | yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | 1155 | yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); |
| 1134 | } | 1156 | } |
| 1135 | nextJzyl =Arith.sub(Arith.add(t.getJzl(), t.getCzyl()), Arith.add(yh, t.getSh())); | 1157 | nextJzyl =Arith.sub(Arith.add(t.getJzl(), t.getCzyl()), Arith.add(yh, t.getSh())); |
| 1136 | - long l=Math.round(nextJzyl); | ||
| 1137 | - double ylxs=l*100/100; | ||
| 1138 | -// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); | ||
| 1139 | - yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl)); | ||
| 1140 | - t.setJzyl(ylxs); | ||
| 1141 | - t.setYh(yh); | ||
| 1142 | - nextJzyl=ylxs; | 1158 | + if(zlc>0){ |
| 1159 | + long l=Math.round(nextJzyl); | ||
| 1160 | + double ylxs=l*100/100; | ||
| 1161 | +// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); | ||
| 1162 | + yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl)); | ||
| 1163 | + t.setYh(yh); | ||
| 1164 | + t.setJzyl(ylxs); | ||
| 1165 | + nextJzyl=ylxs; | ||
| 1166 | + }else{ | ||
| 1167 | + t.setYh(yh); | ||
| 1168 | + t.setJzyl(nextJzyl); | ||
| 1169 | + } | ||
| 1143 | } else { | 1170 | } else { |
| 1144 | if(t.getId()==id){ | 1171 | if(t.getId()==id){ |
| 1145 | t.setSh(sh); | 1172 | t.setSh(sh); |
| @@ -1151,16 +1178,21 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1151,16 +1178,21 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1151 | yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | 1178 | yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); |
| 1152 | } | 1179 | } |
| 1153 | nextJzyl = Arith.sub(Arith.add(t.getJzl(), nextJzyl), Arith.add(yh, t.getSh())); | 1180 | nextJzyl = Arith.sub(Arith.add(t.getJzl(), nextJzyl), Arith.add(yh, t.getSh())); |
| 1154 | - long l=Math.round(nextJzyl); | ||
| 1155 | - double ylxs=l*100/100; | ||
| 1156 | -// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); | ||
| 1157 | - yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl)); | ||
| 1158 | - t.setJzyl(ylxs); | ||
| 1159 | - t.setYh(yh); | ||
| 1160 | - nextJzyl=ylxs; | 1181 | + if(zlc>0){ |
| 1182 | + long l=Math.round(nextJzyl); | ||
| 1183 | + double ylxs=l*100/100; | ||
| 1184 | +// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); | ||
| 1185 | + yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl)); | ||
| 1186 | + t.setYh(yh); | ||
| 1187 | + t.setJzyl(ylxs); | ||
| 1188 | + nextJzyl=ylxs; | ||
| 1189 | + }else{ | ||
| 1190 | + t.setYh(yh); | ||
| 1191 | + t.setJzyl(nextJzyl); | ||
| 1192 | + } | ||
| 1161 | } | 1193 | } |
| 1162 | repository.save(t); | 1194 | repository.save(t); |
| 1163 | - for (int z = 0; z < cylList.size(); z++) { | 1195 | + /*for (int z = 0; z < cylList.size(); z++) { |
| 1164 | Cyl cyl = cylList.get(z); | 1196 | Cyl cyl = cylList.get(z); |
| 1165 | if (t.getNbbm().equals(cyl.getNbbm())) { | 1197 | if (t.getNbbm().equals(cyl.getNbbm())) { |
| 1166 | cyl.setCyl(t.getJzyl()); | 1198 | cyl.setCyl(t.getJzyl()); |
| @@ -1168,7 +1200,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1168,7 +1200,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1168 | break; | 1200 | break; |
| 1169 | } | 1201 | } |
| 1170 | cylRepository.save(cyl); | 1202 | cylRepository.save(cyl); |
| 1171 | - } | 1203 | + }*/ |
| 1172 | } | 1204 | } |
| 1173 | newMap.put("status", ResponseCode.SUCCESS); | 1205 | newMap.put("status", ResponseCode.SUCCESS); |
| 1174 | } | 1206 | } |
src/main/java/com/bsth/service/realcontrol/ChildTaskPlanService.java
| @@ -3,6 +3,11 @@ package com.bsth.service.realcontrol; | @@ -3,6 +3,11 @@ package com.bsth.service.realcontrol; | ||
| 3 | import com.bsth.entity.realcontrol.ChildTaskPlan; | 3 | import com.bsth.entity.realcontrol.ChildTaskPlan; |
| 4 | import com.bsth.service.BaseService; | 4 | import com.bsth.service.BaseService; |
| 5 | 5 | ||
| 6 | +import java.util.Map; | ||
| 7 | + | ||
| 6 | public interface ChildTaskPlanService extends BaseService<ChildTaskPlan, Long>{ | 8 | public interface ChildTaskPlanService extends BaseService<ChildTaskPlan, Long>{ |
| 7 | 9 | ||
| 10 | + Map<String,Object> saveHistory(ChildTaskPlan childTask); | ||
| 11 | + | ||
| 12 | + Map<String,Object> delHistory(Long id); | ||
| 8 | } | 13 | } |
src/main/java/com/bsth/service/realcontrol/RealMapService.java
| @@ -10,7 +10,7 @@ public interface RealMapService { | @@ -10,7 +10,7 @@ public interface RealMapService { | ||
| 10 | 10 | ||
| 11 | Map<String,Object> carParkSpatialData(); | 11 | Map<String,Object> carParkSpatialData(); |
| 12 | 12 | ||
| 13 | - Map<String,Object> findRouteByLine(String lineCode); | 13 | + Map<String, Object> findRouteByLine(String idx); |
| 14 | 14 | ||
| 15 | Map<String,Object> findRouteAndStationByLine(String lineCode); | 15 | Map<String,Object> findRouteAndStationByLine(String lineCode); |
| 16 | 16 |
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
| @@ -138,7 +138,7 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | @@ -138,7 +138,7 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | ||
| 138 | 138 | ||
| 139 | Map<String,Object> changeBcType(Long id, String bcType, String remarks); | 139 | Map<String,Object> changeBcType(Long id, String bcType, String remarks); |
| 140 | 140 | ||
| 141 | - //Map<String,Object> historySave(ScheduleRealInfo sch); | 141 | + Map<String,Object> historySave(ScheduleRealInfo sch); |
| 142 | 142 | ||
| 143 | Map<String, Object> MapById(Long id) ; | 143 | Map<String, Object> MapById(Long id) ; |
| 144 | 144 | ||
| @@ -165,4 +165,8 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | @@ -165,4 +165,8 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | ||
| 165 | Map<String,Object> lateAdjust(String idx, float minute); | 165 | Map<String,Object> lateAdjust(String idx, float minute); |
| 166 | 166 | ||
| 167 | List<ScheduleRealInfo> allLate2(String idx); | 167 | List<ScheduleRealInfo> allLate2(String idx); |
| 168 | + | ||
| 169 | + Map<String,Object> addToHistory(ScheduleRealInfo sch); | ||
| 170 | + | ||
| 171 | + Map<String, Object> deleteToHistory(Long id); | ||
| 168 | } | 172 | } |
src/main/java/com/bsth/service/realcontrol/impl/ChildTaskPlanServiceImpl.java
| @@ -86,4 +86,33 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Lon | @@ -86,4 +86,33 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Lon | ||
| 86 | rs.put("t", sch); | 86 | rs.put("t", sch); |
| 87 | return rs; | 87 | return rs; |
| 88 | } | 88 | } |
| 89 | + | ||
| 90 | + @Override | ||
| 91 | + public Map<String, Object> saveHistory(ChildTaskPlan t) { | ||
| 92 | + Map<String, Object> rs = new HashMap(); | ||
| 93 | + try { | ||
| 94 | + ScheduleRealInfo sch = t.getSchedule(); | ||
| 95 | + //保存起终点名称 | ||
| 96 | + String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_"; | ||
| 97 | + if(StringUtils.isEmpty(t.getStartStationName())) | ||
| 98 | + t.setStartStationName(BasicData.getStationNameByCode(t.getStartStation(), prefix)); | ||
| 99 | + | ||
| 100 | + if(StringUtils.isEmpty(t.getEndStationName())) | ||
| 101 | + t.setEndStationName(BasicData.getStationNameByCode(t.getEndStation(), prefix)); | ||
| 102 | + //先持久化子任务 | ||
| 103 | + rs = super.save(t); | ||
| 104 | + | ||
| 105 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 106 | + }catch (Exception e){ | ||
| 107 | + logger.error("", e); | ||
| 108 | + rs.put("status", ResponseCode.ERROR); | ||
| 109 | + rs.put("msg", e.getMessage()); | ||
| 110 | + } | ||
| 111 | + return rs; | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + @Override | ||
| 115 | + public Map<String, Object> delHistory(Long id) { | ||
| 116 | + return super.delete(id); | ||
| 117 | + } | ||
| 89 | } | 118 | } |
src/main/java/com/bsth/service/realcontrol/impl/RealMapServiceImpl.java
| @@ -2,11 +2,15 @@ package com.bsth.service.realcontrol.impl; | @@ -2,11 +2,15 @@ package com.bsth.service.realcontrol.impl; | ||
| 2 | 2 | ||
| 3 | import com.bsth.common.ResponseCode; | 3 | import com.bsth.common.ResponseCode; |
| 4 | import com.bsth.controller.realcontrol.dto.StationSpatialData; | 4 | import com.bsth.controller.realcontrol.dto.StationSpatialData; |
| 5 | +import com.bsth.data.gpsdata.arrival.utils.GeoUtils; | ||
| 5 | import com.bsth.entity.CarPark; | 6 | import com.bsth.entity.CarPark; |
| 6 | import com.bsth.service.realcontrol.RealMapService; | 7 | import com.bsth.service.realcontrol.RealMapService; |
| 7 | import com.bsth.service.realcontrol.dto.SectionRouteCoords; | 8 | import com.bsth.service.realcontrol.dto.SectionRouteCoords; |
| 8 | import com.bsth.util.TransGPS; | 9 | import com.bsth.util.TransGPS; |
| 10 | +import com.google.common.base.Joiner; | ||
| 9 | import com.google.common.base.Splitter; | 11 | import com.google.common.base.Splitter; |
| 12 | +import com.google.common.collect.ArrayListMultimap; | ||
| 13 | +import com.vividsolutions.jts.geom.*; | ||
| 10 | import org.slf4j.Logger; | 14 | import org.slf4j.Logger; |
| 11 | import org.slf4j.LoggerFactory; | 15 | import org.slf4j.LoggerFactory; |
| 12 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -74,10 +78,17 @@ public class RealMapServiceImpl implements RealMapService { | @@ -74,10 +78,17 @@ public class RealMapServiceImpl implements RealMapService { | ||
| 74 | } | 78 | } |
| 75 | 79 | ||
| 76 | @Override | 80 | @Override |
| 77 | - public Map<String, Object> findRouteByLine(String lineCode) { | 81 | + public Map<String, Object> findRouteByLine(String idx) { |
| 78 | Map<String, Object> rs = new HashMap<>(); | 82 | Map<String, Object> rs = new HashMap<>(); |
| 79 | - String sql = "SELECT r.ID,r.LINE_CODE,r.SECTION_CODE,r.SECTIONROUTE_CODE,r.DIRECTIONS,s.SECTION_NAME,ST_AsText(s.GSECTION_VECTOR) GSECTION_VECTOR,s.SECTION_DISTANCE,s.SECTION_TIME FROM bsth_c_sectionroute r INNER JOIN bsth_c_section s on r.section_code=s.section_code WHERE r.line_code=? and r.destroy=0 order by sectionroute_code"; | ||
| 80 | - List<SectionRouteCoords> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(SectionRouteCoords.class), lineCode); | 83 | + StringBuilder inCond = new StringBuilder("("); |
| 84 | + List<String> codeList = Splitter.on(",").splitToList(idx); | ||
| 85 | + for(String lineCode : codeList){ | ||
| 86 | + inCond.append("'" + lineCode + "',"); | ||
| 87 | + } | ||
| 88 | + inCond.deleteCharAt(inCond.length() - 1).append(")"); | ||
| 89 | + | ||
| 90 | + String sql = "SELECT r.ID,r.LINE_CODE,r.SECTION_CODE,r.SECTIONROUTE_CODE,r.DIRECTIONS,s.SECTION_NAME,ST_AsText(s.GSECTION_VECTOR) GSECTION_VECTOR,s.SECTION_DISTANCE,s.SECTION_TIME FROM bsth_c_sectionroute r INNER JOIN bsth_c_section s on r.section_code=s.section_code WHERE r.line_code in "+inCond.toString()+" and r.destroy=0 order by sectionroute_code"; | ||
| 91 | + List<SectionRouteCoords> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(SectionRouteCoords.class)); | ||
| 81 | 92 | ||
| 82 | //排序 | 93 | //排序 |
| 83 | Collections.sort(list, new Comparator<SectionRouteCoords>() { | 94 | Collections.sort(list, new Comparator<SectionRouteCoords>() { |
| @@ -87,28 +98,40 @@ public class RealMapServiceImpl implements RealMapService { | @@ -87,28 +98,40 @@ public class RealMapServiceImpl implements RealMapService { | ||
| 87 | } | 98 | } |
| 88 | }); | 99 | }); |
| 89 | 100 | ||
| 90 | - List<String> upList = new ArrayList<>(), | ||
| 91 | - downList = new ArrayList<>(); | ||
| 92 | - | ||
| 93 | - String vectorStr = ""; | 101 | + ArrayListMultimap<String, SectionRouteCoords> listMultimap = ArrayListMultimap.create(); |
| 94 | for (SectionRouteCoords sr : list) { | 102 | for (SectionRouteCoords sr : list) { |
| 95 | - vectorStr = sr.getGsectionVector(); | ||
| 96 | - vectorStr = vectorStr.substring(11, vectorStr.length() - 2); | ||
| 97 | - | ||
| 98 | - if (sr.getDirections() == 0) | ||
| 99 | - upList.add(vectorStr); | ||
| 100 | - else | ||
| 101 | - downList.add(vectorStr); | 103 | + //按lineCode 分组 |
| 104 | + listMultimap.put(sr.getLineCode(), sr); | ||
| 105 | + } | ||
| 106 | + //坐标转换 | ||
| 107 | + Map<String, Object> subMap; | ||
| 108 | + Set<String> ks = listMultimap.keySet(); | ||
| 109 | + List<SectionRouteCoords> sublist; | ||
| 110 | + List<String> upList,downList; | ||
| 111 | + String vectorStr = ""; | ||
| 112 | + for(String k : ks){ | ||
| 113 | + subMap = new HashMap<>(); | ||
| 114 | + sublist = listMultimap.get(k); | ||
| 115 | + upList = new ArrayList<>(); | ||
| 116 | + downList = new ArrayList<>(); | ||
| 117 | + for(SectionRouteCoords sr : sublist){ | ||
| 118 | + vectorStr = sr.getGsectionVector(); | ||
| 119 | + vectorStr = vectorStr.substring(11, vectorStr.length() - 2); | ||
| 120 | + if (sr.getDirections() == 0) | ||
| 121 | + upList.add(vectorStr); | ||
| 122 | + else | ||
| 123 | + downList.add(vectorStr); | ||
| 124 | + } | ||
| 125 | + subMap.put("up", upList); | ||
| 126 | + //subMap.put("upJoins", jointCoords(upList)); | ||
| 127 | + subMap.put("down", downList); | ||
| 128 | + subMap.put("up_bd", multiWgsToBd(upList)); | ||
| 129 | + subMap.put("down_bd", multiWgsToBd(downList)); | ||
| 130 | + subMap.put("up_gcj", multiWgsToGcj(upList)); | ||
| 131 | + subMap.put("down_gcj", multiWgsToGcj(downList)); | ||
| 132 | + | ||
| 133 | + rs.put(k, subMap); | ||
| 102 | } | 134 | } |
| 103 | - | ||
| 104 | - rs.put("up", upList); | ||
| 105 | - rs.put("down", downList); | ||
| 106 | - rs.put("up_bd", multiWgsToBd(upList)); | ||
| 107 | - rs.put("down_bd", multiWgsToBd(downList)); | ||
| 108 | - rs.put("up_gcj", multiWgsToGcj(upList)); | ||
| 109 | - rs.put("down_gcj", multiWgsToGcj(downList)); | ||
| 110 | - | ||
| 111 | - rs.put("lineId", lineCode); | ||
| 112 | return rs; | 135 | return rs; |
| 113 | } | 136 | } |
| 114 | 137 | ||
| @@ -227,4 +250,171 @@ public class RealMapServiceImpl implements RealMapService { | @@ -227,4 +250,171 @@ public class RealMapServiceImpl implements RealMapService { | ||
| 227 | } | 250 | } |
| 228 | return gcjList; | 251 | return gcjList; |
| 229 | } | 252 | } |
| 253 | + | ||
| 254 | + /** | ||
| 255 | + * 将相连的路段拼接起来,去掉接口覆盖区域。 | ||
| 256 | + * 主要因为前端地图绘制时,过多的路段会带来性能消耗。在这里提前拼接好以减少路段数量 | ||
| 257 | + * @param list | ||
| 258 | + * @return | ||
| 259 | + */ | ||
| 260 | + private List<String> jointCoords(List<String> list){ | ||
| 261 | + List<String> rs = new ArrayList<>(); | ||
| 262 | + int len = list.size(); | ||
| 263 | + if(len == 0) | ||
| 264 | + return rs; | ||
| 265 | + | ||
| 266 | + String joinstr = list.get(0); | ||
| 267 | + String str; | ||
| 268 | + for(int i = 1; i < len; i ++){ | ||
| 269 | + str = jointCoords(joinstr.toString(), list.get(i)); | ||
| 270 | + if(str != null) | ||
| 271 | + joinstr = str; | ||
| 272 | + else{ | ||
| 273 | + rs.add(joinstr.toString()); | ||
| 274 | + joinstr = list.get(i); | ||
| 275 | + } | ||
| 276 | + } | ||
| 277 | + rs.add(joinstr); | ||
| 278 | + return rs; | ||
| 279 | + } | ||
| 280 | + | ||
| 281 | + static GeometryFactory geometryFactory = new GeometryFactory(); | ||
| 282 | + private String jointCoords(String c1, String c2){ | ||
| 283 | + String rs=null; | ||
| 284 | + LineString s1 = createLineString(c1); | ||
| 285 | + LineString s2 = createLineString(c2); | ||
| 286 | + | ||
| 287 | + | ||
| 288 | + /*if(s1.intersects(s2)){ | ||
| 289 | + //2条线相交 | ||
| 290 | + Geometry g = s1.intersection(s2); | ||
| 291 | + Point inPoint = geometryFactory.createPoint(g.getCoordinates()[0]); | ||
| 292 | + //s1 = replacePoint(s1, s1.getCoordinates().length - 1, inPoint); | ||
| 293 | + //s2 = replacePoint(s2, 0, inPoint); | ||
| 294 | + | ||
| 295 | + //rs = toString(s1); | ||
| 296 | + //rs += ("," + toString(s2)); | ||
| 297 | + rs = replacePoint(c1, s1.getCoordinates().length - 1, inPoint); | ||
| 298 | + rs += ("," + replacePoint(c2, 0, null)); | ||
| 299 | + } | ||
| 300 | + else {*/ | ||
| 301 | + //距离10米内的点直接连起来 | ||
| 302 | + double distance = GeoUtils.getDistanceLineToLine(s1.getStartPoint(), s1.getEndPoint(), s2.getStartPoint(), s2.getEndPoint()); | ||
| 303 | + if(distance < 10){ | ||
| 304 | + //s2 = replacePoint(s2, 0, s1.getEndPoint()); | ||
| 305 | + rs = c1; | ||
| 306 | + | ||
| 307 | + //获取c1终点到 c2 的垂直交点 | ||
| 308 | + //s1.getEndPoint() | ||
| 309 | + //rs += ("," + replacePoint(c2, 0, null)); | ||
| 310 | + //rs = toString(s1); | ||
| 311 | + //rs += ("," + toString(s2)); | ||
| 312 | + } | ||
| 313 | + //} | ||
| 314 | + return rs; | ||
| 315 | + } | ||
| 316 | + | ||
| 317 | + /** | ||
| 318 | + * 替换线段中指定的一个点位 | ||
| 319 | + * @param index | ||
| 320 | + * @param p | ||
| 321 | + | ||
| 322 | + private LineString replacePoint(LineString line, int index, Point p){ | ||
| 323 | + Coordinate[] array = line.getCoordinates(); | ||
| 324 | + array[index] = p.getCoordinate(); | ||
| 325 | + | ||
| 326 | + return geometryFactory.createLineString(array); | ||
| 327 | + }*/ | ||
| 328 | + | ||
| 329 | + private String replacePoint(String lineStr, int index, Point p){ | ||
| 330 | + List<String> list = new ArrayList<>(Splitter.on(",").splitToList(lineStr)); | ||
| 331 | + list.remove(index); | ||
| 332 | + if(p != null){ | ||
| 333 | + list.add(index, p.getX() + " " + p.getY()); | ||
| 334 | + } | ||
| 335 | + return Joiner.on(",").join(list); | ||
| 336 | + } | ||
| 337 | + | ||
| 338 | + private LineString createLineString(String c){ | ||
| 339 | + List<String> list = Splitter.on(",").splitToList(c); | ||
| 340 | + | ||
| 341 | + Coordinate[] cds = new Coordinate[list.size()]; | ||
| 342 | + String[] strs; | ||
| 343 | + for(int i = 0; i < list.size(); i ++){ | ||
| 344 | + strs = list.get(i).split(" "); | ||
| 345 | + cds[i] = new Coordinate(Float.parseFloat(strs[1]), Float.parseFloat(strs[0])); | ||
| 346 | + } | ||
| 347 | + return geometryFactory.createLineString(cds); | ||
| 348 | + } | ||
| 349 | + | ||
| 350 | + private String toString(LineString line){ | ||
| 351 | + Coordinate[] all = line.getCoordinates(); | ||
| 352 | + | ||
| 353 | + Coordinate[] cs; | ||
| 354 | + StringBuilder sb = new StringBuilder(""); | ||
| 355 | + for(int i = 0; i < all.length - 1; i ++){ | ||
| 356 | + cs = new Coordinate[2]; | ||
| 357 | + cs[0] = all[i]; | ||
| 358 | + cs[1] = all[i + 1]; | ||
| 359 | + | ||
| 360 | + sb.append("," + cs[0].y + " " + cs[0].x); | ||
| 361 | + sb.append("," + cs[1].y + " " + cs[1].x); | ||
| 362 | + } | ||
| 363 | + sb.deleteCharAt(0); | ||
| 364 | + return sb.toString(); | ||
| 365 | + } | ||
| 366 | + | ||
| 367 | +/* private String truncationEnd(LineString lineString, Point p){ | ||
| 368 | + Coordinate[] all = lineString.getCoordinates(); | ||
| 369 | + LineString sl; | ||
| 370 | + | ||
| 371 | + Coordinate[] cs; | ||
| 372 | + StringBuilder sb = new StringBuilder(""); | ||
| 373 | + double threshold = 0.1,distance; | ||
| 374 | + for(int i = 0; i < all.length - 1; i ++){ | ||
| 375 | + cs = new Coordinate[2]; | ||
| 376 | + cs[0] = all[i]; | ||
| 377 | + cs[1] = all[i + 1]; | ||
| 378 | + sl = geometryFactory.createLineString(cs); | ||
| 379 | + | ||
| 380 | + sb.append("," + cs[0].y + " " + cs[0].x); | ||
| 381 | + distance = GeoUtils.getDistanceFromLine(sl, p); | ||
| 382 | + if(distance < threshold){ | ||
| 383 | + sb.append("," + p.getY() + " " + p.getX()); | ||
| 384 | + break; | ||
| 385 | + } | ||
| 386 | + else | ||
| 387 | + sb.append("," + cs[1].y + " " + cs[1].x); | ||
| 388 | + } | ||
| 389 | + sb.deleteCharAt(0); | ||
| 390 | + return sb.toString(); | ||
| 391 | + } | ||
| 392 | + | ||
| 393 | + private String truncationStart(LineString lineString, Point p){ | ||
| 394 | + Coordinate[] all = lineString.getCoordinates(); | ||
| 395 | + LineString sl; | ||
| 396 | + | ||
| 397 | + Coordinate[] cs; | ||
| 398 | + StringBuilder sb = new StringBuilder(""); | ||
| 399 | + double threshold = 0.1,distance; | ||
| 400 | + for(int i = 0; i < all.length - 1; i ++){ | ||
| 401 | + cs = new Coordinate[2]; | ||
| 402 | + cs[0] = all[i]; | ||
| 403 | + cs[1] = all[i + 1]; | ||
| 404 | + sl = geometryFactory.createLineString(cs); | ||
| 405 | + | ||
| 406 | + distance = GeoUtils.getDistanceFromLine(sl, p); | ||
| 407 | + if(distance < threshold){ | ||
| 408 | + sb.append("," + p.getY() + " " + p.getX()); | ||
| 409 | + sb.append("," + cs[1].y + " " + cs[1].x); | ||
| 410 | + break; | ||
| 411 | + } | ||
| 412 | + else{ | ||
| 413 | + sb.append("," + cs[0].y + " " + cs[0].x); | ||
| 414 | + sb.append("," + cs[1].y + " " + cs[1].x); | ||
| 415 | + } | ||
| 416 | + } | ||
| 417 | + sb.deleteCharAt(0); | ||
| 418 | + return sb.toString(); | ||
| 419 | + }*/ | ||
| 230 | } | 420 | } |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -49,10 +49,7 @@ import com.bsth.service.sys.DutyEmployeeService; | @@ -49,10 +49,7 @@ import com.bsth.service.sys.DutyEmployeeService; | ||
| 49 | import com.bsth.util.*; | 49 | import com.bsth.util.*; |
| 50 | import com.bsth.websocket.handler.SendUtils; | 50 | import com.bsth.websocket.handler.SendUtils; |
| 51 | import com.google.common.base.Splitter; | 51 | import com.google.common.base.Splitter; |
| 52 | -import com.google.common.collect.ArrayListMultimap; | ||
| 53 | -import com.google.common.collect.BiMap; | ||
| 54 | import com.google.common.collect.Lists; | 52 | import com.google.common.collect.Lists; |
| 55 | -import com.google.common.collect.Multimap; | ||
| 56 | import org.apache.commons.lang3.StringEscapeUtils; | 53 | import org.apache.commons.lang3.StringEscapeUtils; |
| 57 | import org.apache.commons.lang3.StringUtils; | 54 | import org.apache.commons.lang3.StringUtils; |
| 58 | import org.joda.time.format.DateTimeFormat; | 55 | import org.joda.time.format.DateTimeFormat; |
| @@ -137,19 +134,60 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -137,19 +134,60 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 137 | Logger logger = LoggerFactory.getLogger(this.getClass()); | 134 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 138 | 135 | ||
| 139 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | 136 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), |
| 140 | - sdfMinute = new SimpleDateFormat("yyyy-MM-dd HH:mm"), sdfShort = new SimpleDateFormat("HH:mm"), | ||
| 141 | sdfSimple = new SimpleDateFormat("yyyyMMdd"); | 137 | sdfSimple = new SimpleDateFormat("yyyyMMdd"); |
| 142 | 138 | ||
| 139 | + | ||
| 140 | + /** | ||
| 141 | + * 车辆是否存在 | ||
| 142 | + * @param gsbm 公司编码 | ||
| 143 | + * @param nbbm 车辆自编号 | ||
| 144 | + * @return | ||
| 145 | + */ | ||
| 146 | + private boolean carExist(String gsbm, String nbbm){ | ||
| 147 | + return BasicData.deviceId2NbbmMap.inverse().containsKey(nbbm); | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + /** | ||
| 151 | + * 获取人员姓名 | ||
| 152 | + * @param gsbm 公司编码 | ||
| 153 | + * @param gh 人员工号 | ||
| 154 | + * @return | ||
| 155 | + */ | ||
| 156 | + private String getPersonName(String gsbm, String gh){ | ||
| 157 | + return BasicData.allPerson.get(gsbm + '-' + gh); | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + @Override | ||
| 161 | + public Iterable<ScheduleRealInfo> list(Map<String, Object> map) { | ||
| 162 | + Iterator<ScheduleRealInfo> iterator = super.list(map).iterator(); | ||
| 163 | + Set<ScheduleRealInfo> set = new HashSet<>(100); | ||
| 164 | + | ||
| 165 | + DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"); | ||
| 166 | + //计算时间戳 | ||
| 167 | + ScheduleRealInfo sch; | ||
| 168 | + while(iterator.hasNext()){ | ||
| 169 | + sch = iterator.next(); | ||
| 170 | + //待发时间戳 | ||
| 171 | + sch.setDfsjT(fmtyyyyMMddHHmm.parseMillis(sch.getRealExecDate() + sch.getDfsj())); | ||
| 172 | + //实发时间戳 | ||
| 173 | + if(StringUtils.isNotEmpty(sch.getFcsjActual())){ | ||
| 174 | + sch.setFcsjActualTime(fmtyyyyMMddHHmm.parseMillis(sch.getRealExecDate() + sch.getFcsjActual())); | ||
| 175 | + } | ||
| 176 | + set.add(sch); | ||
| 177 | + } | ||
| 178 | + return set; | ||
| 179 | + } | ||
| 180 | + | ||
| 143 | @Override | 181 | @Override |
| 144 | public Map<String, Collection<ScheduleRealInfo>> findByLines(String lines) { | 182 | public Map<String, Collection<ScheduleRealInfo>> findByLines(String lines) { |
| 145 | List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lines)); | 183 | List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lines)); |
| 146 | 184 | ||
| 147 | - Multimap<String, ScheduleRealInfo> mMap = ArrayListMultimap.create(); | 185 | + /*Multimap<String, ScheduleRealInfo> mMap = ArrayListMultimap.create(); |
| 148 | 186 | ||
| 149 | for (String lineCode : lineList) { | 187 | for (String lineCode : lineList) { |
| 150 | mMap.putAll(lineCode, dayOfSchedule.findByLineCode(lineCode)); | 188 | mMap.putAll(lineCode, dayOfSchedule.findByLineCode(lineCode)); |
| 151 | - } | ||
| 152 | - return mMap.asMap(); | 189 | + }*/ |
| 190 | + return dayOfSchedule.findByLineCodes(lineList); | ||
| 153 | } | 191 | } |
| 154 | 192 | ||
| 155 | private final static long DAY_TIME = 1000 * 60 * 60 * 24L; | 193 | private final static long DAY_TIME = 1000 * 60 * 60 * 24L; |
| @@ -317,6 +355,97 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -317,6 +355,97 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 317 | return rsList; | 355 | return rsList; |
| 318 | } | 356 | } |
| 319 | 357 | ||
| 358 | + /** | ||
| 359 | + * 添加到历史库 | ||
| 360 | + * @param t | ||
| 361 | + * @return | ||
| 362 | + */ | ||
| 363 | + @Override | ||
| 364 | + public Map<String, Object> addToHistory(ScheduleRealInfo t) { | ||
| 365 | + Map<String, Object> rs = new HashMap<>(); | ||
| 366 | + try { | ||
| 367 | + if (!carExist(t.getGsBm(), t.getClZbh())) { | ||
| 368 | + rs.put("msg", "车辆 " + t.getClZbh() + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!"); | ||
| 369 | + rs.put("status", ResponseCode.ERROR); | ||
| 370 | + return rs; | ||
| 371 | + } | ||
| 372 | + | ||
| 373 | + SysUser user = SecurityUtils.getCurrentUser(); | ||
| 374 | + //String schDate = DayOfSchedule.currSchDateMap.get(t.getXlBm()); | ||
| 375 | + | ||
| 376 | + SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"), sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); | ||
| 377 | + | ||
| 378 | + if (StringUtils.isEmpty(t.getjGh())) { | ||
| 379 | + rs.put("status", ResponseCode.ERROR); | ||
| 380 | + rs.put("msg", "驾驶员工号不能为空!"); | ||
| 381 | + return rs; | ||
| 382 | + } | ||
| 383 | + //截取驾驶员工号 | ||
| 384 | + if (t.getjGh().indexOf("-") != -1) { | ||
| 385 | + t.setjGh(t.getjGh().split("-")[1]); | ||
| 386 | + } | ||
| 387 | + //检查驾驶员工号 | ||
| 388 | + String jName = getPersonName(t.getGsBm() ,t.getjGh()); | ||
| 389 | + if(StringUtils.isEmpty(jName)){ | ||
| 390 | + rs.put("msg", t.getXlName() + "所属的公司编码下找不到工号为【" + t.getjGh() + "】的驾驶员"); | ||
| 391 | + rs.put("status", ResponseCode.ERROR); | ||
| 392 | + return rs; | ||
| 393 | + } | ||
| 394 | + else if(StringUtils.isEmpty(t.getjName())){ | ||
| 395 | + t.setjName(jName);//补上驾驶员名称 | ||
| 396 | + } | ||
| 397 | + | ||
| 398 | + //有售票员 | ||
| 399 | + if(StringUtils.isNotEmpty(t.getsGh())){ | ||
| 400 | + String sName = getPersonName(t.getGsBm() , t.getsGh()); | ||
| 401 | + if(StringUtils.isEmpty(sName)){ | ||
| 402 | + rs.put("msg", t.getXlName() + "所属的公司编码下找不到工号为【" + t.getjGh() + "】的售票员"); | ||
| 403 | + rs.put("status", ResponseCode.ERROR); | ||
| 404 | + return rs; | ||
| 405 | + }else if(StringUtils.isEmpty(t.getsName())){ | ||
| 406 | + t.setsName(sName);//补上售票员名称 | ||
| 407 | + } | ||
| 408 | + } | ||
| 409 | + | ||
| 410 | + //公司 和 分公司名称 | ||
| 411 | + t.setGsName(BasicData.businessCodeNameMap.get(t.getGsBm())); | ||
| 412 | + t.setFgsName(BasicData.businessFgsCodeNameMap.get(t.getGsBm() + "_" + t.getFgsBm())); | ||
| 413 | + | ||
| 414 | + //t.setScheduleDateStr(schDate); | ||
| 415 | + t.setScheduleDate(sdfyyyyMMdd.parse(t.getScheduleDateStr())); | ||
| 416 | + t.setRealExecDate(t.getScheduleDateStr()); | ||
| 417 | + t.setCreateBy(user); | ||
| 418 | + t.setSflj(true); | ||
| 419 | + t.setLate(false); | ||
| 420 | + t.setDfsj(t.getFcsj()); | ||
| 421 | + t.setZdsjT(sdfyyyyMMddHHmm.parse(t.getScheduleDateStr() + t.getZdsj()).getTime()); | ||
| 422 | + t.setJhlcOrig(t.getJhlc()); | ||
| 423 | + | ||
| 424 | + //班次历时 | ||
| 425 | + t.setBcsj(DateUtils.calcHHmmDiff(t.getFcsj(), t.getZdsj()) / 1000 / 60); | ||
| 426 | + | ||
| 427 | + //起终点名称 | ||
| 428 | + String prefix = t.getXlBm() + "_" + t.getXlDir() + "_"; | ||
| 429 | + t.setQdzName(BasicData.getStationNameByCode(t.getQdzCode(), prefix)); | ||
| 430 | + t.setZdzName(BasicData.getStationNameByCode(t.getZdzCode(), prefix)); | ||
| 431 | + | ||
| 432 | + //计算班次实际执行时间 | ||
| 433 | + schAttrCalculator.calcRealDate(t).calcAllTimeByFcsj(t); | ||
| 434 | + if (t.getZdsjT() < t.getFcsjT()) { | ||
| 435 | + rs.put("status", ResponseCode.ERROR); | ||
| 436 | + rs.put("msg", "起终点时间异常!"); | ||
| 437 | + return rs; | ||
| 438 | + } | ||
| 439 | + | ||
| 440 | + //实时入库 | ||
| 441 | + rs = super.save(t); | ||
| 442 | + } catch (Exception e) { | ||
| 443 | + logger.error("", e); | ||
| 444 | + rs.put("status", ResponseCode.ERROR); | ||
| 445 | + } | ||
| 446 | + return rs; | ||
| 447 | + } | ||
| 448 | + | ||
| 320 | 449 | ||
| 321 | /** | 450 | /** |
| 322 | * 临加班次 | 451 | * 临加班次 |
| @@ -325,7 +454,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -325,7 +454,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 325 | public Map<String, Object> save(ScheduleRealInfo t) { | 454 | public Map<String, Object> save(ScheduleRealInfo t) { |
| 326 | Map<String, Object> rs = new HashMap<>(); | 455 | Map<String, Object> rs = new HashMap<>(); |
| 327 | try { | 456 | try { |
| 328 | - if (BasicData.deviceId2NbbmMap.inverse().get(t.getClZbh()) == null) { | 457 | + if (!carExist(t.getGsBm(), t.getClZbh())) { |
| 329 | rs.put("msg", "车辆 " + t.getClZbh() + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!"); | 458 | rs.put("msg", "车辆 " + t.getClZbh() + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!"); |
| 330 | rs.put("status", ResponseCode.ERROR); | 459 | rs.put("status", ResponseCode.ERROR); |
| 331 | return rs; | 460 | return rs; |
| @@ -341,10 +470,36 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -341,10 +470,36 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 341 | rs.put("msg", "驾驶员工号不能为空!"); | 470 | rs.put("msg", "驾驶员工号不能为空!"); |
| 342 | return rs; | 471 | return rs; |
| 343 | } | 472 | } |
| 344 | - //截取工号 | 473 | + //截取驾驶员工号 |
| 345 | if (t.getjGh().indexOf("-") != -1) { | 474 | if (t.getjGh().indexOf("-") != -1) { |
| 346 | t.setjGh(t.getjGh().split("-")[1]); | 475 | t.setjGh(t.getjGh().split("-")[1]); |
| 347 | } | 476 | } |
| 477 | + //检查驾驶员工号 | ||
| 478 | + String jName = getPersonName(t.getGsBm() ,t.getjGh()); | ||
| 479 | + if(StringUtils.isEmpty(jName)){ | ||
| 480 | + rs.put("msg", t.getXlName() + "所属的公司编码下找不到工号为【" + t.getjGh() + "】的驾驶员"); | ||
| 481 | + rs.put("status", ResponseCode.ERROR); | ||
| 482 | + return rs; | ||
| 483 | + } | ||
| 484 | + else if(StringUtils.isEmpty(t.getjName())){ | ||
| 485 | + t.setjName(jName);//补上驾驶员名称 | ||
| 486 | + } | ||
| 487 | + | ||
| 488 | + //有售票员 | ||
| 489 | + if(StringUtils.isNotEmpty(t.getsGh())){ | ||
| 490 | + String sName = getPersonName(t.getGsBm() , t.getsGh()); | ||
| 491 | + if(StringUtils.isEmpty(sName)){ | ||
| 492 | + rs.put("msg", t.getXlName() + "所属的公司编码下找不到工号为【" + t.getjGh() + "】的售票员"); | ||
| 493 | + rs.put("status", ResponseCode.ERROR); | ||
| 494 | + return rs; | ||
| 495 | + }else if(StringUtils.isEmpty(t.getsName())){ | ||
| 496 | + t.setsName(sName);//补上售票员名称 | ||
| 497 | + } | ||
| 498 | + } | ||
| 499 | + | ||
| 500 | + //公司 和 分公司名称 | ||
| 501 | + t.setGsName(BasicData.businessCodeNameMap.get(t.getGsBm())); | ||
| 502 | + t.setFgsName(BasicData.businessFgsCodeNameMap.get(t.getGsBm() + "_" + t.getFgsBm())); | ||
| 348 | 503 | ||
| 349 | t.setScheduleDateStr(schDate); | 504 | t.setScheduleDateStr(schDate); |
| 350 | t.setScheduleDate(sdfyyyyMMdd.parse(schDate)); | 505 | t.setScheduleDate(sdfyyyyMMdd.parse(schDate)); |
| @@ -385,7 +540,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -385,7 +540,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 385 | dayOfSchedule.reCalcExecPlan(t.getClZbh()); | 540 | dayOfSchedule.reCalcExecPlan(t.getClZbh()); |
| 386 | 541 | ||
| 387 | 542 | ||
| 388 | - rs.put("ts", ts); | 543 | + rs.put("ts", ts); |
| 389 | rs.put("t", t); | 544 | rs.put("t", t); |
| 390 | } catch (Exception e) { | 545 | } catch (Exception e) { |
| 391 | logger.error("", e); | 546 | logger.error("", e); |
| @@ -394,6 +549,41 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -394,6 +549,41 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 394 | return rs; | 549 | return rs; |
| 395 | } | 550 | } |
| 396 | 551 | ||
| 552 | + /** | ||
| 553 | + * 删除历史表临加班次 | ||
| 554 | + * @param id | ||
| 555 | + * @return | ||
| 556 | + */ | ||
| 557 | + @Override | ||
| 558 | + public Map<String, Object> deleteToHistory(Long id) { | ||
| 559 | + Map<String, Object> rs = new HashMap<>(); | ||
| 560 | + rs.put("status", ResponseCode.ERROR); | ||
| 561 | + | ||
| 562 | + try { | ||
| 563 | + ScheduleRealInfo sch = super.findById(id); | ||
| 564 | + if (sch == null) { | ||
| 565 | + rs.put("msg", "无效的id号"); | ||
| 566 | + return rs; | ||
| 567 | + } | ||
| 568 | + | ||
| 569 | + if (!sch.isSflj()) { | ||
| 570 | + rs.put("msg", "你只能删除临加班次"); | ||
| 571 | + return rs; | ||
| 572 | + } | ||
| 573 | + | ||
| 574 | + //解除和调度指令的外键约束 | ||
| 575 | + jdbcTemplate.update(Constants.REMOVE_DIRECTIVE_SCH_FK, id); | ||
| 576 | + | ||
| 577 | + //数据库删除 | ||
| 578 | + rs = super.delete(id); | ||
| 579 | + }catch (Exception e){ | ||
| 580 | + logger.error("", e); | ||
| 581 | + rs.put("msg", e.getMessage()); | ||
| 582 | + } | ||
| 583 | + | ||
| 584 | + return rs; | ||
| 585 | + } | ||
| 586 | + | ||
| 397 | @Override | 587 | @Override |
| 398 | public Map<String, Object> delete(Long id) { | 588 | public Map<String, Object> delete(Long id) { |
| 399 | Map<String, Object> rs = new HashMap<>(); | 589 | Map<String, Object> rs = new HashMap<>(); |
| @@ -975,7 +1165,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -975,7 +1165,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 975 | String clZbh = map.get("clZbh"); | 1165 | String clZbh = map.get("clZbh"); |
| 976 | if (StringUtils.isNotEmpty(clZbh)) { | 1166 | if (StringUtils.isNotEmpty(clZbh)) { |
| 977 | //换车 | 1167 | //换车 |
| 978 | - if (!BasicData.deviceId2NbbmMap.inverse().containsKey(clZbh)) { | 1168 | + if (!carExist(sch.getGsBm(), clZbh)) { |
| 979 | rs.put("status", ResponseCode.ERROR); | 1169 | rs.put("status", ResponseCode.ERROR); |
| 980 | rs.put("msg", "车辆 " + clZbh + " 不存在!"); | 1170 | rs.put("msg", "车辆 " + clZbh + " 不存在!"); |
| 981 | return rs; | 1171 | return rs; |
| @@ -989,7 +1179,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -989,7 +1179,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 989 | */ | 1179 | */ |
| 990 | String jsy = map.get("jsy"); | 1180 | String jsy = map.get("jsy"); |
| 991 | if (StringUtils.isNotEmpty(jsy) && jsy.indexOf("/") != -1) { | 1181 | if (StringUtils.isNotEmpty(jsy) && jsy.indexOf("/") != -1) { |
| 992 | - persoChange(sch, jsy.split("/")[0]); | 1182 | + String jGh = jsy.split("/")[0]; |
| 1183 | + String jName = getPersonName(sch.getGsBm(), jGh); | ||
| 1184 | + if(StringUtils.isEmpty(jName)){ | ||
| 1185 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + jGh + "】的驾驶员"); | ||
| 1186 | + rs.put("status", ResponseCode.ERROR); | ||
| 1187 | + return rs; | ||
| 1188 | + } | ||
| 1189 | + persoChange(sch, jGh); | ||
| 993 | } | 1190 | } |
| 994 | 1191 | ||
| 995 | /** | 1192 | /** |
| @@ -997,7 +1194,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -997,7 +1194,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 997 | */ | 1194 | */ |
| 998 | String spy = map.get("spy"); | 1195 | String spy = map.get("spy"); |
| 999 | if (StringUtils.isNotEmpty(spy) && spy.indexOf("/") != -1 && !spy.equals("/")) { | 1196 | if (StringUtils.isNotEmpty(spy) && spy.indexOf("/") != -1 && !spy.equals("/")) { |
| 1000 | - persoChangeSPY(sch, spy.split("/")[0]); | 1197 | + String sGh = spy.split("/")[0]; |
| 1198 | + String sName = getPersonName(sch.getGsBm(), sGh); | ||
| 1199 | + if(StringUtils.isEmpty(sName)){ | ||
| 1200 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sGh + "】的售票员"); | ||
| 1201 | + rs.put("status", ResponseCode.ERROR); | ||
| 1202 | + return rs; | ||
| 1203 | + } | ||
| 1204 | + persoChangeSPY(sch, sGh); | ||
| 1001 | } | 1205 | } |
| 1002 | else{ | 1206 | else{ |
| 1003 | sch.setsGh(""); | 1207 | sch.setsGh(""); |
| @@ -2585,7 +2789,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -2585,7 +2789,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 2585 | list.add(t); | 2789 | list.add(t); |
| 2586 | } | 2790 | } |
| 2587 | 2791 | ||
| 2588 | - List<ScheduleRealInfo> listInfo2 = scheduleRealInfoRepository.scheduleByDateAndLineQp(line, date); | 2792 | + List<ScheduleRealInfo> listInfo2 = scheduleRealInfoRepository.scheduleByDateAndLine(line, date); |
| 2589 | List<ScheduleRealInfo> xList = new ArrayList<ScheduleRealInfo>(); | 2793 | List<ScheduleRealInfo> xList = new ArrayList<ScheduleRealInfo>(); |
| 2590 | List<ScheduleRealInfo> yList = new ArrayList<ScheduleRealInfo>(); | 2794 | List<ScheduleRealInfo> yList = new ArrayList<ScheduleRealInfo>(); |
| 2591 | List<ScheduleRealInfo> zList = new ArrayList<ScheduleRealInfo>(); | 2795 | List<ScheduleRealInfo> zList = new ArrayList<ScheduleRealInfo>(); |
| @@ -2702,12 +2906,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -2702,12 +2906,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 2702 | // String date = sdfMonth.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1)); | 2906 | // String date = sdfMonth.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1)); |
| 2703 | // String date = "2016-09-20"; | 2907 | // String date = "2016-09-20"; |
| 2704 | // System.out.println("shijian1:"+new Date()); | 2908 | // System.out.println("shijian1:"+new Date()); |
| 2705 | - List<Map<String, Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date,gsbm,fgsbm); | 2909 | + List<Map<String, Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date,gsbm,fgsbm,nbbm); |
| 2706 | // System.out.println("shijian2:"+new Date()); | 2910 | // System.out.println("shijian2:"+new Date()); |
| 2707 | // List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date); | 2911 | // List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date); |
| 2708 | List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill3(jGh, nbbm, date,gsbm,fgsbm); | 2912 | List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill3(jGh, nbbm, date,gsbm,fgsbm); |
| 2709 | // System.out.println("shijian3:"+new Date()); | 2913 | // System.out.println("shijian3:"+new Date()); |
| 2710 | for (int x = 0; x < yesterdayDataList.size(); x++) { | 2914 | for (int x = 0; x < yesterdayDataList.size(); x++) { |
| 2915 | + | ||
| 2711 | String jName = yesterdayDataList.get(x).get("jGh").toString(); | 2916 | String jName = yesterdayDataList.get(x).get("jGh").toString(); |
| 2712 | String clZbh = yesterdayDataList.get(x).get("clZbh").toString(); | 2917 | String clZbh = yesterdayDataList.get(x).get("clZbh").toString(); |
| 2713 | 2918 | ||
| @@ -2827,28 +3032,49 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -2827,28 +3032,49 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 2827 | Set<ScheduleRealInfo> set = new HashSet<>(); | 3032 | Set<ScheduleRealInfo> set = new HashSet<>(); |
| 2828 | 3033 | ||
| 2829 | ScheduleRealInfo sch; | 3034 | ScheduleRealInfo sch; |
| 2830 | - BiMap<String, String> map = BasicData.deviceId2NbbmMap.inverse(); | 3035 | + //BiMap<String, String> map = BasicData.deviceId2NbbmMap.inverse(); |
| 2831 | 3036 | ||
| 3037 | + String jGh,jName,sGh,sName; | ||
| 2832 | for (ChangePersonCar cpc : cpcs) { | 3038 | for (ChangePersonCar cpc : cpcs) { |
| 2833 | 3039 | ||
| 2834 | - if (cpc.getClZbh() != null && map.get(cpc.getClZbh()) == null) { | 3040 | + sch = dayOfSchedule.get(cpc.getSchId()); |
| 3041 | + if (sch == null) | ||
| 3042 | + continue; | ||
| 3043 | + | ||
| 3044 | + if (cpc.getClZbh() != null && !carExist(sch.getGsBm(), cpc.getClZbh())) { | ||
| 2835 | rs.put("msg", "车辆 " + cpc.getClZbh() + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!"); | 3045 | rs.put("msg", "车辆 " + cpc.getClZbh() + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!"); |
| 2836 | rs.put("status", ResponseCode.ERROR); | 3046 | rs.put("status", ResponseCode.ERROR); |
| 2837 | return rs; | 3047 | return rs; |
| 2838 | } | 3048 | } |
| 2839 | 3049 | ||
| 2840 | - sch = dayOfSchedule.get(cpc.getSchId()); | ||
| 2841 | - if (sch == null) | ||
| 2842 | - continue; | ||
| 2843 | - | ||
| 2844 | if (StringUtils.isNotEmpty(cpc.getJsy())) { | 3050 | if (StringUtils.isNotEmpty(cpc.getJsy())) { |
| 3051 | + jGh = cpc.getJsy().split("/")[0]; | ||
| 3052 | + jName = getPersonName(sch.getGsBm(), jGh); | ||
| 3053 | + if(StringUtils.isEmpty(jName)){ | ||
| 3054 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + jGh + "】的驾驶员"); | ||
| 3055 | + rs.put("status", ResponseCode.ERROR); | ||
| 3056 | + return rs; | ||
| 3057 | + } | ||
| 2845 | //换驾驶员 | 3058 | //换驾驶员 |
| 2846 | - persoChange(sch, cpc.getJsy().split("/")[0]); | 3059 | + persoChange(sch, jGh); |
| 3060 | + set.add(sch); | ||
| 2847 | } | 3061 | } |
| 2848 | 3062 | ||
| 2849 | //换售票员 | 3063 | //换售票员 |
| 2850 | if (StringUtils.isNotEmpty(cpc.getSpy())) { | 3064 | if (StringUtils.isNotEmpty(cpc.getSpy())) { |
| 2851 | - persoChangeSPY(sch, cpc.getSpy().split("/")[0]); | 3065 | + sGh = cpc.getSpy().split("/")[0]; |
| 3066 | + sName = getPersonName(sch.getGsBm(), sGh); | ||
| 3067 | + if(StringUtils.isEmpty(sName)){ | ||
| 3068 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sGh + "】的售票员"); | ||
| 3069 | + rs.put("status", ResponseCode.ERROR); | ||
| 3070 | + return rs; | ||
| 3071 | + } | ||
| 3072 | + persoChangeSPY(sch, sGh); | ||
| 3073 | + set.add(sch); | ||
| 3074 | + } | ||
| 3075 | + else if(StringUtils.isNotEmpty(sch.getsGh())){ | ||
| 3076 | + sch.setsGh(""); | ||
| 3077 | + sch.setsName(""); | ||
| 2852 | } | 3078 | } |
| 2853 | 3079 | ||
| 2854 | //换车 | 3080 | //换车 |
| @@ -2872,7 +3098,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -2872,7 +3098,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 2872 | public void persoChange(ScheduleRealInfo sch, String jGh) { | 3098 | public void persoChange(ScheduleRealInfo sch, String jGh) { |
| 2873 | if (sch.getjGh().equals(jGh)) | 3099 | if (sch.getjGh().equals(jGh)) |
| 2874 | return; | 3100 | return; |
| 2875 | - String jName = BasicData.allPerson.get(jGh); | 3101 | + String jName = getPersonName(sch.getGsBm() , jGh); |
| 2876 | if (StringUtils.isNotEmpty(jName)) { | 3102 | if (StringUtils.isNotEmpty(jName)) { |
| 2877 | 3103 | ||
| 2878 | if (jGh.indexOf("-") != -1) | 3104 | if (jGh.indexOf("-") != -1) |
| @@ -2891,7 +3117,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -2891,7 +3117,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 2891 | public void persoChangeSPY(ScheduleRealInfo sch, String sGh) { | 3117 | public void persoChangeSPY(ScheduleRealInfo sch, String sGh) { |
| 2892 | if (sch.getsGh().equals(sGh)) | 3118 | if (sch.getsGh().equals(sGh)) |
| 2893 | return; | 3119 | return; |
| 2894 | - String sName = BasicData.allPerson.get(sGh); | 3120 | + String sName = getPersonName(sch.getGsBm() , sGh); |
| 2895 | if (StringUtils.isNotEmpty(sName)) { | 3121 | if (StringUtils.isNotEmpty(sName)) { |
| 2896 | if (sGh.indexOf("-") != -1) | 3122 | if (sGh.indexOf("-") != -1) |
| 2897 | sch.setsGh(sGh.substring(sGh.indexOf("-") + 1)); | 3123 | sch.setsGh(sGh.substring(sGh.indexOf("-") + 1)); |
| @@ -3018,31 +3244,69 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -3018,31 +3244,69 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 3018 | return rs; | 3244 | return rs; |
| 3019 | } | 3245 | } |
| 3020 | 3246 | ||
| 3021 | - /* @Override | 3247 | + @Override |
| 3022 | public Map<String, Object> historySave(ScheduleRealInfo sch) { | 3248 | public Map<String, Object> historySave(ScheduleRealInfo sch) { |
| 3023 | Map<String, Object> rs = new HashMap<>(); | 3249 | Map<String, Object> rs = new HashMap<>(); |
| 3024 | rs.put("status", ResponseCode.ERROR); | 3250 | rs.put("status", ResponseCode.ERROR); |
| 3025 | 3251 | ||
| 3026 | ScheduleRealInfo oldSch = super.findById(sch.getId()); | 3252 | ScheduleRealInfo oldSch = super.findById(sch.getId()); |
| 3027 | - //修改车辆 | ||
| 3028 | - if (!oldSch.getClZbh().equals(sch.getClZbh())) { | ||
| 3029 | - Set<String> allCar = BasicData.deviceId2NbbmMap.values(); | ||
| 3030 | - if (!allCar.contains(sch.getClZbh())) { | ||
| 3031 | - rs.put("msg", "无效的车辆自编号"); | 3253 | + |
| 3254 | + //换车 | ||
| 3255 | + if (StringUtils.isNotEmpty(sch.getClZbh()) && !oldSch.getClZbh().equals(sch.getClZbh())) { | ||
| 3256 | + if (!carExist(oldSch.getGsBm(),sch.getClZbh())) { | ||
| 3257 | + rs.put("msg", "车辆 " + sch.getClZbh() + " 不存在!"); | ||
| 3032 | return rs; | 3258 | return rs; |
| 3033 | } else | 3259 | } else |
| 3034 | oldSch.setClZbh(sch.getClZbh()); | 3260 | oldSch.setClZbh(sch.getClZbh()); |
| 3035 | } | 3261 | } |
| 3036 | 3262 | ||
| 3037 | - //修改驾驶员 | ||
| 3038 | - if (!oldSch.getjGh().equals(sch.getjGh())) { | ||
| 3039 | - Map<String, String> allPer = BasicData.allPerson; | ||
| 3040 | - if (!allPer.containsKey(sch.getjGh())) { | ||
| 3041 | - rs.put("msg", "无效的驾驶员"); | 3263 | + //换驾驶员 |
| 3264 | + if (StringUtils.isNotEmpty(sch.getjGh()) && !oldSch.getjGh().equals(sch.getjGh())) { | ||
| 3265 | + String jName = getPersonName(oldSch.getGsBm(), sch.getjGh()); | ||
| 3266 | + if(StringUtils.isEmpty(jName)){ | ||
| 3267 | + rs.put("msg", oldSch.getXlName() + "所属的公司编码下找不到工号为【" + sch.getjGh() + "】的驾驶员"); | ||
| 3042 | return rs; | 3268 | return rs; |
| 3043 | - } else { | ||
| 3044 | - oldSch.setjGh(sch.getjGh()); | ||
| 3045 | - oldSch.setjName(allPer.get(oldSch.getjGh())); | 3269 | + } |
| 3270 | + persoChange(oldSch, sch.getjGh()); | ||
| 3271 | + } | ||
| 3272 | + | ||
| 3273 | + //换售票员 | ||
| 3274 | + if (StringUtils.isNotEmpty(sch.getsGh()) && !oldSch.getsGh().equals(sch.getsGh())) { | ||
| 3275 | + String sName = getPersonName(oldSch.getGsBm(), sch.getsGh()); | ||
| 3276 | + if(StringUtils.isEmpty(sName)){ | ||
| 3277 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sch.getsGh() + "】的售票员"); | ||
| 3278 | + return rs; | ||
| 3279 | + } | ||
| 3280 | + persoChangeSPY(oldSch, sch.getsGh()); | ||
| 3281 | + } | ||
| 3282 | + | ||
| 3283 | + //烂班 | ||
| 3284 | + boolean dest1 = oldSch.getStatus() == -1; | ||
| 3285 | + boolean dest2 = sch.getStatus() == -1; | ||
| 3286 | + if (!dest1 && dest2) { | ||
| 3287 | + oldSch.destroy(); | ||
| 3288 | + } | ||
| 3289 | + else if(dest1 && !dest2){ | ||
| 3290 | + //撤销烂班 | ||
| 3291 | + oldSch.setJhlc(oldSch.getJhlcOrig()); | ||
| 3292 | + oldSch.setStatus(0); | ||
| 3293 | + oldSch.calcStatus(); | ||
| 3294 | + } | ||
| 3295 | + | ||
| 3296 | + | ||
| 3297 | + /** | ||
| 3298 | + * 修改班次里程 | ||
| 3299 | + */ | ||
| 3300 | + if (!oldSch.getJhlc().equals(sch.getJhlc())) { | ||
| 3301 | + double jhlcNum = sch.getJhlc(); | ||
| 3302 | + //烂班 | ||
| 3303 | + if(jhlcNum == 0 && oldSch.getJhlcOrig() != 0) | ||
| 3304 | + oldSch.destroy(); | ||
| 3305 | + else { | ||
| 3306 | + oldSch.setJhlc(jhlcNum); | ||
| 3307 | + //临加班次,实际计划一起改 | ||
| 3308 | + if(oldSch.isSflj()) | ||
| 3309 | + oldSch.setJhlcOrig(jhlcNum); | ||
| 3046 | } | 3310 | } |
| 3047 | } | 3311 | } |
| 3048 | 3312 | ||
| @@ -3058,7 +3322,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -3058,7 +3322,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 3058 | scheduleRealInfoRepository.save(oldSch); | 3322 | scheduleRealInfoRepository.save(oldSch); |
| 3059 | rs.put("status", ResponseCode.SUCCESS); | 3323 | rs.put("status", ResponseCode.SUCCESS); |
| 3060 | return rs; | 3324 | return rs; |
| 3061 | - }*/ | 3325 | + } |
| 3062 | 3326 | ||
| 3063 | @Autowired | 3327 | @Autowired |
| 3064 | SvgAttributeRepository svgAttributeRepository; | 3328 | SvgAttributeRepository svgAttributeRepository; |
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
| @@ -1374,7 +1374,10 @@ public class ReportServiceImpl implements ReportService{ | @@ -1374,7 +1374,10 @@ public class ReportServiceImpl implements ReportService{ | ||
| 1374 | // TODO Auto-generated method stub | 1374 | // TODO Auto-generated method stub |
| 1375 | // 转大写 | 1375 | // 转大写 |
| 1376 | String nbbm =maps.get("nbbm").toString().toUpperCase(); | 1376 | String nbbm =maps.get("nbbm").toString().toUpperCase(); |
| 1377 | - String gsbm=maps.get("gsbm").toString().trim(); | 1377 | + String gsbm=""; |
| 1378 | + | ||
| 1379 | + if(maps.get("gsbm")!=null) | ||
| 1380 | + gsbm= maps.get("gsbm").toString().trim(); | ||
| 1378 | // String fgsbm=maps.get("fgsbm").toString().trim(); | 1381 | // String fgsbm=maps.get("fgsbm").toString().trim(); |
| 1379 | String xlbm=maps.get("xlbm").toString().trim(); | 1382 | String xlbm=maps.get("xlbm").toString().trim(); |
| 1380 | List<Map<String, String>> list = new ArrayList<Map<String, String>>(); | 1383 | List<Map<String, String>> list = new ArrayList<Map<String, String>>(); |
| @@ -1430,7 +1433,9 @@ public class ReportServiceImpl implements ReportService{ | @@ -1430,7 +1433,9 @@ public class ReportServiceImpl implements ReportService{ | ||
| 1430 | // TODO Auto-generated method stub | 1433 | // TODO Auto-generated method stub |
| 1431 | // 转大写 | 1434 | // 转大写 |
| 1432 | String jsy =maps.get("jsy").toString().toUpperCase(); | 1435 | String jsy =maps.get("jsy").toString().toUpperCase(); |
| 1433 | - String gsbm=maps.get("gsbm").toString().trim(); | 1436 | + String gsbm=""; |
| 1437 | + if(maps.get("gsbm")!=null) | ||
| 1438 | + gsbm=maps.get("gsbm").toString().trim(); | ||
| 1434 | // String fgsbm=maps.get("fgsbm").toString().trim(); | 1439 | // String fgsbm=maps.get("fgsbm").toString().trim(); |
| 1435 | List<Map<String, String>> list = new ArrayList<Map<String, String>>(); | 1440 | List<Map<String, String>> list = new ArrayList<Map<String, String>>(); |
| 1436 | Map<String, String> map; | 1441 | Map<String, String> map; |
src/main/java/com/bsth/service/schedule/PeopleCarPlanServiceImpl.java
| @@ -141,7 +141,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -141,7 +141,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 141 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | 141 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| 142 | List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>(); | 142 | List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>(); |
| 143 | 143 | ||
| 144 | - /*String company = ""; | 144 | + String company = ""; |
| 145 | String subCompany =""; | 145 | String subCompany =""; |
| 146 | if(map.get("company")!=null){ | 146 | if(map.get("company")!=null){ |
| 147 | company = map.get("company").toString(); | 147 | company = map.get("company").toString(); |
| @@ -149,7 +149,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -149,7 +149,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 149 | 149 | ||
| 150 | if(map.get("subCompany")!=null){ | 150 | if(map.get("subCompany")!=null){ |
| 151 | subCompany=map.get("subCompany").toString(); | 151 | subCompany=map.get("subCompany").toString(); |
| 152 | - }*/ | 152 | + } |
| 153 | String line = map.get("line").toString(); | 153 | String line = map.get("line").toString(); |
| 154 | String date = map.get("date").toString(); | 154 | String date = map.get("date").toString(); |
| 155 | String type = map.get("type").toString(); | 155 | String type = map.get("type").toString(); |
| @@ -164,9 +164,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -164,9 +164,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 164 | if(line.length() != 0){ | 164 | if(line.length() != 0){ |
| 165 | sql += " and xl_bm = '"+line+"'"; | 165 | sql += " and xl_bm = '"+line+"'"; |
| 166 | } | 166 | } |
| 167 | - /*if(company.length() != 0){ | 167 | + if(company.length() != 0){ |
| 168 | sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; | 168 | sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; |
| 169 | - }*/ | 169 | + } |
| 170 | 170 | ||
| 171 | list = jdbcTemplate.query(sql, | 171 | list = jdbcTemplate.query(sql, |
| 172 | new RowMapper<SchedulePlanInfo>(){ | 172 | new RowMapper<SchedulePlanInfo>(){ |
| @@ -298,6 +298,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -298,6 +298,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 298 | Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); | 298 | Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); |
| 299 | for(ScheduleRealInfo schedule : list){ | 299 | for(ScheduleRealInfo schedule : list){ |
| 300 | String key = schedule.getXlName(); | 300 | String key = schedule.getXlName(); |
| 301 | + if(key == null || key.trim().equals("")) | ||
| 302 | + continue; | ||
| 301 | if(!keyMap.containsKey(key)){ | 303 | if(!keyMap.containsKey(key)){ |
| 302 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | 304 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); |
| 303 | } | 305 | } |
| @@ -493,8 +495,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -493,8 +495,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 493 | Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); | 495 | Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); |
| 494 | Map<String, Object> modelMap = new HashMap<String, Object>(); | 496 | Map<String, Object> modelMap = new HashMap<String, Object>(); |
| 495 | 497 | ||
| 496 | - String company = map.get("company").toString(); | ||
| 497 | - String subCompany = map.get("subCompany").toString(); | 498 | + String company = ""; |
| 499 | + if(map.get("company")!=null) | ||
| 500 | + company=map.get("company").toString(); | ||
| 501 | + String subCompany = ""; | ||
| 502 | + if(map.get("subCompany")!=null) | ||
| 503 | + subCompany=map.get("subCompany").toString(); | ||
| 498 | String page = map.get("page").toString(); | 504 | String page = map.get("page").toString(); |
| 499 | String line = map.get("line").toString(); | 505 | String line = map.get("line").toString(); |
| 500 | String startDate = map.get("startDate").toString(); | 506 | String startDate = map.get("startDate").toString(); |
| @@ -514,9 +520,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -514,9 +520,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 514 | if(line.length() != 0){ | 520 | if(line.length() != 0){ |
| 515 | sql += " and xl_bm = '"+line+"'"; | 521 | sql += " and xl_bm = '"+line+"'"; |
| 516 | } | 522 | } |
| 517 | - if(company.length() != 0){ | ||
| 518 | - sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; | ||
| 519 | - } | 523 | +// if(company.length() != 0){ |
| 524 | + sql += " and gs_bm like %'"+company+"'% and fgs_bm like %'"+subCompany+"%'"; | ||
| 525 | +// } | ||
| 520 | sql += " and bc_type != 'in' and bc_type != 'out'"; | 526 | sql += " and bc_type != 'in' and bc_type != 'out'"; |
| 521 | 527 | ||
| 522 | list = jdbcTemplate.query(sql, | 528 | list = jdbcTemplate.query(sql, |
| @@ -888,6 +894,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -888,6 +894,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 888 | if(schedule.getBcType().equals("in") || schedule.getBcType().equals("out")) | 894 | if(schedule.getBcType().equals("in") || schedule.getBcType().equals("out")) |
| 889 | continue; | 895 | continue; |
| 890 | String key = schedule.getXlName(); | 896 | String key = schedule.getXlName(); |
| 897 | + if(key == null || key.trim().length() == 0) | ||
| 898 | + continue; | ||
| 891 | if(!keyMap.containsKey(key)) | 899 | if(!keyMap.containsKey(key)) |
| 892 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | 900 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); |
| 893 | keyMap.get(key).add(schedule); | 901 | keyMap.get(key).add(schedule); |
| @@ -1092,16 +1100,16 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1092,16 +1100,16 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1092 | keyMap.put(key, new ArrayList<Map<String, Object>>()); | 1100 | keyMap.put(key, new ArrayList<Map<String, Object>>()); |
| 1093 | keyMap.get(key).add(m); | 1101 | keyMap.get(key).add(m); |
| 1094 | } | 1102 | } |
| 1103 | + String companyName = "", subCompanyName = ""; | ||
| 1095 | for(String key : keyMap.keySet()){ | 1104 | for(String key : keyMap.keySet()){ |
| 1096 | Map<String, Object> tempMap = new HashMap<String, Object>(); | 1105 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| 1097 | Set<String> tempSet = new HashSet<String>(); | 1106 | Set<String> tempSet = new HashSet<String>(); |
| 1098 | int sjf = 0; | 1107 | int sjf = 0; |
| 1099 | int wqr = 0; | 1108 | int wqr = 0; |
| 1100 | - String companyName = "", subCompanyName = ""; | ||
| 1101 | for(Map<String, Object> m : keyMap.get(key)){ | 1109 | for(Map<String, Object> m : keyMap.get(key)){ |
| 1102 | - if(m.containsKey("company") && m.get("company").toString().length()!=0 && companyName.length()==0) | 1110 | + if(m.containsKey("company") && m.get("company")!=null && m.get("company").toString().length()!=0 && companyName.length()==0) |
| 1103 | companyName = m.get("company").toString(); | 1111 | companyName = m.get("company").toString(); |
| 1104 | - if(m.containsKey("subCompany") && m.get("subCompany").toString().length()!=0 && subCompanyName.length()==0) | 1112 | + if(m.containsKey("subCompany") && m.get("subCompany")!=null && m.get("subCompany").toString().length()!=0 && subCompanyName.length()==0) |
| 1105 | subCompanyName = m.get("subCompany").toString(); | 1113 | subCompanyName = m.get("subCompany").toString(); |
| 1106 | tempSet.add(m.get("id").toString()); | 1114 | tempSet.add(m.get("id").toString()); |
| 1107 | if(m.get("timestamp") != null){ | 1115 | if(m.get("timestamp") != null){ |
src/main/java/com/bsth/service/schedule/SchedulePlanInfoService.java
| 1 | package com.bsth.service.schedule; | 1 | package com.bsth.service.schedule; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.schedule.SchedulePlanInfo; | 3 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 4 | -import com.bsth.service.BaseService; | 4 | +import org.apache.commons.lang3.StringUtils; |
| 5 | import org.joda.time.DateTime; | 5 | import org.joda.time.DateTime; |
| 6 | 6 | ||
| 7 | +import java.sql.ResultSet; | ||
| 8 | +import java.sql.SQLException; | ||
| 7 | import java.util.ArrayList; | 9 | import java.util.ArrayList; |
| 10 | +import java.util.Arrays; | ||
| 8 | import java.util.Date; | 11 | import java.util.Date; |
| 9 | import java.util.List; | 12 | import java.util.List; |
| 10 | 13 | ||
| 11 | /** | 14 | /** |
| 12 | * Created by xu on 16/6/16. | 15 | * Created by xu on 16/6/16. |
| 13 | */ | 16 | */ |
| 14 | -public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, Long> { | 17 | +public interface SchedulePlanInfoService extends BService<SchedulePlanInfo, Long> { |
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 查找排班计划汇总数据。 | ||
| 21 | + * @param xlId 线路Id | ||
| 22 | + * @param scheduleDate 排班时间 | ||
| 23 | + * @return | ||
| 24 | + */ | ||
| 25 | + List<SchedulePlanGroupInfo> findSchedulePlanGroupInfo(Integer xlId, Date scheduleDate); | ||
| 26 | + | ||
| 15 | /** | 27 | /** |
| 28 | + * 排班计划分组信息。 | ||
| 29 | + */ | ||
| 30 | + static class SchedulePlanGroupInfo implements Comparable<SchedulePlanGroupInfo> { | ||
| 31 | + //------------------ 分组字段 ----------------// | ||
| 32 | + /** 线路Id */ | ||
| 33 | + private Integer xlId; | ||
| 34 | + /** 线路名字 */ | ||
| 35 | + private String xlName; | ||
| 36 | + /** 排班时间 */ | ||
| 37 | + private Date scheduleDate; | ||
| 38 | + /** 路牌Id */ | ||
| 39 | + private Long lpId; | ||
| 40 | + /** 路牌名字 */ | ||
| 41 | + private String lpName; | ||
| 42 | + | ||
| 43 | + //------------------ 聚合数据(按照发车顺序号排序的 asc) ----------------// | ||
| 44 | + /** 车辆自编号s */ | ||
| 45 | + private List<String> clZbhs; | ||
| 46 | + /** 出场时间s */ | ||
| 47 | + private List<String> ccsjs; | ||
| 48 | + /** 进场时间s */ | ||
| 49 | + private List<String> jcsjs; | ||
| 50 | + /** 驾驶员名字s */ | ||
| 51 | + private List<String> jsyNames; | ||
| 52 | + /** 驾驶员工号s */ | ||
| 53 | + private List<String> jsyGhs; | ||
| 54 | + /** 售票员名字s */ | ||
| 55 | + private List<String> spyNames; | ||
| 56 | + /** 售票员工号s */ | ||
| 57 | + private List<String> spyGhs; | ||
| 58 | + | ||
| 59 | + /** 修改时间 */ | ||
| 60 | + private Date updateDate; | ||
| 61 | + /** 修改人名 */ | ||
| 62 | + private String updateByName; | ||
| 63 | + /** 时刻表名字 */ | ||
| 64 | + private String ttInfoName; | ||
| 65 | + | ||
| 66 | + @Override | ||
| 67 | + public int compareTo(SchedulePlanGroupInfo o) { | ||
| 68 | + // 路牌名字排序,数字路牌名在前,非数字在后 | ||
| 69 | + // 数字按照从小到大排序,非数字按照字符串从小到大排列 | ||
| 70 | + | ||
| 71 | + if (StringUtils.isNumeric(this.lpName)) { | ||
| 72 | + if (StringUtils.isNumeric(o.lpName)) { | ||
| 73 | + return Long.valueOf(this.lpName).compareTo(Long.valueOf(o.lpName)); | ||
| 74 | + } else { | ||
| 75 | + return -1; | ||
| 76 | + } | ||
| 77 | + } else { | ||
| 78 | + if (StringUtils.isNumeric(o.lpName)) { | ||
| 79 | + return 1; | ||
| 80 | + } else { | ||
| 81 | + return this.lpName.compareTo(o.lpName); | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + public static String generateSelectSql() { | ||
| 87 | + return "select " + | ||
| 88 | + "info.xl as xlId " + | ||
| 89 | + ", info.xl_name as xlName " + | ||
| 90 | + ", info.schedule_date as scheduleDate " + | ||
| 91 | + ", gbi.id as lpId " + | ||
| 92 | + ", info.lp_name as lpName " + | ||
| 93 | + ", GROUP_CONCAT(distinct info.cl_zbh order by info.fcno) as clzbhs " + | ||
| 94 | + ", GROUP_CONCAT(info.fcsj order by info.fcno) as fcsjs " + | ||
| 95 | + ", GROUP_CONCAT(info.bc_type order by info.fcno) as bctypes " + | ||
| 96 | + ", GROUP_CONCAT(distinct info.j_name order by info.fcno) as jsyNames " + | ||
| 97 | + ", GROUP_CONCAT(distinct info.j_gh order by info.fcno) as jsyGhs " + | ||
| 98 | + ", GROUP_CONCAT(distinct info.s_name order by info.fcno) as spyNames " + | ||
| 99 | + ", GROUP_CONCAT(distinct info.s_gh order by info.fcno) as spyGhs " + | ||
| 100 | + ", max(info.update_date) as updateDate " + | ||
| 101 | + ", max(user.user_name) as updateUserName " + | ||
| 102 | + ", max(info.tt_info_name) as ttInfoName " + | ||
| 103 | + "from bsth_c_s_sp_info info left join bsth_c_sys_user user on info.update_by = user.id " + | ||
| 104 | + "left join bsth_c_s_gbi gbi on info.lp = gbi.id " + | ||
| 105 | + "where info.xl = ? and info.schedule_date = ? " + | ||
| 106 | + "group by info.xl, info.xl_name, info.schedule_date, info.lp, info.lp_name " + | ||
| 107 | + "order by info.xl, info.schedule_date, gbi.lp_no "; | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + public void setFromResult(ResultSet rs) throws SQLException { | ||
| 111 | + this.xlId = rs.getInt("xlId"); | ||
| 112 | + this.xlName = rs.getString("xlName"); | ||
| 113 | + this.scheduleDate = new Date(rs.getDate("scheduleDate").getTime()); | ||
| 114 | + this.lpId = rs.getLong("lpId"); | ||
| 115 | + this.lpName = rs.getString("lpName"); | ||
| 116 | + | ||
| 117 | + // 车辆自编号 | ||
| 118 | + this.clZbhs = new ArrayList<>(); | ||
| 119 | + String clzbhs_temp = rs.getString("clzbhs"); | ||
| 120 | + if (StringUtils.isNotEmpty(clzbhs_temp)) { | ||
| 121 | + this.clZbhs.addAll(Arrays.asList(clzbhs_temp.split(","))); | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + // 出场,进场时间 | ||
| 125 | + this.ccsjs = new ArrayList<>(); | ||
| 126 | + this.jcsjs = new ArrayList<>(); | ||
| 127 | + String fcsjs_temp = rs.getString("fcsjs"); | ||
| 128 | + String bctype_temp = rs.getString("bctypes"); | ||
| 129 | + if (StringUtils.isNotEmpty(fcsjs_temp) && StringUtils.isNotEmpty(bctype_temp)) { | ||
| 130 | + String[] fcsjs_array = fcsjs_temp.split(","); | ||
| 131 | + String[] bctype_array = bctype_temp.split(","); | ||
| 132 | + if (fcsjs_array.length == bctype_array.length) { | ||
| 133 | + for (int i = 0; i < fcsjs_array.length; i++) { | ||
| 134 | + if ("out".equals(bctype_array[i])) { | ||
| 135 | + this.ccsjs.add(fcsjs_array[i]); | ||
| 136 | + } else if ("in".equals(bctype_array[i])) { | ||
| 137 | + this.jcsjs.add(fcsjs_array[i]); | ||
| 138 | + } | ||
| 139 | + } | ||
| 140 | + } | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + // 驾驶员 | ||
| 144 | + this.jsyNames = new ArrayList<>(); | ||
| 145 | + String jsyNames_temp = rs.getString("jsyNames"); | ||
| 146 | + if (StringUtils.isNotEmpty(jsyNames_temp)) { | ||
| 147 | + this.jsyNames.addAll(Arrays.asList(jsyNames_temp.split(","))); | ||
| 148 | + } | ||
| 149 | + this.jsyGhs = new ArrayList<>(); | ||
| 150 | + String jsyGhs_temp = rs.getString("jsyGhs"); | ||
| 151 | + if (StringUtils.isNotEmpty(jsyGhs_temp)) { | ||
| 152 | + this.jsyGhs.addAll(Arrays.asList(jsyGhs_temp.split(","))); | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + // 售票员 | ||
| 156 | + this.spyNames = new ArrayList<>(); | ||
| 157 | + String spyNames_temp = rs.getString("spyNames"); | ||
| 158 | + if (StringUtils.isNotEmpty(spyNames_temp)) { | ||
| 159 | + this.spyNames.addAll(Arrays.asList(spyNames_temp.split(","))); | ||
| 160 | + } | ||
| 161 | + this.spyGhs = new ArrayList<>(); | ||
| 162 | + String spyGhs_temp = rs.getString("spyGhs"); | ||
| 163 | + if (StringUtils.isNotEmpty(spyGhs_temp)) { | ||
| 164 | + this.spyGhs.addAll(Arrays.asList(spyGhs_temp.split(","))); | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + this.updateDate = new Date(rs.getDate("updateDate").getTime()); | ||
| 168 | + this.updateByName = rs.getString("updateUserName"); | ||
| 169 | + this.ttInfoName = rs.getString("ttInfoName"); | ||
| 170 | + | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + public Integer getXlId() { | ||
| 174 | + return xlId; | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + public void setXlId(Integer xlId) { | ||
| 178 | + this.xlId = xlId; | ||
| 179 | + } | ||
| 180 | + | ||
| 181 | + public String getXlName() { | ||
| 182 | + return xlName; | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + public void setXlName(String xlName) { | ||
| 186 | + this.xlName = xlName; | ||
| 187 | + } | ||
| 188 | + | ||
| 189 | + public Date getScheduleDate() { | ||
| 190 | + return scheduleDate; | ||
| 191 | + } | ||
| 192 | + | ||
| 193 | + public void setScheduleDate(Date scheduleDate) { | ||
| 194 | + this.scheduleDate = scheduleDate; | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + public Long getLpId() { | ||
| 198 | + return lpId; | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + public void setLpId(Long lpId) { | ||
| 202 | + this.lpId = lpId; | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + public String getLpName() { | ||
| 206 | + return lpName; | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + public void setLpName(String lpName) { | ||
| 210 | + this.lpName = lpName; | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + public List<String> getClZbhs() { | ||
| 214 | + return clZbhs; | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + public void setClZbhs(List<String> clZbhs) { | ||
| 218 | + this.clZbhs = clZbhs; | ||
| 219 | + } | ||
| 220 | + | ||
| 221 | + public List<String> getCcsjs() { | ||
| 222 | + return ccsjs; | ||
| 223 | + } | ||
| 224 | + | ||
| 225 | + public void setCcsjs(List<String> ccsjs) { | ||
| 226 | + this.ccsjs = ccsjs; | ||
| 227 | + } | ||
| 228 | + | ||
| 229 | + public List<String> getJcsjs() { | ||
| 230 | + return jcsjs; | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + public void setJcsjs(List<String> jcsjs) { | ||
| 234 | + this.jcsjs = jcsjs; | ||
| 235 | + } | ||
| 236 | + | ||
| 237 | + public List<String> getJsyNames() { | ||
| 238 | + return jsyNames; | ||
| 239 | + } | ||
| 240 | + | ||
| 241 | + public void setJsyNames(List<String> jsyNames) { | ||
| 242 | + this.jsyNames = jsyNames; | ||
| 243 | + } | ||
| 244 | + | ||
| 245 | + public List<String> getJsyGhs() { | ||
| 246 | + return jsyGhs; | ||
| 247 | + } | ||
| 248 | + | ||
| 249 | + public void setJsyGhs(List<String> jsyGhs) { | ||
| 250 | + this.jsyGhs = jsyGhs; | ||
| 251 | + } | ||
| 252 | + | ||
| 253 | + public List<String> getSpyNames() { | ||
| 254 | + return spyNames; | ||
| 255 | + } | ||
| 256 | + | ||
| 257 | + public void setSpyNames(List<String> spyNames) { | ||
| 258 | + this.spyNames = spyNames; | ||
| 259 | + } | ||
| 260 | + | ||
| 261 | + public List<String> getSpyGhs() { | ||
| 262 | + return spyGhs; | ||
| 263 | + } | ||
| 264 | + | ||
| 265 | + public void setSpyGhs(List<String> spyGhs) { | ||
| 266 | + this.spyGhs = spyGhs; | ||
| 267 | + } | ||
| 268 | + | ||
| 269 | + public Date getUpdateDate() { | ||
| 270 | + return updateDate; | ||
| 271 | + } | ||
| 272 | + | ||
| 273 | + public void setUpdateDate(Date updateDate) { | ||
| 274 | + this.updateDate = updateDate; | ||
| 275 | + } | ||
| 276 | + | ||
| 277 | + public String getUpdateByName() { | ||
| 278 | + return updateByName; | ||
| 279 | + } | ||
| 280 | + | ||
| 281 | + public void setUpdateByName(String updateByName) { | ||
| 282 | + this.updateByName = updateByName; | ||
| 283 | + } | ||
| 284 | + | ||
| 285 | + public String getTtInfoName() { | ||
| 286 | + return ttInfoName; | ||
| 287 | + } | ||
| 288 | + | ||
| 289 | + public void setTtInfoName(String ttInfoName) { | ||
| 290 | + this.ttInfoName = ttInfoName; | ||
| 291 | + } | ||
| 292 | + } | ||
| 293 | + | ||
| 294 | + //---------------------------- 以下是过去版本 -------------------------------// | ||
| 295 | + /** | ||
| 16 | * 查找分组排班信息。 | 296 | * 查找分组排班信息。 |
| 17 | * @param xlid 线路Id | 297 | * @param xlid 线路Id |
| 18 | * @param scheduleDate 排班日期 | 298 | * @param scheduleDate 排班日期 |
src/main/java/com/bsth/service/schedule/SchedulePlanInfoServiceImpl.java renamed to src/main/java/com/bsth/service/schedule/impl/SchedulePlanInfoServiceImpl.java
| 1 | -package com.bsth.service.schedule; | 1 | +package com.bsth.service.schedule.impl; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.schedule.SchedulePlanInfo; | 3 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 4 | import com.bsth.repository.schedule.SchedulePlanInfoRepository; | 4 | import com.bsth.repository.schedule.SchedulePlanInfoRepository; |
| 5 | -import com.bsth.service.impl.BaseServiceImpl; | 5 | +import com.bsth.service.schedule.SchedulePlanInfoService; |
| 6 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 8 | +import org.springframework.jdbc.core.RowMapper; | ||
| 7 | import org.springframework.stereotype.Service; | 9 | import org.springframework.stereotype.Service; |
| 8 | import org.springframework.transaction.annotation.Transactional; | 10 | import org.springframework.transaction.annotation.Transactional; |
| 9 | 11 | ||
| 12 | +import java.sql.ResultSet; | ||
| 13 | +import java.sql.SQLException; | ||
| 10 | import java.util.ArrayList; | 14 | import java.util.ArrayList; |
| 15 | +import java.util.Collections; | ||
| 11 | import java.util.Date; | 16 | import java.util.Date; |
| 12 | import java.util.List; | 17 | import java.util.List; |
| 13 | 18 | ||
| @@ -15,7 +20,28 @@ import java.util.List; | @@ -15,7 +20,28 @@ import java.util.List; | ||
| 15 | * Created by xu on 16/6/16. | 20 | * Created by xu on 16/6/16. |
| 16 | */ | 21 | */ |
| 17 | @Service | 22 | @Service |
| 18 | -public class SchedulePlanInfoServiceImpl extends BaseServiceImpl<SchedulePlanInfo, Long> implements SchedulePlanInfoService { | 23 | +public class SchedulePlanInfoServiceImpl extends BServiceImpl<SchedulePlanInfo, Long> implements SchedulePlanInfoService { |
| 24 | + @Autowired | ||
| 25 | + private JdbcTemplate jdbcTemplate; | ||
| 26 | + | ||
| 27 | + @Override | ||
| 28 | + public List<SchedulePlanGroupInfo> findSchedulePlanGroupInfo(Integer xlId, Date scheduleDate) { | ||
| 29 | + String sql = SchedulePlanGroupInfo.generateSelectSql(); | ||
| 30 | + List<SchedulePlanGroupInfo> schedulePlanGroupInfos = jdbcTemplate.query(sql, new Object[]{xlId, scheduleDate}, new RowMapper<SchedulePlanGroupInfo>() { | ||
| 31 | + @Override | ||
| 32 | + public SchedulePlanGroupInfo mapRow(ResultSet resultSet, int i) throws SQLException { | ||
| 33 | + SchedulePlanGroupInfo schedulePlanGroupInfo = new SchedulePlanGroupInfo(); | ||
| 34 | + schedulePlanGroupInfo.setFromResult(resultSet); | ||
| 35 | + return schedulePlanGroupInfo; | ||
| 36 | + } | ||
| 37 | + }); | ||
| 38 | + | ||
| 39 | + // 排序 | ||
| 40 | + Collections.sort(schedulePlanGroupInfos); | ||
| 41 | + | ||
| 42 | + return schedulePlanGroupInfos; | ||
| 43 | + } | ||
| 44 | + | ||
| 19 | @Autowired | 45 | @Autowired |
| 20 | private SchedulePlanInfoRepository schedulePlanInfoRepository; | 46 | private SchedulePlanInfoRepository schedulePlanInfoRepository; |
| 21 | 47 |
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
| 1 | package com.bsth.service.schedule.impl; | 1 | package com.bsth.service.schedule.impl; |
| 2 | 2 | ||
| 3 | +import com.bsth.entity.Line; | ||
| 3 | import com.bsth.entity.schedule.SchedulePlan; | 4 | import com.bsth.entity.schedule.SchedulePlan; |
| 5 | +import com.bsth.entity.schedule.SchedulePlanInfo; | ||
| 4 | import com.bsth.entity.schedule.TTInfo; | 6 | import com.bsth.entity.schedule.TTInfo; |
| 5 | import com.bsth.entity.schedule.rule.ScheduleRule1Flat; | 7 | import com.bsth.entity.schedule.rule.ScheduleRule1Flat; |
| 6 | import com.bsth.repository.BusinessRepository; | 8 | import com.bsth.repository.BusinessRepository; |
| 7 | import com.bsth.repository.LineRepository; | 9 | import com.bsth.repository.LineRepository; |
| 8 | import com.bsth.repository.schedule.*; | 10 | import com.bsth.repository.schedule.*; |
| 9 | -import com.bsth.service.schedule.SchedulePlanRuleResultService; | ||
| 10 | import com.bsth.service.schedule.SchedulePlanService; | 11 | import com.bsth.service.schedule.SchedulePlanService; |
| 11 | import com.bsth.service.schedule.exception.ScheduleException; | 12 | import com.bsth.service.schedule.exception.ScheduleException; |
| 12 | import com.bsth.service.schedule.rules.ScheduleRuleService; | 13 | import com.bsth.service.schedule.rules.ScheduleRuleService; |
| 13 | import com.bsth.service.schedule.rules.plan.PlanCalcuParam_input; | 14 | import com.bsth.service.schedule.rules.plan.PlanCalcuParam_input; |
| 14 | import com.bsth.service.schedule.rules.plan.PlanResult; | 15 | import com.bsth.service.schedule.rules.plan.PlanResult; |
| 16 | +import com.bsth.service.schedule.rules.rerun.RerunRule_input; | ||
| 17 | +import com.bsth.service.schedule.rules.rerun.RerunRule_param; | ||
| 15 | import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; | 18 | import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; |
| 16 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; | 19 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; |
| 17 | import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; | 20 | import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; |
| @@ -36,8 +39,6 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | @@ -36,8 +39,6 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | ||
| 36 | @Autowired | 39 | @Autowired |
| 37 | private KieBase kieBase; | 40 | private KieBase kieBase; |
| 38 | @Autowired | 41 | @Autowired |
| 39 | - private SchedulePlanInfoRepository schedulePlanInfoRepository; | ||
| 40 | - @Autowired | ||
| 41 | private ScheduleRule1FlatRepository scheduleRule1FlatRepository; | 42 | private ScheduleRule1FlatRepository scheduleRule1FlatRepository; |
| 42 | @Autowired | 43 | @Autowired |
| 43 | private TTInfoRepository ttInfoRepository; | 44 | private TTInfoRepository ttInfoRepository; |
| @@ -52,8 +53,6 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | @@ -52,8 +53,6 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | ||
| 52 | @Autowired | 53 | @Autowired |
| 53 | private BusinessRepository businessRepository; | 54 | private BusinessRepository businessRepository; |
| 54 | @Autowired | 55 | @Autowired |
| 55 | - private SchedulePlanRuleResultService schedulePlanRuleResultService; | ||
| 56 | - @Autowired | ||
| 57 | private ScheduleRuleService scheduleRuleService; | 56 | private ScheduleRuleService scheduleRuleService; |
| 58 | 57 | ||
| 59 | /** 日志记录器 */ | 58 | /** 日志记录器 */ |
| @@ -64,7 +63,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | @@ -64,7 +63,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | ||
| 64 | * @param schedulePlan 排班计划对象 | 63 | * @param schedulePlan 排班计划对象 |
| 65 | * @param lpInfoResults_output 时刻表每日路牌的情况 | 64 | * @param lpInfoResults_output 时刻表每日路牌的情况 |
| 66 | */ | 65 | */ |
| 67 | - public ScheduleResults_output loopRuleOutput( | 66 | + private ScheduleResults_output loopRuleOutput( |
| 68 | SchedulePlan schedulePlan, | 67 | SchedulePlan schedulePlan, |
| 69 | LpInfoResults_output lpInfoResults_output) { | 68 | LpInfoResults_output lpInfoResults_output) { |
| 70 | // 1-1、构造drools规则输入数据,输出数据 | 69 | // 1-1、构造drools规则输入数据,输出数据 |
| @@ -105,7 +104,10 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | @@ -105,7 +104,10 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | ||
| 105 | // 执行完毕销毁,有日志的也要关闭 | 104 | // 执行完毕销毁,有日志的也要关闭 |
| 106 | session.dispose(); | 105 | session.dispose(); |
| 107 | 106 | ||
| 108 | - logger.info("循环规则输出={}", scheduleResults_output.showGuideboardDesc1()); | 107 | + // 保存循环规则结果数据 |
| 108 | + scheduleRuleService.generateRuleResult(scheduleResults_output.getSchedulePlanRuleResults()); | ||
| 109 | + | ||
| 110 | +// logger.info("循环规则输出={}", scheduleResults_output.showGuideboardDesc1()); | ||
| 109 | 111 | ||
| 110 | return scheduleResults_output; | 112 | return scheduleResults_output; |
| 111 | } | 113 | } |
| @@ -115,7 +117,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | @@ -115,7 +117,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | ||
| 115 | * @param schedulePlan 排班计划对象 | 117 | * @param schedulePlan 排班计划对象 |
| 116 | * @return TTInfoResults_output, LpInfoResults_output | 118 | * @return TTInfoResults_output, LpInfoResults_output |
| 117 | */ | 119 | */ |
| 118 | - public Object[] ttInfoOutput(SchedulePlan schedulePlan) { | 120 | + private Object[] ttInfoOutput(SchedulePlan schedulePlan) { |
| 119 | // 获取线路的所有未作废的时刻表 | 121 | // 获取线路的所有未作废的时刻表 |
| 120 | List<TTInfo> ttInfos = ttInfoRepository.findInCanceledByXl(schedulePlan.getXl()); | 122 | List<TTInfo> ttInfos = ttInfoRepository.findInCanceledByXl(schedulePlan.getXl()); |
| 121 | 123 | ||
| @@ -173,7 +175,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | @@ -173,7 +175,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | ||
| 173 | * @param ttInfoResults_output ttInfoOutput方法规则输出 | 175 | * @param ttInfoResults_output ttInfoOutput方法规则输出 |
| 174 | * @return PlanResult | 176 | * @return PlanResult |
| 175 | */ | 177 | */ |
| 176 | - public PlanResult planResultOutput( | 178 | + private PlanResult planResultOutput( |
| 177 | SchedulePlan schedulePlan, | 179 | SchedulePlan schedulePlan, |
| 178 | ScheduleResults_output scheduleResults_output, | 180 | ScheduleResults_output scheduleResults_output, |
| 179 | TTInfoResults_output ttInfoResults_output) { | 181 | TTInfoResults_output ttInfoResults_output) { |
| @@ -186,6 +188,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | @@ -186,6 +188,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | ||
| 186 | ); | 188 | ); |
| 187 | // 规则输出数据 | 189 | // 规则输出数据 |
| 188 | PlanResult planResult = new PlanResult(); | 190 | PlanResult planResult = new PlanResult(); |
| 191 | + planResult.setXlId(schedulePlan.getXl().getId().toString()); | ||
| 189 | 192 | ||
| 190 | // 1-2、构造drools session->载入数据->启动规则->计算->销毁session | 193 | // 1-2、构造drools session->载入数据->启动规则->计算->销毁session |
| 191 | // 创建session,内部配置的是stateful | 194 | // 创建session,内部配置的是stateful |
| @@ -214,15 +217,12 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | @@ -214,15 +217,12 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | ||
| 214 | 217 | ||
| 215 | } | 218 | } |
| 216 | 219 | ||
| 217 | - public SchedulePlan save(SchedulePlan schedulePlan) { | ||
| 218 | - // pre、如果排班的数据之前已经有了,删除之前的数据 | ||
| 219 | - Date startpre = new Date(); | ||
| 220 | - scheduleRuleService.deelteSchedulePlanInfo( | ||
| 221 | - schedulePlan.getXl().getId(), | ||
| 222 | - schedulePlan.getScheduleFromTime(), | ||
| 223 | - schedulePlan.getScheduleToTime()); | ||
| 224 | - Date endpre = new Date(); | ||
| 225 | - | 220 | + /** |
| 221 | + * 生成线路排班(不含套跑规则)。 | ||
| 222 | + * @param schedulePlan | ||
| 223 | + * @return | ||
| 224 | + */ | ||
| 225 | + private PlanResult schedulePlanWithOutRerun(SchedulePlan schedulePlan) { | ||
| 226 | // 1、时刻表数据及每日路牌数据计算 | 226 | // 1、时刻表数据及每日路牌数据计算 |
| 227 | Date start1 = new Date(); | 227 | Date start1 = new Date(); |
| 228 | Object[] ttInfoRets = ttInfoOutput(schedulePlan); | 228 | Object[] ttInfoRets = ttInfoOutput(schedulePlan); |
| @@ -238,21 +238,115 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | @@ -238,21 +238,115 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | ||
| 238 | PlanResult planResult = planResultOutput(schedulePlan, scheduleResults_output, ttInfoResults_output); | 238 | PlanResult planResult = planResultOutput(schedulePlan, scheduleResults_output, ttInfoResults_output); |
| 239 | Date end3 = new Date(); | 239 | Date end3 = new Date(); |
| 240 | 240 | ||
| 241 | + logger.info("drool时刻表每日路牌计算 {} ms,drool循环规则计算 {} ms,drool计划数据 {} ms", | ||
| 242 | + end1.getTime() - start1.getTime(), | ||
| 243 | + end2.getTime() - start2.getTime(), | ||
| 244 | + end3.getTime() - start3.getTime()); | ||
| 245 | + | ||
| 246 | + return planResult; | ||
| 247 | + } | ||
| 248 | + | ||
| 249 | + /** | ||
| 250 | + * 套跑计划排班数据。 | ||
| 251 | + * @param planResult | ||
| 252 | + */ | ||
| 253 | + private void rerunPlanResult(PlanResult planResult, SchedulePlan schedulePlan) { | ||
| 254 | + List<RerunRule_input> rerunRule_inputs = scheduleRuleService.findRerunrule(Integer.parseInt(planResult.getXlId())); | ||
| 255 | + logger.info("套跑数量 {} 组", rerunRule_inputs.size()); | ||
| 256 | + | ||
| 257 | + // 主线路id | ||
| 258 | + Integer mainXlId = schedulePlan.getXl().getId(); | ||
| 259 | + | ||
| 260 | + if (rerunRule_inputs.size() > 0) { | ||
| 261 | + // 找出是对应路牌类型的线路,计算循环规则输出 | ||
| 262 | + Set<String> xlids = new HashSet<>(); | ||
| 263 | + for (RerunRule_input rerunRule_input: rerunRule_inputs) { | ||
| 264 | + if ("dylp".equals(rerunRule_input.getType())) { | ||
| 265 | + xlids.add(rerunRule_input.getS_xl()); // 参与套跑的线路 | ||
| 266 | + } | ||
| 267 | + } | ||
| 268 | + | ||
| 269 | + List<ScheduleResults_output> scheduleResults_outputs = new ArrayList<>(); | ||
| 270 | + Date start1 = new Date(); | ||
| 271 | + for (String xlid: xlids) { | ||
| 272 | + schedulePlan.getXl().setId(Integer.parseInt(xlid)); // 套跑的线路默认跟着主线路设定走 | ||
| 273 | + // 获取套跑线路的循环规则计算输出 | ||
| 274 | + Object[] ttInfoRets = ttInfoOutput(schedulePlan); | ||
| 275 | + LpInfoResults_output lpInfoResults_output = (LpInfoResults_output) ttInfoRets[1]; | ||
| 276 | + ScheduleResults_output scheduleResults_output = loopRuleOutput(schedulePlan, lpInfoResults_output); | ||
| 277 | + scheduleResults_outputs.add(scheduleResults_output); | ||
| 278 | + } | ||
| 279 | + | ||
| 280 | + // 1-2、构造drools session->载入数据->启动规则->计算->销毁session | ||
| 281 | + // 创建session,内部配置的是stateful | ||
| 282 | + KieSession session = kieBase.newKieSession(); | ||
| 283 | + | ||
| 284 | + // 设置gloable对象,在drl中通过别名使用 | ||
| 285 | + session.setGlobal("planResult", planResult); | ||
| 286 | + session.setGlobal("log", logger); // 设置日志 | ||
| 287 | + | ||
| 288 | + session.setGlobal("carConfigInfoRepository", carConfigInfoRepository); | ||
| 289 | + session.setGlobal("employeeConfigInfoRepository", employeeConfigInfoRepository); | ||
| 290 | + | ||
| 291 | + // 载入数据 | ||
| 292 | + RerunRule_param rerunRule_param = new RerunRule_param(); | ||
| 293 | + rerunRule_param.setMxlid(planResult.getXlId()); | ||
| 294 | + rerunRule_param.setXlIds_dylp(xlids); | ||
| 295 | + session.insert(rerunRule_param); | ||
| 296 | + for (RerunRule_input rri: rerunRule_inputs) { | ||
| 297 | + session.insert(rri); | ||
| 298 | + } | ||
| 299 | + for (SchedulePlanInfo spi: planResult.getSchedulePlanInfos()) { | ||
| 300 | + session.insert(spi); | ||
| 301 | + } | ||
| 302 | + for (ScheduleResults_output sro: scheduleResults_outputs) { | ||
| 303 | + session.insert(sro); | ||
| 304 | + } | ||
| 305 | + | ||
| 306 | + // 执行rule | ||
| 307 | + session.fireAllRules(); | ||
| 308 | + | ||
| 309 | + // 执行完毕销毁,有日志的也要关闭 | ||
| 310 | + session.dispose(); | ||
| 311 | + | ||
| 312 | + Date end1 = new Date(); | ||
| 313 | + logger.info("套跑规则计算,耗时 {} ms", end1.getTime() - start1.getTime()); | ||
| 314 | + | ||
| 315 | + schedulePlan.getXl().setId(mainXlId); | ||
| 316 | + | ||
| 317 | + } | ||
| 318 | + | ||
| 319 | + } | ||
| 320 | + | ||
| 321 | + public SchedulePlan save(SchedulePlan schedulePlan) { | ||
| 322 | + // pre、如果排班的数据之前已经有了,删除之前的数据 | ||
| 323 | + Date startpre = new Date(); | ||
| 324 | + scheduleRuleService.deelteSchedulePlanInfo( | ||
| 325 | + schedulePlan.getXl().getId(), | ||
| 326 | + schedulePlan.getScheduleFromTime(), | ||
| 327 | + schedulePlan.getScheduleToTime()); | ||
| 328 | + Date endpre = new Date(); | ||
| 329 | + | ||
| 330 | + // 1、查找线路,这是主线路 | ||
| 331 | + Line xl = lineRepository.findOne(schedulePlan.getXl().getId()); | ||
| 332 | + logger.info("<--- 排班master线路 id={}, name={}, 开始排班", xl.getId(), xl.getName()); | ||
| 333 | + | ||
| 334 | + // 2、确定主线路排班(无套跑规则) | ||
| 335 | + PlanResult planResult = schedulePlanWithOutRerun(schedulePlan); | ||
| 336 | + | ||
| 337 | + // 3、确定套跑规则 | ||
| 338 | + rerunPlanResult(planResult, schedulePlan); | ||
| 339 | + | ||
| 241 | // 4、保存数据(jdbcTemplate 批量插入) | 340 | // 4、保存数据(jdbcTemplate 批量插入) |
| 242 | Date start4 = new Date(); | 341 | Date start4 = new Date(); |
| 243 | scheduleRuleService.generateSchedulePlan(schedulePlan, planResult.getSchedulePlanInfos()); | 342 | scheduleRuleService.generateSchedulePlan(schedulePlan, planResult.getSchedulePlanInfos()); |
| 244 | Date end4 = new Date(); | 343 | Date end4 = new Date(); |
| 245 | 344 | ||
| 246 | - | ||
| 247 | - logger.info("删除数据 {} ms,drool时刻表每日路牌计算 {} ms,drool循环规则计算 {} ms,drool计划数据 {} ms,插入数据 {} 条 耗时 {} ms", | 345 | + logger.info("删除数据 {} ms,保存主线路数据 {} 条 耗时 {} ms --->", |
| 248 | endpre.getTime() - startpre.getTime(), | 346 | endpre.getTime() - startpre.getTime(), |
| 249 | - end1.getTime() - start1.getTime(), | ||
| 250 | - end2.getTime() - start2.getTime(), | ||
| 251 | - end3.getTime() - start3.getTime(), | ||
| 252 | planResult.getSchedulePlanInfos().size(), | 347 | planResult.getSchedulePlanInfos().size(), |
| 253 | end4.getTime() - start4.getTime()); | 348 | end4.getTime() - start4.getTime()); |
| 254 | 349 | ||
| 255 | - | ||
| 256 | return new SchedulePlan(); | 350 | return new SchedulePlan(); |
| 257 | } | 351 | } |
| 258 | 352 |
src/main/java/com/bsth/service/schedule/impl/TTInfoDetailServiceImpl.java
| @@ -98,10 +98,10 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im | @@ -98,10 +98,10 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im | ||
| 98 | public List<Map<String, Object>> findZdAndTcc(int lineid, int xldir) { | 98 | public List<Map<String, Object>> findZdAndTcc(int lineid, int xldir) { |
| 99 | String sql = "select * from " + | 99 | String sql = "select * from " + |
| 100 | "(" + | 100 | "(" + |
| 101 | - "select station_code as zcode, station_name as zname from bsth_c_stationroute " + | 101 | + "select station_code as zcode, station_name as zname, concat(station_name, '(站点)') as aname from bsth_c_stationroute " + |
| 102 | "where destroy = 0 and line = ? and directions = ? " + | 102 | "where destroy = 0 and line = ? and directions = ? " + |
| 103 | "union all " + | 103 | "union all " + |
| 104 | - "select park_code as zcode, park_name as zname from bsth_c_car_park " + | 104 | + "select park_code as zcode, park_name as zname, concat(park_name, '(停车场)') as aname from bsth_c_car_park " + |
| 105 | "where destroy = 0 " + | 105 | "where destroy = 0 " + |
| 106 | ") a "; | 106 | ") a "; |
| 107 | 107 | ||
| @@ -349,7 +349,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im | @@ -349,7 +349,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im | ||
| 349 | 349 | ||
| 350 | // 计算班次里程 | 350 | // 计算班次里程 |
| 351 | if (StringUtils.isNotEmpty(jhlc)) { | 351 | if (StringUtils.isNotEmpty(jhlc)) { |
| 352 | - if ("in".equals(bctype) || "out".equals(bctype)) { | 352 | + if ("in".equals(bctype) || "out".equals(bctype) || "ldks".equals(bctype)) { |
| 353 | bc_ks += 1; | 353 | bc_ks += 1; |
| 354 | lc_ks += Double.valueOf(jhlc); | 354 | lc_ks += Double.valueOf(jhlc); |
| 355 | 355 |
src/main/java/com/bsth/service/schedule/rules/MyDroolsConfiguration.java
| @@ -71,6 +71,9 @@ public class MyDroolsConfiguration { | @@ -71,6 +71,9 @@ public class MyDroolsConfiguration { | ||
| 71 | kfs.write("src/main/resources/plan.drl", kieServices.getResources() | 71 | kfs.write("src/main/resources/plan.drl", kieServices.getResources() |
| 72 | .newInputStreamResource(this.getClass().getResourceAsStream( | 72 | .newInputStreamResource(this.getClass().getResourceAsStream( |
| 73 | "/rules/plan.drl"), "UTF-8")); | 73 | "/rules/plan.drl"), "UTF-8")); |
| 74 | + kfs.write("src/main/resources/rerun.drl", kieServices.getResources() | ||
| 75 | + .newInputStreamResource(this.getClass().getResourceAsStream( | ||
| 76 | + "/rules/rerun.drl"), "UTF-8")); | ||
| 74 | // TODO:还有其他drl.... | 77 | // TODO:还有其他drl.... |
| 75 | 78 | ||
| 76 | // 4、创建KieBuilder,使用KieFileSystem构建 | 79 | // 4、创建KieBuilder,使用KieFileSystem构建 |
src/main/java/com/bsth/service/schedule/rules/ScheduleRuleService.java
| @@ -3,6 +3,7 @@ package com.bsth.service.schedule.rules; | @@ -3,6 +3,7 @@ package com.bsth.service.schedule.rules; | ||
| 3 | import com.bsth.entity.schedule.SchedulePlan; | 3 | import com.bsth.entity.schedule.SchedulePlan; |
| 4 | import com.bsth.entity.schedule.SchedulePlanInfo; | 4 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 5 | import com.bsth.entity.schedule.temp.SchedulePlanRuleResult; | 5 | import com.bsth.entity.schedule.temp.SchedulePlanRuleResult; |
| 6 | +import com.bsth.service.schedule.rules.rerun.RerunRule_input; | ||
| 6 | 7 | ||
| 7 | import java.util.Date; | 8 | import java.util.Date; |
| 8 | import java.util.List; | 9 | import java.util.List; |
| @@ -30,6 +31,12 @@ public interface ScheduleRuleService { | @@ -30,6 +31,12 @@ public interface ScheduleRuleService { | ||
| 30 | void generateSchedulePlan(SchedulePlan schedulePlan, List<SchedulePlanInfo> schedulePlanInfos); | 31 | void generateSchedulePlan(SchedulePlan schedulePlan, List<SchedulePlanInfo> schedulePlanInfos); |
| 31 | 32 | ||
| 32 | /** | 33 | /** |
| 34 | + * 生成排班规则结果。 | ||
| 35 | + * @param schedulePlanRuleResults | ||
| 36 | + */ | ||
| 37 | + void generateRuleResult(List<SchedulePlanRuleResult> schedulePlanRuleResults); | ||
| 38 | + | ||
| 39 | + /** | ||
| 33 | * 删除排班计划。 | 40 | * 删除排班计划。 |
| 34 | * @param id 排班计划id | 41 | * @param id 排班计划id |
| 35 | */ | 42 | */ |
| @@ -42,5 +49,13 @@ public interface ScheduleRuleService { | @@ -42,5 +49,13 @@ public interface ScheduleRuleService { | ||
| 42 | * @param dateto 结束日期 | 49 | * @param dateto 结束日期 |
| 43 | */ | 50 | */ |
| 44 | void deelteSchedulePlanInfo(Integer xlid, Date datefrom, Date dateto); | 51 | void deelteSchedulePlanInfo(Integer xlid, Date datefrom, Date dateto); |
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 查找线路的套跑规则,并封装成规则输入对象。 | ||
| 55 | + * @param xlid | ||
| 56 | + * @return | ||
| 57 | + */ | ||
| 58 | + List<RerunRule_input> findRerunrule(Integer xlid); | ||
| 59 | + | ||
| 45 | } | 60 | } |
| 46 | 61 |
src/main/java/com/bsth/service/schedule/rules/ScheduleRuleServiceImpl.java
| @@ -3,13 +3,11 @@ package com.bsth.service.schedule.rules; | @@ -3,13 +3,11 @@ package com.bsth.service.schedule.rules; | ||
| 3 | import com.bsth.entity.schedule.SchedulePlan; | 3 | import com.bsth.entity.schedule.SchedulePlan; |
| 4 | import com.bsth.entity.schedule.SchedulePlanInfo; | 4 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 5 | import com.bsth.entity.schedule.temp.SchedulePlanRuleResult; | 5 | import com.bsth.entity.schedule.temp.SchedulePlanRuleResult; |
| 6 | +import com.bsth.service.schedule.rules.rerun.RerunRule_input; | ||
| 6 | import org.slf4j.Logger; | 7 | import org.slf4j.Logger; |
| 7 | import org.slf4j.LoggerFactory; | 8 | import org.slf4j.LoggerFactory; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | -import org.springframework.jdbc.core.BatchPreparedStatementSetter; | ||
| 10 | -import org.springframework.jdbc.core.JdbcTemplate; | ||
| 11 | -import org.springframework.jdbc.core.PreparedStatementCreator; | ||
| 12 | -import org.springframework.jdbc.core.RowMapper; | 10 | +import org.springframework.jdbc.core.*; |
| 13 | import org.springframework.jdbc.support.GeneratedKeyHolder; | 11 | import org.springframework.jdbc.support.GeneratedKeyHolder; |
| 14 | import org.springframework.jdbc.support.KeyHolder; | 12 | import org.springframework.jdbc.support.KeyHolder; |
| 15 | import org.springframework.stereotype.Service; | 13 | import org.springframework.stereotype.Service; |
| @@ -37,6 +35,70 @@ public class ScheduleRuleServiceImpl implements ScheduleRuleService { | @@ -37,6 +35,70 @@ public class ScheduleRuleServiceImpl implements ScheduleRuleService { | ||
| 37 | private JdbcTemplate jdbcTemplate; | 35 | private JdbcTemplate jdbcTemplate; |
| 38 | 36 | ||
| 39 | @Override | 37 | @Override |
| 38 | + public List<RerunRule_input> findRerunrule(Integer xlid) { | ||
| 39 | + String sql = "select " + | ||
| 40 | + "rerun_type as type " + | ||
| 41 | + ", rerun_xl as m_xl " + | ||
| 42 | + ", rerun_ttinfo as m_ttinfo " + | ||
| 43 | + ", rerun_lp as m_lp " + | ||
| 44 | + ", rerun_ttinfodetail_fcsjs as m_fcsjs " + | ||
| 45 | + ", use_xl as s_dylp_xl " + | ||
| 46 | + ", use_lp as s_dylp_lp " + | ||
| 47 | + ", use_type as s_dylp_type " + | ||
| 48 | + ", use_hrtype as s_dylp_hrtype " + | ||
| 49 | + ", cl as s_dybc_cl " + | ||
| 50 | + ", cl_zbh as s_dybc_clzbh " + | ||
| 51 | + ", j as s_dybc_j " + | ||
| 52 | + ", j_gh as s_dybc_jgh " + | ||
| 53 | + ", j_name as s_dybc_jname " + | ||
| 54 | + ", s as s_dybc_s " + | ||
| 55 | + ", s_gh as s_dybc_sgh " + | ||
| 56 | + ", s_name as s_dybc_sname " + | ||
| 57 | + "from bsth_c_s_rerun_rule " + | ||
| 58 | + "where is_cancel = 0 and rerun_xl = ? "; | ||
| 59 | + | ||
| 60 | + final List<RerunRule_input> rerunRule_inputs = new ArrayList<>(); | ||
| 61 | + | ||
| 62 | + jdbcTemplate.query(sql, new Object[]{xlid}, new RowCallbackHandler() { | ||
| 63 | + @Override | ||
| 64 | + public void processRow(ResultSet resultSet) throws SQLException { | ||
| 65 | + // 发车时间 | ||
| 66 | + String[] fcsjs = resultSet.getString("m_fcsjs").split(","); | ||
| 67 | + for (String fcsj: fcsjs) { | ||
| 68 | + RerunRule_input rerunRule_input = new RerunRule_input(); | ||
| 69 | + rerunRule_input.setXl(String.valueOf(resultSet.getInt("m_xl"))); | ||
| 70 | + rerunRule_input.setTtinfo(String.valueOf(resultSet.getLong("m_ttinfo"))); | ||
| 71 | + rerunRule_input.setLp(String.valueOf(resultSet.getLong("m_lp"))); | ||
| 72 | + rerunRule_input.setFcsj(fcsj); | ||
| 73 | + | ||
| 74 | + rerunRule_input.setType(resultSet.getString("type")); | ||
| 75 | + // 对应班次类型 | ||
| 76 | + if ("dylp".equals(resultSet.getString("type"))) { | ||
| 77 | + rerunRule_input.setS_xl(String.valueOf(resultSet.getInt("s_dylp_xl"))); | ||
| 78 | + rerunRule_input.setS_lp(String.valueOf(resultSet.getLong("s_dylp_lp"))); | ||
| 79 | + rerunRule_input.setUsetype(resultSet.getString("s_dylp_type")); | ||
| 80 | + rerunRule_input.setUserhrtype(resultSet.getString("s_dylp_hrtype")); | ||
| 81 | + } else if ("dybc".equals(resultSet.getString("type"))) { | ||
| 82 | + rerunRule_input.setCl(resultSet.getInt("s_dybc_cl")); | ||
| 83 | + rerunRule_input.setZbh(resultSet.getString("s_dybc_clzbh")); | ||
| 84 | + rerunRule_input.setJ(resultSet.getInt("s_dybc_j")); | ||
| 85 | + rerunRule_input.setJgh(resultSet.getString("s_dybc_jgh")); | ||
| 86 | + rerunRule_input.setJname(resultSet.getString("s_dybc_jname")); | ||
| 87 | + rerunRule_input.setS(resultSet.getInt("s_dybc_s")); | ||
| 88 | + rerunRule_input.setSgh(resultSet.getString("s_dybc_sgh")); | ||
| 89 | + rerunRule_input.setSname(resultSet.getString("s_dybc_sname")); | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + rerunRule_inputs.add(rerunRule_input); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + } | ||
| 96 | + }); | ||
| 97 | + | ||
| 98 | + return rerunRule_inputs; | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + @Override | ||
| 40 | public List<SchedulePlanRuleResult> findLastByXl(String xlid, Date from) { | 102 | public List<SchedulePlanRuleResult> findLastByXl(String xlid, Date from) { |
| 41 | String sql = "select * from bsth_c_s_sp_rule_rst a " + | 103 | String sql = "select * from bsth_c_s_sp_rule_rst a " + |
| 42 | "where exists (select 1 from " + | 104 | "where exists (select 1 from " + |
| @@ -75,6 +137,35 @@ public class ScheduleRuleServiceImpl implements ScheduleRuleService { | @@ -75,6 +137,35 @@ public class ScheduleRuleServiceImpl implements ScheduleRuleService { | ||
| 75 | jdbcTemplate.update(sql, xlid, datefrom, dateto); | 137 | jdbcTemplate.update(sql, xlid, datefrom, dateto); |
| 76 | } | 138 | } |
| 77 | 139 | ||
| 140 | + @Override | ||
| 141 | + public void generateRuleResult(List<SchedulePlanRuleResult> schedulePlanRuleResults) { | ||
| 142 | + // 、批量插入排班规则结果 | ||
| 143 | + List<List<SchedulePlanRuleResult>> lists = new ArrayList<>(); | ||
| 144 | + int batchSize = 2000; | ||
| 145 | + int loopCount = schedulePlanRuleResults.size() / batchSize; | ||
| 146 | + int otherCount = schedulePlanRuleResults.size() % batchSize; | ||
| 147 | + for (int i = 0; i < loopCount; i++) { | ||
| 148 | + lists.add(schedulePlanRuleResults.subList(i * batchSize, i * batchSize + batchSize)); | ||
| 149 | + } | ||
| 150 | + if (otherCount > 0) { | ||
| 151 | + lists.add(schedulePlanRuleResults.subList(loopCount * batchSize, loopCount * batchSize + otherCount)); | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + for (final List<SchedulePlanRuleResult> list : lists) { | ||
| 155 | + jdbcTemplate.batchUpdate(SchedulePlanRuleResult.generateInsertSql(), new BatchPreparedStatementSetter() { | ||
| 156 | + @Override | ||
| 157 | + public void setValues(PreparedStatement preparedStatement, int i) throws SQLException { | ||
| 158 | + SchedulePlanRuleResult schedulePlanRuleResult = list.get(i); | ||
| 159 | + schedulePlanRuleResult.preparedStatementSet(preparedStatement); | ||
| 160 | + } | ||
| 161 | + @Override | ||
| 162 | + public int getBatchSize() { | ||
| 163 | + return list.size(); | ||
| 164 | + } | ||
| 165 | + }); | ||
| 166 | + } | ||
| 167 | + } | ||
| 168 | + | ||
| 78 | @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) | 169 | @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) |
| 79 | @Override | 170 | @Override |
| 80 | public void generateSchedulePlan(final SchedulePlan schedulePlan, final List<SchedulePlanInfo> schedulePlanInfos) { | 171 | public void generateSchedulePlan(final SchedulePlan schedulePlan, final List<SchedulePlanInfo> schedulePlanInfos) { |
src/main/java/com/bsth/service/schedule/rules/plan/PlanResult.java
| @@ -9,6 +9,7 @@ import java.util.List; | @@ -9,6 +9,7 @@ import java.util.List; | ||
| 9 | * 计划输出。 | 9 | * 计划输出。 |
| 10 | */ | 10 | */ |
| 11 | public class PlanResult { | 11 | public class PlanResult { |
| 12 | + private String xlId; | ||
| 12 | private List<SchedulePlanInfo> schedulePlanInfos = new ArrayList<>(); | 13 | private List<SchedulePlanInfo> schedulePlanInfos = new ArrayList<>(); |
| 13 | 14 | ||
| 14 | public PlanResult() { | 15 | public PlanResult() { |
| @@ -25,4 +26,12 @@ public class PlanResult { | @@ -25,4 +26,12 @@ public class PlanResult { | ||
| 25 | public void setSchedulePlanInfos(List<SchedulePlanInfo> schedulePlanInfos) { | 26 | public void setSchedulePlanInfos(List<SchedulePlanInfo> schedulePlanInfos) { |
| 26 | this.schedulePlanInfos = schedulePlanInfos; | 27 | this.schedulePlanInfos = schedulePlanInfos; |
| 27 | } | 28 | } |
| 29 | + | ||
| 30 | + public String getXlId() { | ||
| 31 | + return xlId; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + public void setXlId(String xlId) { | ||
| 35 | + this.xlId = xlId; | ||
| 36 | + } | ||
| 28 | } | 37 | } |
src/main/java/com/bsth/service/schedule/rules/rerun/RerunRule_input.java
0 → 100644
| 1 | +package com.bsth.service.schedule.rules.rerun; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * Created by xu on 17/4/26. | ||
| 5 | + */ | ||
| 6 | +public class RerunRule_input { | ||
| 7 | + private String xl; // 主线路Id | ||
| 8 | + private String ttinfo; // 时刻表Id | ||
| 9 | + private String lp; // 路牌 | ||
| 10 | + private String fcsj; // 发车时间 | ||
| 11 | + | ||
| 12 | + private String type; // 套跑类型(dylp-对应路牌, dybc-对应班车) | ||
| 13 | + private String s_xl; // 对应路牌,线路Id | ||
| 14 | + private String s_lp; // 对应路牌,路牌Id | ||
| 15 | + private String usetype; // 对应路牌替换类型 | ||
| 16 | + private String userhrtype; // 对应路牌换人类型 | ||
| 17 | + | ||
| 18 | + private Integer cl; // 对应班车,车辆Id | ||
| 19 | + private String zbh; // 对应班车,车辆自编号 | ||
| 20 | + private Integer j; // 对应班车,驾驶员Id | ||
| 21 | + private String jgh; // 对应班车,驾驶员工号 | ||
| 22 | + private String jname; // 对应班车,驾驶员姓名 | ||
| 23 | + private Integer s; // 对应班车,售票员Id | ||
| 24 | + private String sgh; // 对应班车,售票员工号 | ||
| 25 | + private String sname; // 对应班车,售票员姓名 | ||
| 26 | + | ||
| 27 | + public String getXl() { | ||
| 28 | + return xl; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + public void setXl(String xl) { | ||
| 32 | + this.xl = xl; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public String getTtinfo() { | ||
| 36 | + return ttinfo; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + public void setTtinfo(String ttinfo) { | ||
| 40 | + this.ttinfo = ttinfo; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + public String getLp() { | ||
| 44 | + return lp; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + public void setLp(String lp) { | ||
| 48 | + this.lp = lp; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public String getFcsj() { | ||
| 52 | + return fcsj; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + public void setFcsj(String fcsj) { | ||
| 56 | + this.fcsj = fcsj; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + public String getType() { | ||
| 60 | + return type; | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + public void setType(String type) { | ||
| 64 | + this.type = type; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + public String getS_xl() { | ||
| 68 | + return s_xl; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + public void setS_xl(String s_xl) { | ||
| 72 | + this.s_xl = s_xl; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + public String getS_lp() { | ||
| 76 | + return s_lp; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + public void setS_lp(String s_lp) { | ||
| 80 | + this.s_lp = s_lp; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + public Integer getCl() { | ||
| 84 | + return cl; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + public void setCl(Integer cl) { | ||
| 88 | + this.cl = cl; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + public String getZbh() { | ||
| 92 | + return zbh; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + public void setZbh(String zbh) { | ||
| 96 | + this.zbh = zbh; | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + public Integer getJ() { | ||
| 100 | + return j; | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + public void setJ(Integer j) { | ||
| 104 | + this.j = j; | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + public String getJgh() { | ||
| 108 | + return jgh; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + public void setJgh(String jgh) { | ||
| 112 | + this.jgh = jgh; | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + public String getJname() { | ||
| 116 | + return jname; | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + public void setJname(String jname) { | ||
| 120 | + this.jname = jname; | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + public Integer getS() { | ||
| 124 | + return s; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + public void setS(Integer s) { | ||
| 128 | + this.s = s; | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + public String getSgh() { | ||
| 132 | + return sgh; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + public void setSgh(String sgh) { | ||
| 136 | + this.sgh = sgh; | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + public String getSname() { | ||
| 140 | + return sname; | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + public void setSname(String sname) { | ||
| 144 | + this.sname = sname; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + public String getUsetype() { | ||
| 148 | + return usetype; | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + public void setUsetype(String usetype) { | ||
| 152 | + this.usetype = usetype; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + public String getUserhrtype() { | ||
| 156 | + return userhrtype; | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + public void setUserhrtype(String userhrtype) { | ||
| 160 | + this.userhrtype = userhrtype; | ||
| 161 | + } | ||
| 162 | +} |
src/main/java/com/bsth/service/schedule/rules/rerun/RerunRule_param.java
0 → 100644
| 1 | +package com.bsth.service.schedule.rules.rerun; | ||
| 2 | + | ||
| 3 | +import java.util.Set; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * Created by xu on 17/4/27. | ||
| 7 | + */ | ||
| 8 | +public class RerunRule_param { | ||
| 9 | + /** 主线路id */ | ||
| 10 | + private String mxlid; | ||
| 11 | + | ||
| 12 | + /** 对应路牌的套跑线路 */ | ||
| 13 | + private Set<String> xlIds_dylp; | ||
| 14 | + | ||
| 15 | + // TODO: | ||
| 16 | + | ||
| 17 | + | ||
| 18 | + public Set<String> getXlIds_dylp() { | ||
| 19 | + return xlIds_dylp; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + public void setXlIds_dylp(Set<String> xlIds_dylp) { | ||
| 23 | + this.xlIds_dylp = xlIds_dylp; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + public String getMxlid() { | ||
| 27 | + return mxlid; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + public void setMxlid(String mxlid) { | ||
| 31 | + this.mxlid = mxlid; | ||
| 32 | + } | ||
| 33 | +} |
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleResult_output.java
| @@ -17,6 +17,9 @@ public class ScheduleResult_output { | @@ -17,6 +17,9 @@ public class ScheduleResult_output { | ||
| 17 | /** 车辆配置id */ | 17 | /** 车辆配置id */ |
| 18 | private String carConfigId; | 18 | private String carConfigId; |
| 19 | 19 | ||
| 20 | + /** 线路id */ | ||
| 21 | + private String xlId; | ||
| 22 | + | ||
| 20 | public DateTime getSd() { | 23 | public DateTime getSd() { |
| 21 | return sd; | 24 | return sd; |
| 22 | } | 25 | } |
| @@ -56,4 +59,12 @@ public class ScheduleResult_output { | @@ -56,4 +59,12 @@ public class ScheduleResult_output { | ||
| 56 | public void setCarConfigId(String carConfigId) { | 59 | public void setCarConfigId(String carConfigId) { |
| 57 | this.carConfigId = carConfigId; | 60 | this.carConfigId = carConfigId; |
| 58 | } | 61 | } |
| 62 | + | ||
| 63 | + public String getXlId() { | ||
| 64 | + return xlId; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + public void setXlId(String xlId) { | ||
| 68 | + this.xlId = xlId; | ||
| 69 | + } | ||
| 59 | } | 70 | } |
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleResults_output.java
| @@ -9,6 +9,9 @@ import java.util.*; | @@ -9,6 +9,9 @@ import java.util.*; | ||
| 9 | * 输出结果集合。 | 9 | * 输出结果集合。 |
| 10 | */ | 10 | */ |
| 11 | public class ScheduleResults_output { | 11 | public class ScheduleResults_output { |
| 12 | + /** 线路Id */ | ||
| 13 | + private String xlid; | ||
| 14 | + | ||
| 12 | /** 输出列表 */ | 15 | /** 输出列表 */ |
| 13 | private List<ScheduleResult_output> results = new ArrayList<>(); | 16 | private List<ScheduleResult_output> results = new ArrayList<>(); |
| 14 | 17 | ||
| @@ -71,5 +74,13 @@ public class ScheduleResults_output { | @@ -71,5 +74,13 @@ public class ScheduleResults_output { | ||
| 71 | return stringBuilder.toString(); | 74 | return stringBuilder.toString(); |
| 72 | } | 75 | } |
| 73 | 76 | ||
| 74 | - // TODO:人员输出 | 77 | + public String getXlid() { |
| 78 | + return xlid; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + public void setXlid(String xlid) { | ||
| 82 | + this.xlid = xlid; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | +// TODO:人员输出 | ||
| 75 | } | 86 | } |
src/main/java/com/bsth/websocket/handler/RealControlSocketHandler.java
| @@ -47,7 +47,7 @@ public class RealControlSocketHandler implements WebSocketHandler { | @@ -47,7 +47,7 @@ public class RealControlSocketHandler implements WebSocketHandler { | ||
| 47 | listenMap.remove(k, remMap.get(k)); | 47 | listenMap.remove(k, remMap.get(k)); |
| 48 | logger.info("web socket close, remove listen K: "+ k); | 48 | logger.info("web socket close, remove listen K: "+ k); |
| 49 | } | 49 | } |
| 50 | - logger.info("listen values size: " + listenMap.values().size()); | 50 | + logger.info("listen values size: " + listenMap.values().size() + " -CloseStatus:" + arg1); |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | @Override | 53 | @Override |