提交 3916db63 authored 作者: hzh's avatar hzh

机票模块修改

上级 ada0e6e1
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-modules</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ruoyi-server</artifactId>
<description>
ruoyi-server服务
</description>
<dependencies>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-nacos</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-sentinel</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-doc</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-dubbo</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-seata</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-web</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-log</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-ratelimiter</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-mybatis</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-tenant</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-security</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-translation</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-ys</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
package org.dromara.resource;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup;
/**
* 资源服务
*
* @author Lion Li
*/
@EnableDubbo
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class RuoYiServerApplication {
public static void main(String[] args) {
SpringApplication application = new SpringApplication(RuoYiServerApplication.class);
application.setApplicationStartup(new BufferingApplicationStartup(2048));
application.run(args);
System.out.println("(♥◠‿◠)ノ゙ 服务模块启动成功 ლ(´ڡ`ლ)゙ ");
}
}
package org.dromara.resource.controller.airport; package org.dromara.resource.controller.airport;
import io.seata.spring.annotation.GlobalTransactional;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.dromara.common.core.domain.R; 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.common.PageInfo;
import org.dromara.common.ys.constant.Cplx; import org.dromara.common.ys.constant.Cplx;
import org.dromara.common.ys.constant.TripType; import org.dromara.common.ys.constant.TripType;
...@@ -22,7 +21,6 @@ import org.dromara.resource.base.BaseController; ...@@ -22,7 +21,6 @@ import org.dromara.resource.base.BaseController;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.time.Duration;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -42,6 +40,7 @@ public class AirportController extends BaseController { ...@@ -42,6 +40,7 @@ public class AirportController extends BaseController {
/** /**
* 查询航班信息 * 查询航班信息
*/ */
@GlobalTransactional(timeoutMills = 600000)
@GetMapping("list") @GetMapping("list")
public R<QueryFlightModel> list(org.dromara.common.ys.model.req.airport.QueryFlightModel model) { public R<QueryFlightModel> list(org.dromara.common.ys.model.req.airport.QueryFlightModel model) {
List<AirportModel> airPortList = getAirPortList(); List<AirportModel> airPortList = getAirPortList();
...@@ -56,17 +55,18 @@ public class AirportController extends BaseController { ...@@ -56,17 +55,18 @@ public class AirportController extends BaseController {
} }
private List<AirportModel> getAirPortList() { private List<AirportModel> getAirPortList() {
List<AirportModel> airPortList = RedisUtils.getCacheList(AIRPORT); // List<AirportModel> airPortList = JSON.parseArray(JSON.toJSONString(RedisUtils.getCacheList(AIRPORT)), AirportModel.class);
if (CollectionUtils.isEmpty(airPortList)) { // if (CollectionUtils.isEmpty(airPortList)) {
airPortList = CommonResourceService.getAirportList(getUserId()); // airPortList = CommonResourceService.getAirportList(getUserId());
RedisUtils.setCacheObject(AIRPORT, airPortList, Duration.ofMinutes(60 * 60 * 24L)); // RedisUtils.setCacheObject(AIRPORT, airPortList, Duration.ofMinutes(60 * 60 * 24L));
} // }
return airPortList; return CommonResourceService.getAirportList(getUserId());
} }
/** /**
* 查询保险列表 * 查询保险列表
*/ */
@GlobalTransactional(timeoutMills = 600000)
@GetMapping("/insuranceList") @GetMapping("/insuranceList")
public R<List<org.dromara.common.ys.model.res.insurance.BxcpModel>> insuranceList() { public R<List<org.dromara.common.ys.model.res.insurance.BxcpModel>> insuranceList() {
return R.ok(InsuranceService.list(getUserId(), new BxcpModel().setCplx(Cplx.DOMESTIC.getCode()))); return R.ok(InsuranceService.list(getUserId(), new BxcpModel().setCplx(Cplx.DOMESTIC.getCode())));
...@@ -75,6 +75,7 @@ public class AirportController extends BaseController { ...@@ -75,6 +75,7 @@ public class AirportController extends BaseController {
/** /**
* 查询基础列表 * 查询基础列表
*/ */
@GlobalTransactional(timeoutMills = 600000)
@GetMapping("/airportList") @GetMapping("/airportList")
public R<List<AirportModel>> airportList(@RequestParam("keyword") String keyword) { public R<List<AirportModel>> airportList(@RequestParam("keyword") String keyword) {
List<AirportModel> list = getAirPortList(); List<AirportModel> list = getAirPortList();
...@@ -96,6 +97,7 @@ public class AirportController extends BaseController { ...@@ -96,6 +97,7 @@ public class AirportController extends BaseController {
/** /**
* 下单接口 * 下单接口
*/ */
@GlobalTransactional(timeoutMills = 600000)
@PostMapping("/bookOrder") @PostMapping("/bookOrder")
public R<List<org.dromara.common.ys.model.res.airport.BookOrderModel>> bookOrder(@RequestBody BookOrderModel model) { public R<List<org.dromara.common.ys.model.res.airport.BookOrderModel>> bookOrder(@RequestBody BookOrderModel model) {
model.setTripType(TripType.PUBLIC.getCode()); model.setTripType(TripType.PUBLIC.getCode());
...@@ -106,6 +108,7 @@ public class AirportController extends BaseController { ...@@ -106,6 +108,7 @@ public class AirportController extends BaseController {
/** /**
* 订单列表 * 订单列表
*/ */
@GlobalTransactional(timeoutMills = 600000)
@GetMapping("/orderList") @GetMapping("/orderList")
public R<PageInfo<org.dromara.common.ys.model.res.airport.OrderListModel>> orderList(OrderListModel model) { public R<PageInfo<org.dromara.common.ys.model.res.airport.OrderListModel>> orderList(OrderListModel model) {
model.setBookNo(getUserId()); model.setBookNo(getUserId());
...@@ -115,6 +118,7 @@ public class AirportController extends BaseController { ...@@ -115,6 +118,7 @@ public class AirportController extends BaseController {
/** /**
* 订单详情 * 订单详情
*/ */
@GlobalTransactional(timeoutMills = 600000)
@GetMapping("/orderDetail") @GetMapping("/orderDetail")
public R<QueryTkOrderModel> orderDetail(org.dromara.common.ys.model.req.airport.QueryTkOrderModel model) { public R<QueryTkOrderModel> orderDetail(org.dromara.common.ys.model.req.airport.QueryTkOrderModel model) {
return R.ok(AirPortService.detail(getUserId(), model)); return R.ok(AirPortService.detail(getUserId(), model));
......
package org.dromara.resource.controller.train; package org.dromara.resource.controller.train;
import io.seata.spring.annotation.GlobalTransactional;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.dromara.common.core.domain.R; 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.constant.TripType;
import org.dromara.common.ys.model.req.train.QueryModel; import org.dromara.common.ys.model.req.train.QueryModel;
import org.dromara.common.ys.model.res.comomResource.CityModel; import org.dromara.common.ys.model.res.comomResource.CityModel;
...@@ -18,7 +17,6 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -18,7 +17,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.time.Duration;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
...@@ -40,6 +38,7 @@ public class TrainController extends BaseController { ...@@ -40,6 +38,7 @@ public class TrainController extends BaseController {
private static final String TRAIN = "train:ys" ; private static final String TRAIN = "train:ys" ;
private static final String CITY = "city:ys" ; private static final String CITY = "city:ys" ;
@GlobalTransactional(timeoutMills = 600000)
@GetMapping("/stationList") @GetMapping("/stationList")
public R<List<AllStationModel>> stationList(@RequestParam("keyword") String keyword) { public R<List<AllStationModel>> stationList(@RequestParam("keyword") String keyword) {
List<AllStationModel> stationList = getStationList(); List<AllStationModel> stationList = getStationList();
...@@ -63,12 +62,12 @@ public class TrainController extends BaseController { ...@@ -63,12 +62,12 @@ public class TrainController extends BaseController {
} }
private List<AllStationModel> getStationList() { private List<AllStationModel> getStationList() {
List<AllStationModel> stationList = RedisUtils.getCacheList(TRAIN); // List<AllStationModel> stationList = JSON.parseArray(JSON.toJSONString(RedisUtils.getCacheList(TRAIN)), AllStationModel.class);
if (CollectionUtils.isEmpty(stationList)) { // if (CollectionUtils.isEmpty(stationList)) {
stationList = TrainService.getAllStation(getUserId()); // stationList = TrainService.getAllStation(getUserId());
RedisUtils.setCacheObject(TRAIN, stationList, Duration.ofMinutes(60 * 60 * 24L)); // RedisUtils.setCacheObject(TRAIN, stationList, Duration.ofMinutes(60 * 60 * 24L));
} // }
return stationList; return TrainService.getAllStation(getUserId());
} }
/** /**
...@@ -76,6 +75,7 @@ public class TrainController extends BaseController { ...@@ -76,6 +75,7 @@ public class TrainController extends BaseController {
*/ */
private static final int NUM_THREADS = 100; private static final int NUM_THREADS = 100;
@GlobalTransactional(timeoutMills = 600000)
@GetMapping("/list") @GetMapping("/list")
public R<List<org.dromara.common.ys.model.res.train.QueryModel>> list( public R<List<org.dromara.common.ys.model.res.train.QueryModel>> list(
@RequestParam(value = "fromDate") String fromDate, @RequestParam(value = "fromDate") String fromDate,
...@@ -130,13 +130,13 @@ public class TrainController extends BaseController { ...@@ -130,13 +130,13 @@ public class TrainController extends BaseController {
stationCodeList.add(stationCode); stationCodeList.add(stationCode);
} else { } else {
stationCodeList = getStationList().stream().filter(item -> StringUtils.equals(item.getCityName(), city)).map(AllStationModel::getZddm) stationCodeList = getStationList().stream().filter(item -> StringUtils.equals(item.getCityName(), city)).map(AllStationModel::getZddm)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
return stationCodeList; return stationCodeList;
} }
@GlobalTransactional(timeoutMills = 600000)
@GetMapping("/cityList") @GetMapping("/cityList")
public R<List<CityModel>> list(@RequestParam("keyword") String keyword) { public R<List<CityModel>> list(@RequestParam("keyword") String keyword) {
List<CityModel> cityList = getCityList(); List<CityModel> cityList = getCityList();
...@@ -144,12 +144,12 @@ public class TrainController extends BaseController { ...@@ -144,12 +144,12 @@ public class TrainController extends BaseController {
} }
private List<CityModel> getCityList() { private List<CityModel> getCityList() {
List<CityModel> cityList = RedisUtils.getCacheList(CITY); // List<CityModel> cityList = JSON.parseArray(JSON.toJSONString(RedisUtils.getCacheList(CITY)), CityModel.class);
if (CollectionUtils.isEmpty(cityList)) { // if (CollectionUtils.isEmpty(cityList)) {
cityList = CommonResourceService.getCityList(getUserId()); // cityList = CommonResourceService.getCityList(getUserId());
RedisUtils.setCacheObject(CITY, cityList, Duration.ofMinutes(60 * 60 * 24L)); // RedisUtils.setCacheObject(CITY, cityList, Duration.ofMinutes(60 * 60 * 24L));
} // }
return cityList; return CommonResourceService.getCityList(getUserId());
} }
} }
package org.dromara.resource.controller.vehicle; package org.dromara.resource.controller.vehicle;
import io.seata.spring.annotation.GlobalTransactional;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R; import org.dromara.common.core.domain.R;
import org.dromara.common.ys.constant.TripType; import org.dromara.common.ys.constant.TripType;
...@@ -20,13 +21,14 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -20,13 +21,14 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/vehicle/ys") @RequestMapping("/vehicle/ys")
public class VehiclesController extends BaseController { public class VehiclesController extends BaseController {
@GlobalTransactional(timeoutMills = 600000)
@RequestMapping("/immediate") @RequestMapping("/immediate")
public R<org.dromara.common.ys.model.res.vehicles.EstimateJsycPriceModel> immediate(EstimateJsycPriceModel model) { public R<org.dromara.common.ys.model.res.vehicles.EstimateJsycPriceModel> immediate(EstimateJsycPriceModel model) {
model.setTripType(TripType.PUBLIC.getCode()); model.setTripType(TripType.PUBLIC.getCode());
return R.ok(VehiclesService.estimateJsycPrice(getUserId(), model)); return R.ok(VehiclesService.estimateJsycPrice(getUserId(), model));
} }
@GlobalTransactional(timeoutMills = 600000)
@RequestMapping("/prebook") @RequestMapping("/prebook")
public R<org.dromara.common.ys.model.res.vehicles.EstimateYyycPriceModel> prebook(EstimateYyycPriceModel model) { public R<org.dromara.common.ys.model.res.vehicles.EstimateYyycPriceModel> prebook(EstimateYyycPriceModel model) {
model.setTripType(TripType.PUBLIC.getCode()); model.setTripType(TripType.PUBLIC.getCode());
......
# Tomcat
server:
port: 9206
# Spring
spring:
application:
# 应用名称
name: ruoyi-server
profiles:
# 环境配置
active: @profiles.active@
--- # nacos 配置
spring:
cloud:
nacos:
# nacos 服务地址
server-addr: @nacos.server@
username: @nacos.username@
password: @nacos.password@
discovery:
# 注册组
group: @nacos.discovery.group@
namespace: ${spring.profiles.active}
config:
# 配置组
group: @nacos.config.group@
namespace: ${spring.profiles.active}
config:
import:
- optional:nacos:application-common.yml
- optional:nacos:datasource.yml
- optional:nacos:${spring.application.name}.yml
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}
_
(_)
_ __ _ _ ___ _ _ _ ______ _ __ ___ ___ ___ _ _ _ __ ___ ___
| '__| | | |/ _ \| | | | |______| '__/ _ \/ __|/ _ \| | | | '__/ __/ _ \
| | | |_| | (_) | |_| | | | | | __/\__ \ (_) | |_| | | | (_| __/
|_| \__,_|\___/ \__, |_| |_| \___||___/\___/ \__,_|_| \___\___|
__/ |
|___/
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/${project.artifactId}"/>
<!-- 日志输出格式 -->
<property name="console.log.pattern"
value="%red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}%n) - %msg%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${console.log.pattern}</pattern>
<charset>utf-8</charset>
</encoder>
</appender>
<include resource="logback-common.xml" />
<include resource="logback-logstash.xml" />
<!-- 开启 skywalking 日志收集 -->
<include resource="logback-skylog.xml" />
<!--系统操作日志-->
<root level="info">
<appender-ref ref="console"/>
</root>
</configuration>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论