Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
travel-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
cloud
travel-cloud
Commits
6a9744b8
提交
6a9744b8
authored
11月 13, 2024
作者:
hzh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
代码优化
上级
176c8aff
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
45 行增加
和
18 行删除
+45
-18
AirportController.java
...romara/resource/controller/airport/AirportController.java
+11
-6
TrainController.java
...rg/dromara/resource/controller/train/TrainController.java
+27
-12
VehiclesController.java
...omara/resource/controller/vehicle/VehiclesController.java
+7
-0
没有找到文件。
ruoyi-modules/ruoyi-server/src/main/java/org/dromara/resource/controller/airport/AirportController.java
浏览文件 @
6a9744b8
package
org
.
dromara
.
resource
.
controller
.
airport
;
import
com.alibaba.fastjson.JSON
;
import
io.seata.spring.annotation.GlobalTransactional
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.dromara.common.core.domain.R
;
import
org.dromara.common.redis.utils.RedisUtils
;
import
org.dromara.common.ys.common.PageInfo
;
import
org.dromara.common.ys.constant.Cplx
;
import
org.dromara.common.ys.constant.TripType
;
...
...
@@ -21,10 +24,12 @@ import org.dromara.resource.base.BaseController;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
java.time.Duration
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 国内机票
* @author hzh
* @date 2024-10-28
**/
...
...
@@ -55,12 +60,12 @@ public class AirportController extends BaseController {
}
private
List
<
AirportModel
>
getAirPortList
()
{
// List<AirportModel> airPortList = JSON.parseArray(JSON.toJSONString(RedisUtils.getCacheLis
t(AIRPORT)), AirportModel.class);
//
if (CollectionUtils.isEmpty(airPortList)) {
//
airPortList = CommonResourceService.getAirportList(getUserId());
//
RedisUtils.setCacheObject(AIRPORT, airPortList, Duration.ofMinutes(60 * 60 * 24L));
//
}
return
CommonResourceService
.
getAirportList
(
getUserId
())
;
List
<
AirportModel
>
airPortList
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
RedisUtils
.
getCacheObjec
t
(
AIRPORT
)),
AirportModel
.
class
);
if
(
CollectionUtils
.
isEmpty
(
airPortList
))
{
airPortList
=
CommonResourceService
.
getAirportList
(
getUserId
());
RedisUtils
.
setCacheObject
(
AIRPORT
,
airPortList
,
Duration
.
ofMinutes
(
60
*
60
*
24L
));
}
return
airPortList
;
}
/**
...
...
ruoyi-modules/ruoyi-server/src/main/java/org/dromara/resource/controller/train/TrainController.java
浏览文件 @
6a9744b8
package
org
.
dromara
.
resource
.
controller
.
train
;
import
com.alibaba.fastjson.JSON
;
import
io.seata.spring.annotation.GlobalTransactional
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.dromara.common.core.domain.R
;
import
org.dromara.common.redis.utils.RedisUtils
;
import
org.dromara.common.ys.constant.TripType
;
import
org.dromara.common.ys.model.req.train.QueryModel
;
import
org.dromara.common.ys.model.res.comomResource.CityModel
;
...
...
@@ -17,6 +20,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.time.Duration
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.concurrent.Callable
;
...
...
@@ -26,6 +30,8 @@ import java.util.concurrent.Future;
import
java.util.stream.Collectors
;
/**
* 火车票相关
*
* @author hzh
* @date 2024-10-29
**/
...
...
@@ -38,6 +44,9 @@ public class TrainController extends BaseController {
private
static
final
String
TRAIN
=
"train:ys"
;
private
static
final
String
CITY
=
"city:ys"
;
/**
* 火车站列表
*/
@GlobalTransactional
(
timeoutMills
=
600000
)
@GetMapping
(
"/stationList"
)
public
R
<
List
<
AllStationModel
>>
stationList
(
@RequestParam
(
"keyword"
)
String
keyword
)
{
...
...
@@ -62,12 +71,12 @@ public class TrainController extends BaseController {
}
private
List
<
AllStationModel
>
getStationList
()
{
// List<AllStationModel> stationList = JSON.parseArray(JSON.toJSONString(RedisUtils.getCacheLis
t(TRAIN)), AllStationModel.class);
//
if (CollectionUtils.isEmpty(stationList)) {
//
stationList = TrainService.getAllStation(getUserId());
//
RedisUtils.setCacheObject(TRAIN, stationList, Duration.ofMinutes(60 * 60 * 24L));
//
}
return
TrainService
.
getAllStation
(
getUserId
())
;
List
<
AllStationModel
>
stationList
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
RedisUtils
.
getCacheObjec
t
(
TRAIN
)),
AllStationModel
.
class
);
if
(
CollectionUtils
.
isEmpty
(
stationList
))
{
stationList
=
TrainService
.
getAllStation
(
getUserId
());
RedisUtils
.
setCacheObject
(
TRAIN
,
stationList
,
Duration
.
ofMinutes
(
60
*
60
*
24L
));
}
return
stationList
;
}
/**
...
...
@@ -75,6 +84,9 @@ public class TrainController extends BaseController {
*/
private
static
final
int
NUM_THREADS
=
100
;
/**
* 火车票查询列表
*/
@GlobalTransactional
(
timeoutMills
=
600000
)
@GetMapping
(
"/list"
)
public
R
<
List
<
org
.
dromara
.
common
.
ys
.
model
.
res
.
train
.
QueryModel
>>
list
(
...
...
@@ -136,6 +148,9 @@ public class TrainController extends BaseController {
}
/**
* 城市列表
*/
@GlobalTransactional
(
timeoutMills
=
600000
)
@GetMapping
(
"/cityList"
)
public
R
<
List
<
CityModel
>>
list
(
@RequestParam
(
"keyword"
)
String
keyword
)
{
...
...
@@ -144,12 +159,12 @@ public class TrainController extends BaseController {
}
private
List
<
CityModel
>
getCityList
()
{
// List<CityModel> cityList = JSON.parseArray(JSON.toJSONString(RedisUtils.getCacheLis
t(CITY)), CityModel.class);
//
if (CollectionUtils.isEmpty(cityList)) {
//
cityList = CommonResourceService.getCityList(getUserId());
//
RedisUtils.setCacheObject(CITY, cityList, Duration.ofMinutes(60 * 60 * 24L));
//
}
return
CommonResourceService
.
getCityList
(
getUserId
())
;
List
<
CityModel
>
cityList
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
RedisUtils
.
getCacheObjec
t
(
CITY
)),
CityModel
.
class
);
if
(
CollectionUtils
.
isEmpty
(
cityList
))
{
cityList
=
CommonResourceService
.
getCityList
(
getUserId
());
RedisUtils
.
setCacheObject
(
CITY
,
cityList
,
Duration
.
ofMinutes
(
60
*
60
*
24L
));
}
return
cityList
;
}
}
ruoyi-modules/ruoyi-server/src/main/java/org/dromara/resource/controller/vehicle/VehiclesController.java
浏览文件 @
6a9744b8
...
...
@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 用车相关
* @author hzh
* @date 2024-10-29
**/
...
...
@@ -21,6 +22,9 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping
(
"/vehicle/ys"
)
public
class
VehiclesController
extends
BaseController
{
/**
* 即时用车查询
*/
@GlobalTransactional
(
timeoutMills
=
600000
)
@RequestMapping
(
"/immediate"
)
public
R
<
org
.
dromara
.
common
.
ys
.
model
.
res
.
vehicles
.
EstimateJsycPriceModel
>
immediate
(
EstimateJsycPriceModel
model
)
{
...
...
@@ -28,6 +32,9 @@ public class VehiclesController extends BaseController {
return
R
.
ok
(
VehiclesService
.
estimateJsycPrice
(
getUserId
(),
model
));
}
/**
* 预约用车查询
*/
@GlobalTransactional
(
timeoutMills
=
600000
)
@RequestMapping
(
"/prebook"
)
public
R
<
org
.
dromara
.
common
.
ys
.
model
.
res
.
vehicles
.
EstimateYyycPriceModel
>
prebook
(
EstimateYyycPriceModel
model
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论