Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
travel-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
cloud
travel-cloud
Commits
4c3ed04b
提交
4c3ed04b
authored
11月 25, 2024
作者:
hzh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
代码优化
上级
2ec8923a
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
18 行增加
和
9 行删除
+18
-9
TrainController.java
.../org/dromara/server/controller/train/TrainController.java
+18
-9
没有找到文件。
ruoyi-modules/ruoyi-server/src/main/java/org/dromara/server/controller/train/TrainController.java
浏览文件 @
4c3ed04b
package
org
.
dromara
.
server
.
controller
.
train
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSON
;
import
io.seata.spring.annotation.GlobalTransactional
;
...
...
@@ -116,25 +117,33 @@ public class TrainController extends BaseController {
/**
* 火车票查询列表
*
* @param fromDate 出发日期
* @param fromStationCodeList 出发站点代码列表 (与出发城市二选一填写)
* @param toStationCodeList 到达站点代码列表 (与到达城市二选一填写)
* @param fromCity 出发城市
* @param toCity 到达城市
* @return 查询列表
* @throws InterruptedException
*/
@GlobalTransactional
(
timeoutMills
=
600000
)
@GetMapping
(
"/list"
)
public
R
<
List
<
org
.
dromara
.
common
.
ys
.
model
.
res
.
train
.
QueryModel
>>
list
(
@RequestParam
(
value
=
"fromDate"
)
String
fromDate
,
@RequestParam
(
value
=
"fromStationCode
"
,
required
=
false
)
String
fromStationCode
,
@RequestParam
(
value
=
"toStationCode
"
,
required
=
false
)
String
toStationCode
,
@RequestParam
(
value
=
"fromStationCode
List"
,
required
=
false
)
List
<
String
>
fromStationCodeList
,
@RequestParam
(
value
=
"toStationCode
List"
,
required
=
false
)
List
<
String
>
toStationCodeList
,
@RequestParam
(
value
=
"fromCity"
,
required
=
false
)
String
fromCity
,
@RequestParam
(
value
=
"toCity"
,
required
=
false
)
String
toCity
)
throws
InterruptedException
{
//获取出发站点
List
<
String
>
fromStationCode
List
=
getStationCodeList
(
fromStationCode
,
fromCity
);
List
<
String
>
fromStationCode
s
=
getStationCodeList
(
fromStationCodeList
,
fromCity
);
//获取目的站点
List
<
String
>
toStationCode
List
=
getStationCodeList
(
toStationCode
,
toCity
);
List
<
String
>
toStationCode
s
=
getStationCodeList
(
toStationCodeList
,
toCity
);
String
userId
=
getUserId
();
List
<
Callable
<
List
<
org
.
dromara
.
common
.
ys
.
model
.
res
.
train
.
QueryModel
>>>
taskList
=
fromStationCode
List
.
stream
().
flatMap
(
fromCode
->
toStationCode
List
.
stream
().
map
(
toCode
->
(
Callable
<
List
<
org
.
dromara
.
common
.
ys
.
model
.
res
.
train
.
QueryModel
>>)
()
->
{
List
<
Callable
<
List
<
org
.
dromara
.
common
.
ys
.
model
.
res
.
train
.
QueryModel
>>>
taskList
=
fromStationCode
s
.
stream
().
flatMap
(
fromCode
->
toStationCode
s
.
stream
().
map
(
toCode
->
(
Callable
<
List
<
org
.
dromara
.
common
.
ys
.
model
.
res
.
train
.
QueryModel
>>)
()
->
{
QueryModel
query
=
new
QueryModel
()
.
setFromDate
(
fromDate
)
.
setFromStationCode
(
fromCode
)
...
...
@@ -166,10 +175,10 @@ public class TrainController extends BaseController {
return
R
.
ok
(
list
);
}
private
List
<
String
>
getStationCodeList
(
String
stationCode
,
String
city
)
{
private
List
<
String
>
getStationCodeList
(
List
<
String
>
codeList
,
String
city
)
{
List
<
String
>
stationCodeList
=
new
ArrayList
<>();
if
(
StringUtils
.
isNotEmpty
(
stationCode
))
{
stationCodeList
.
add
(
stationCode
);
if
(
CollectionUtil
.
isNotEmpty
(
codeList
))
{
stationCodeList
.
add
All
(
codeList
);
}
else
{
stationCodeList
=
getStationList
().
stream
().
filter
(
item
->
StringUtils
.
equals
(
item
.
getCityName
(),
city
)).
map
(
AllStationModel:
:
getZddm
)
.
collect
(
Collectors
.
toList
());
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论