|
@@ -140,7 +140,10 @@ public class TblDzbcPathSchedulingController extends BaseController {
|
|
|
*/
|
|
*/
|
|
|
@Log(title = "定制班车-路线排班余票", businessType = BusinessType.FORCE)
|
|
@Log(title = "定制班车-路线排班余票", businessType = BusinessType.FORCE)
|
|
|
@GetMapping("/getCarTickets")
|
|
@GetMapping("/getCarTickets")
|
|
|
- public R<Object> getCarTickets(@RequestParam(required = true) String searchDate,@RequestParam(required = true) Long fromareaId,@RequestParam(required = true) Long toareaId) {
|
|
|
|
|
|
|
+ public R<Object> getCarTickets(@RequestParam(required = true) String searchDate,
|
|
|
|
|
+ @RequestParam(required = true) Long fromareaId,
|
|
|
|
|
+ @RequestParam(required = true) Long toareaId,
|
|
|
|
|
+ @RequestParam(required = false) Integer type) {
|
|
|
//优先从缓存中获取车量信息 缓存没有则初始化缓存
|
|
//优先从缓存中获取车量信息 缓存没有则初始化缓存
|
|
|
Date date = new Date();
|
|
Date date = new Date();
|
|
|
try{
|
|
try{
|
|
@@ -170,9 +173,21 @@ public class TblDzbcPathSchedulingController extends BaseController {
|
|
|
}else{
|
|
}else{
|
|
|
Date finalDate = date;
|
|
Date finalDate = date;
|
|
|
List<TblDzbcPathSchedulingVo> carTickets = dataMap.values().stream().filter(item -> {
|
|
List<TblDzbcPathSchedulingVo> carTickets = dataMap.values().stream().filter(item -> {
|
|
|
|
|
+ // 类型筛选逻辑
|
|
|
|
|
+ if (type != null) {
|
|
|
|
|
+ // 如果指定了类型,必须匹配类型
|
|
|
|
|
+ if (!Objects.equals(item.getType(), type)) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 如果没指定类型,默认排除固定线路 (type=2)
|
|
|
|
|
+ if (item.getType() != null && item.getType() == 2) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
if(item.getExt1()!=null){
|
|
if(item.getExt1()!=null){
|
|
|
JSONObject dataObject = JSONUtil.parseObj(item.getExt1()).getJSONObject("pathInfo");
|
|
JSONObject dataObject = JSONUtil.parseObj(item.getExt1()).getJSONObject("pathInfo");
|
|
|
- if(dataObject.getLong("startArea").equals(fromareaId) && dataObject.getLong("endArea").equals(toareaId)){
|
|
|
|
|
|
|
+ if(Objects.equals(dataObject.getLong("startArea"), fromareaId) && Objects.equals(dataObject.getLong("endArea"), toareaId)){
|
|
|
//大于1小时
|
|
//大于1小时
|
|
|
if(item.getMdate().getTime()- finalDate.getTime()> 3600*1000){
|
|
if(item.getMdate().getTime()- finalDate.getTime()> 3600*1000){
|
|
|
dataMap.remove(item.getId());
|
|
dataMap.remove(item.getId());
|