提交 43674492 authored 作者: hzh's avatar hzh

代码优化

上级 a47b3873
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<module>ruoyi-api-system</module> <module>ruoyi-api-system</module>
<module>ruoyi-api-resource</module> <module>ruoyi-api-resource</module>
<module>ruoyi-api-workflow</module> <module>ruoyi-api-workflow</module>
<module>ruoyi-api-server</module>
</modules> </modules>
<artifactId>ruoyi-api</artifactId> <artifactId>ruoyi-api</artifactId>
......
...@@ -41,6 +41,13 @@ ...@@ -41,6 +41,13 @@
<version>${revision}</version> <version>${revision}</version>
</dependency> </dependency>
<!-- 服务接口 -->
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-api-server</artifactId>
<version>${revision}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
</project> </project>
<?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-api</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ruoyi-api-server</artifactId>
<description>
ruoyi-api-server 服务接口模块
</description>
<dependencies>
<!-- RuoYi Common Core-->
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-core</artifactId>
</dependency>
</dependencies>
</project>
package org.dromara.server.api;
import org.dromara.server.api.domain.RemoteUser;
/**
* 云上用户相关操作
*
* @author wenhe
*/
public interface RemoteServerService {
/**
* 保存或更新用户
*
* @param user 用户
* @return true 保存或更新成功 false 失败
*/
boolean saveOrUpdateUser(RemoteUser user);
/**
* 根据手机号查询用户
*
* @param tenantId 租户id
* @param phone 用户手机号
* @return 用户信息
*/
RemoteUser getUserByPhone(String tenantId, String phone);
}
package org.dromara.server.api.domain;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* @author hzh
* @date 2024-11-14
* @desc 新增用户
**/
@Data
public class RemoteUser implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 租户编码
*/
private String tenantId;
/**
* 文件名称
*/
private String userName;
/**
* 系统用户id
*/
private Long systemUserId;
/**
* 身份证
*/
private String idCard;
/**
* 手机号
*/
private String phoneNumber;
}
package org.dromara.common.ys.service;
import cn.hutool.core.text.CharSequenceUtil;
import com.alibaba.fastjson.JSON;
import com.wenhe.base.base.RequestMethodEnum;
import org.dromara.common.ys.Api;
import org.dromara.common.ys.common.ApiHttpResponse;
import org.dromara.common.ys.common.Code;
import org.dromara.common.ys.common.PageInfo;
import org.dromara.common.ys.enums.DomainEnum;
import org.dromara.common.ys.enums.airport.AirportApiEnum;
import org.dromara.common.ys.model.req.airport.*;
import org.dromara.common.ys.model.req.airport.bookOrder.BookOrderModel;
import java.util.List;
/**
* @author hzh
* @date 2024-10-21
* @desc 机票相关接口
**/
public class AirPortService {
public static org.dromara.common.ys.model.res.airport.QueryFlightModel queryFlight(String userId, QueryFlightModel model) {
ApiHttpResponse res = Api.v1(
RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(),
AirportApiEnum.QUERY_FLIGHT.getUrl(),
userId,
null,
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
}
return JSON.parseObject(res.getData(), org.dromara.common.ys.model.res.airport.QueryFlightModel.class);
}
public static org.dromara.common.ys.model.res.airport.QueryFlightMinPriceModel queryFlightMinPrice(String userId, QueryFlightMinPriceModel model) {
ApiHttpResponse res = Api.v1(
RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(),
AirportApiEnum.QUERY_FLIGHT_MIN_PRICE.getUrl(),
userId,
null,
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
}
return JSON.parseObject(res.getData(), org.dromara.common.ys.model.res.airport.QueryFlightMinPriceModel.class);
}
public static org.dromara.common.ys.model.res.airport.QueryFlightStopModel queryFlightStop(String userId, QueryFlightStopModel model) {
ApiHttpResponse res = Api.v1(
RequestMethodEnum.POST,
DomainEnum.PROD.getDomain(),
AirportApiEnum.QUERY_FLIGHT_STOP.getUrl(),
userId,
null,
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
}
return JSON.parseObject(res.getData(), org.dromara.common.ys.model.res.airport.QueryFlightStopModel.class);
}
public static List<org.dromara.common.ys.model.res.airport.BookOrderModel> bookOrder(String userId, BookOrderModel model) {
ApiHttpResponse res = Api.v1(
RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(),
AirportApiEnum.BOOK_ORDER.getUrl(),
userId,
null,
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
}
return JSON.parseArray(JSON.parseObject(res.getData()).getString("orderList"), org.dromara.common.ys.model.res.airport.BookOrderModel.class);
}
public static PageInfo<org.dromara.common.ys.model.res.airport.OrderListModel> orderList(String userId, OrderListModel model) {
ApiHttpResponse res = Api.v1(
RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(),
AirportApiEnum.QUERY_ORDER_LIST.getUrl(),
userId,
null,
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
}
PageInfo pageInfo = JSON.parseObject(JSON.parseObject(res.getData()).getString("orderList"), PageInfo.class);
return PageInfo.builder().build()
.setCount(pageInfo.getCount())
.setMap(pageInfo.getMap())
.setPageNum(pageInfo.getPageNum())
.setPages(pageInfo.getPages())
.setTotal(pageInfo.getTotal())
.setList(JSON.parseArray(JSON.toJSONString(pageInfo.getList()), org.dromara.common.ys.model.res.airport.OrderListModel.class));
}
public static org.dromara.common.ys.model.res.airport.QueryTkOrderModel detail(String userId, QueryTkOrderModel model) {
ApiHttpResponse res = Api.v1(
RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(),
AirportApiEnum.QUERY_TK_ORDER.getUrl(),
userId,
null,
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
}
return JSON.parseObject(res.getData(), org.dromara.common.ys.model.res.airport.QueryTkOrderModel.class);
}
}
package org.dromara.common.ys.service;
import cn.hutool.core.text.CharSequenceUtil;
import com.alibaba.fastjson.JSON;
import org.dromara.common.ys.Api;
import org.dromara.common.ys.common.ApiHttpResponse;
import org.dromara.common.ys.common.Code;
import org.dromara.common.ys.enums.DomainEnum;
import org.dromara.common.ys.enums.resource.CommonResourceApiEnum;
import org.dromara.common.ys.model.req.commonResource.*;
import java.util.ArrayList;
import java.util.List;
/**
* @author hzh
* @date 2024-10-18
* @desc 公共资源
**/
public class CommonResourceService {
public static List<org.dromara.common.ys.model.res.comomResource.CountryModel> getCountryList(String userId) {
ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(),
CommonResourceApiEnum.COUNTRY_DATA.getUrl(),
userId,
JSON.toJSONString(new CountryModel())
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
}
return JSON.parseArray(JSON.parseObject(res.getData()).getString("countryDataList"), org.dromara.common.ys.model.res.comomResource.CountryModel.class);
}
public static List<org.dromara.common.ys.model.res.comomResource.ProvinceModel> getProvinceList(String userId) {
ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(),
CommonResourceApiEnum.PROVINCE_DATA.getUrl(),
userId,
JSON.toJSONString(new ProvinceModel())
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
}
return JSON.parseArray(JSON.parseObject(res.getData()).getString("provinceDataList"), org.dromara.common.ys.model.res.comomResource.ProvinceModel.class);
}
public static List<org.dromara.common.ys.model.res.comomResource.CityModel> getCityList(String userId) {
ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(),
CommonResourceApiEnum.CITY_DATA.getUrl(),
userId,
JSON.toJSONString(new CityModel())
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
}
if (res.getData() == null) {
return new ArrayList<>();
}
return JSON.parseArray(JSON.parseObject(res.getData()).getString("cityDataList"), org.dromara.common.ys.model.res.comomResource.CityModel.class);
}
public static List<org.dromara.common.ys.model.res.comomResource.AirportModel> getAirportList(String userId) {
ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(),
CommonResourceApiEnum.AIRPORT_DATA.getUrl(),
userId,
JSON.toJSONString(new AirportModel())
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
}
if (res.getData() == null) {
return new ArrayList<>();
}
return JSON.parseArray(JSON.parseObject(res.getData()).getString("airportDataList"), org.dromara.common.ys.model.res.comomResource.AirportModel.class);
}
public static List<org.dromara.common.ys.model.res.comomResource.StationModel> getStationList(String userId) {
ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(),
CommonResourceApiEnum.STATION_DATA.getUrl(),
userId,
null,
JSON.toJSONString(new StationModel())
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
}
if (res.getData() == null) {
return new ArrayList<>();
}
return JSON.parseArray(JSON.parseObject(res.getData()).getString("stationDataList"), org.dromara.common.ys.model.res.comomResource.StationModel.class);
}
public static List<org.dromara.common.ys.model.res.comomResource.TrainBaseModel> getTrainBaseList(String userId) {
ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(),
CommonResourceApiEnum.TRAIN_BASE_DATA.getUrl(),
userId,
null,
JSON.toJSONString(new TrainBaseModel())
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
}
if (res.getData() == null) {
return new ArrayList<>();
}
return JSON.parseArray(JSON.parseObject(res.getData()).getString("trainBaseDataList"), org.dromara.common.ys.model.res.comomResource.TrainBaseModel.class);
}
public static List<org.dromara.common.ys.model.res.comomResource.DictModel> getDictList(String userId, String parType) {
DictModel model = new DictModel().setParType(parType);
ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(),
CommonResourceApiEnum.DICT_DATA.getUrl(),
userId,
null,
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
}
if (res.getData() == null) {
return new ArrayList<>();
}
return JSON.parseArray(JSON.parseObject(res.getData()).getString("baseDataList"), org.dromara.common.ys.model.res.comomResource.DictModel.class);
}
}
package org.dromara.common.ys.service;
import cn.hutool.core.text.CharSequenceUtil;
import com.alibaba.fastjson.JSON;
import org.dromara.common.ys.Api;
import org.dromara.common.ys.common.ApiHttpResponse;
import org.dromara.common.ys.common.Code;
import org.dromara.common.ys.enums.DomainEnum;
import org.dromara.common.ys.enums.insurance.InsuranceApiEnum;
import org.dromara.common.ys.model.req.insurance.BxcpModel;
import java.util.List;
/**
* @author hzh
* @date 2024-10-24
**/
public class InsuranceService {
public static List<org.dromara.common.ys.model.res.insurance.BxcpModel> list(String userId, BxcpModel model) {
ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(),
InsuranceApiEnum.GET_BX_CP.getUrl(),
userId,
null,
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
}
return JSON.parseArray(JSON.parseObject(res.getData()).getString("cpList"), org.dromara.common.ys.model.res.insurance.BxcpModel.class);
}
}
package org.dromara.common.ys.service;
import cn.hutool.core.text.CharSequenceUtil;
import com.alibaba.fastjson.JSON;
import org.dromara.common.ys.Api;
import org.dromara.common.ys.common.ApiHttpResponse;
import org.dromara.common.ys.common.Code;
import org.dromara.common.ys.enums.DomainEnum;
import org.dromara.common.ys.enums.org.OrgApiEnum;
import org.dromara.common.ys.model.req.org.EditEmployeeModel;
/**
* @author hzh
* @date 2024-10-23
**/
public class OrgService {
public static boolean saveOrUpdateEmployee(String userId, EditEmployeeModel model) {
ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(),
OrgApiEnum.EDIT_EMPLOYEE.getUrl(),
userId,
null,
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
}
return true;
}
}
package org.dromara.common.ys.service;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import org.dromara.common.ys.Api;
import org.dromara.common.ys.common.ApiHttpResponse;
import org.dromara.common.ys.common.Code;
import org.dromara.common.ys.enums.DomainEnum;
import org.dromara.common.ys.enums.train.TrainApiEnum;
import org.dromara.common.ys.model.req.train.AllStationModel;
import org.dromara.common.ys.model.req.train.QueryModel;
import java.util.Collections;
import java.util.List;
/**
* @author hzh
* @date 2024-10-22
**/
public class TrainService {
public static List<org.dromara.common.ys.model.res.train.QueryModel> queryModel(String userId, QueryModel model) {
ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(),
TrainApiEnum.QUERY.getUrl(),
userId,
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getErrMsg());
}
if (StrUtil.isEmpty(res.getData())) {
return Collections.emptyList();
}
return JSON.parseArray(JSON.parseObject(res.getData()).getString("trainList"), org.dromara.common.ys.model.res.train.QueryModel.class);
}
public static List<org.dromara.common.ys.model.res.train.AllStationModel> getAllStation(String userId) {
ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(),
TrainApiEnum.FIND_ALL_STATION.getUrl(),
userId,
JSON.toJSONString(new AllStationModel())
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
}
return JSON.parseArray(JSON.parseObject(res.getData()).getString("list"), org.dromara.common.ys.model.res.train.AllStationModel.class);
}
}
package org.dromara.common.ys.service;
import cn.hutool.core.text.CharSequenceUtil;
import com.alibaba.fastjson.JSON;
import org.dromara.common.ys.Api;
import org.dromara.common.ys.common.ApiHttpResponse;
import org.dromara.common.ys.common.Code;
import org.dromara.common.ys.enums.DomainEnum;
import org.dromara.common.ys.enums.vehicles.VehiclesApiEnum;
import org.dromara.common.ys.model.req.vehicles.EstimateJsycPriceModel;
import org.dromara.common.ys.model.req.vehicles.EstimateYyycPriceModel;
/**
* @author hzh
* @date 2024-10-22
**/
public class VehiclesService {
public static org.dromara.common.ys.model.res.vehicles.EstimateYyycPriceModel estimateYyycPrice(String userId, EstimateYyycPriceModel model) {
ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(),
VehiclesApiEnum.ESTIMATE_YYYC_PRICE.getUrl(),
userId,
null,
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
}
return JSON.parseObject(res.getData(), org.dromara.common.ys.model.res.vehicles.EstimateYyycPriceModel.class);
}
public static org.dromara.common.ys.model.res.vehicles.EstimateJsycPriceModel estimateJsycPrice(String userId, EstimateJsycPriceModel model) {
ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(),
VehiclesApiEnum.ESTIMATE_JSYC_PRICE.getUrl(),
userId,
null,
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
}
return JSON.parseObject(res.getData(), org.dromara.common.ys.model.res.vehicles.EstimateJsycPriceModel.class);
}
}
...@@ -82,6 +82,11 @@ ...@@ -82,6 +82,11 @@
<artifactId>ruoyi-common-ys</artifactId> <artifactId>ruoyi-common-ys</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-api-server</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -17,9 +17,9 @@ import org.dromara.common.ys.model.req.insurance.BxcpModel; ...@@ -17,9 +17,9 @@ import org.dromara.common.ys.model.req.insurance.BxcpModel;
import org.dromara.common.ys.model.res.airport.QueryFlightModel; import org.dromara.common.ys.model.res.airport.QueryFlightModel;
import org.dromara.common.ys.model.res.airport.QueryTkOrderModel; import org.dromara.common.ys.model.res.airport.QueryTkOrderModel;
import org.dromara.common.ys.model.res.comomResource.AirportModel; import org.dromara.common.ys.model.res.comomResource.AirportModel;
import org.dromara.common.ys.service.AirPortService; import org.dromara.common.ys.service.IAirportService;
import org.dromara.common.ys.service.CommonResourceService; import org.dromara.common.ys.service.ICommonResourceService;
import org.dromara.common.ys.service.InsuranceService; import org.dromara.common.ys.service.IInsuranceService;
import org.dromara.server.base.BaseController; import org.dromara.server.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.*;
...@@ -42,6 +42,10 @@ public class AirportController extends BaseController { ...@@ -42,6 +42,10 @@ public class AirportController extends BaseController {
private static final String AIRPORT = "airport:ys" ; private static final String AIRPORT = "airport:ys" ;
private final IAirportService airPortService;
private final ICommonResourceService commonResourceService;
private final IInsuranceService insuranceService;
/** /**
* 查询航班信息 * 查询航班信息
*/ */
...@@ -53,7 +57,7 @@ public class AirportController extends BaseController { ...@@ -53,7 +57,7 @@ public class AirportController extends BaseController {
model.setDepartAirport(airPortList.stream().filter(item -> StringUtils.equals(model.getDepartAirport(), item.getCityName())).map(AirportModel::getThreeCode).findFirst().orElse(null)); model.setDepartAirport(airPortList.stream().filter(item -> StringUtils.equals(model.getDepartAirport(), item.getCityName())).map(AirportModel::getThreeCode).findFirst().orElse(null));
model.setTripType(TripType.PUBLIC.getCode()); model.setTripType(TripType.PUBLIC.getCode());
try { try {
return R.ok(AirPortService.queryFlight(getUserId(), model)); return R.ok(airPortService.queryFlight(getUserId(), model));
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e.getMessage()); throw new RuntimeException(e.getMessage());
} }
...@@ -62,7 +66,7 @@ public class AirportController extends BaseController { ...@@ -62,7 +66,7 @@ public class AirportController extends BaseController {
private List<AirportModel> getAirPortList() { private List<AirportModel> getAirPortList() {
List<AirportModel> airPortList = JSON.parseArray(JSON.toJSONString(RedisUtils.getCacheObject(AIRPORT)), AirportModel.class); List<AirportModel> airPortList = JSON.parseArray(JSON.toJSONString(RedisUtils.getCacheObject(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 airPortList;
...@@ -74,7 +78,7 @@ public class AirportController extends BaseController { ...@@ -74,7 +78,7 @@ public class AirportController extends BaseController {
@GlobalTransactional(timeoutMills = 600000) @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())));
} }
/** /**
...@@ -106,7 +110,7 @@ public class AirportController extends BaseController { ...@@ -106,7 +110,7 @@ public class AirportController extends BaseController {
@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());
List<org.dromara.common.ys.model.res.airport.BookOrderModel> orderList = AirPortService.bookOrder(getUserId(), model); List<org.dromara.common.ys.model.res.airport.BookOrderModel> orderList = airPortService.bookOrder(getUserId(), model);
return R.ok(orderList); return R.ok(orderList);
} }
...@@ -117,7 +121,7 @@ public class AirportController extends BaseController { ...@@ -117,7 +121,7 @@ public class AirportController extends BaseController {
@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());
return R.ok(AirPortService.orderList(getUserId(), model)); return R.ok(airPortService.orderList(getUserId(), model));
} }
/** /**
...@@ -126,6 +130,6 @@ public class AirportController extends BaseController { ...@@ -126,6 +130,6 @@ public class AirportController extends BaseController {
@GlobalTransactional(timeoutMills = 600000) @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));
} }
} }
...@@ -11,8 +11,8 @@ import org.dromara.common.ys.constant.TripType; ...@@ -11,8 +11,8 @@ 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;
import org.dromara.common.ys.model.res.train.AllStationModel; import org.dromara.common.ys.model.res.train.AllStationModel;
import org.dromara.common.ys.service.CommonResourceService; import org.dromara.common.ys.service.ICommonResourceService;
import org.dromara.common.ys.service.TrainService; import org.dromara.common.ys.service.ITrainService;
import org.dromara.server.base.BaseController; import org.dromara.server.base.BaseController;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -44,6 +44,9 @@ public class TrainController extends BaseController { ...@@ -44,6 +44,9 @@ 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" ;
private final ITrainService trainService;
private final ICommonResourceService commonResourceService;
/** /**
* 火车站列表 * 火车站列表
*/ */
...@@ -73,7 +76,7 @@ public class TrainController extends BaseController { ...@@ -73,7 +76,7 @@ public class TrainController extends BaseController {
private List<AllStationModel> getStationList() { private List<AllStationModel> getStationList() {
List<AllStationModel> stationList = JSON.parseArray(JSON.toJSONString(RedisUtils.getCacheObject(TRAIN)), AllStationModel.class); List<AllStationModel> stationList = JSON.parseArray(JSON.toJSONString(RedisUtils.getCacheObject(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 stationList;
...@@ -110,7 +113,7 @@ public class TrainController extends BaseController { ...@@ -110,7 +113,7 @@ public class TrainController extends BaseController {
.setFromStationCode(fromCode) .setFromStationCode(fromCode)
.setToStationCode(toCode) .setToStationCode(toCode)
.setTripType(TripType.PUBLIC.getCode()); .setTripType(TripType.PUBLIC.getCode());
return TrainService.queryModel(userId, query); return trainService.queryModel(userId, query);
})).collect(Collectors.toList()); })).collect(Collectors.toList());
...@@ -161,7 +164,7 @@ public class TrainController extends BaseController { ...@@ -161,7 +164,7 @@ public class TrainController extends BaseController {
private List<CityModel> getCityList() { private List<CityModel> getCityList() {
List<CityModel> cityList = JSON.parseArray(JSON.toJSONString(RedisUtils.getCacheObject(CITY)), CityModel.class); List<CityModel> cityList = JSON.parseArray(JSON.toJSONString(RedisUtils.getCacheObject(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 cityList;
......
...@@ -7,7 +7,7 @@ import org.dromara.common.core.domain.R; ...@@ -7,7 +7,7 @@ import org.dromara.common.core.domain.R;
import org.dromara.common.ys.constant.TripType; import org.dromara.common.ys.constant.TripType;
import org.dromara.common.ys.model.req.vehicles.EstimateJsycPriceModel; import org.dromara.common.ys.model.req.vehicles.EstimateJsycPriceModel;
import org.dromara.common.ys.model.req.vehicles.EstimateYyycPriceModel; import org.dromara.common.ys.model.req.vehicles.EstimateYyycPriceModel;
import org.dromara.common.ys.service.VehiclesService; import org.dromara.common.ys.service.IVehiclesService;
import org.dromara.server.base.BaseController; import org.dromara.server.base.BaseController;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -22,6 +22,8 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -22,6 +22,8 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/vehicle/ys") @RequestMapping("/vehicle/ys")
public class VehiclesController extends BaseController { public class VehiclesController extends BaseController {
private final IVehiclesService vehiclesService;
/** /**
* 即时用车查询 * 即时用车查询
*/ */
...@@ -29,7 +31,7 @@ public class VehiclesController extends BaseController { ...@@ -29,7 +31,7 @@ public class VehiclesController extends BaseController {
@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));
} }
/** /**
...@@ -39,7 +41,7 @@ public class VehiclesController extends BaseController { ...@@ -39,7 +41,7 @@ public class VehiclesController extends BaseController {
@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());
return R.ok(VehiclesService.estimateYyycPrice(getUserId(), model)); return R.ok(vehiclesService.estimateYyycPrice(getUserId(), model));
} }
......
package org.dromara.server.dubbo;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import org.dromara.server.api.RemoteServerService;
import org.dromara.server.api.domain.RemoteUser;
import org.springframework.stereotype.Service;
/**
* 云上服务
*
* @author hzh
*/
@RequiredArgsConstructor
@Service
@DubboService
public class RemoteServerServiceImpl implements RemoteServerService {
@Override
public boolean saveOrUpdateUser(RemoteUser user) {
return false;
}
@Override
public RemoteUser getUserByPhone(String tenantId, String phone) {
return null;
}
}
...@@ -40,9 +40,9 @@ spring.sql.init.platform=mysql ...@@ -40,9 +40,9 @@ spring.sql.init.platform=mysql
db.num=1 db.num=1
### Connect URL of DB: ### Connect URL of DB:
db.url.0=jdbc:mysql://47.101.208.124:3306/travel_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true db.url.0=jdbc:mysql://192.168.8.190:3306/travel_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
db.user.0=travel_config db.user.0=root
db.password.0=DhBfyrN6AYRXrDCX db.password.0=fed74f4174a0f684
### the maximum retry times for push ### the maximum retry times for push
nacos.config.push.maxRetryTime=50 nacos.config.push.maxRetryTime=50
...@@ -84,7 +84,7 @@ nacos.naming.empty-service.clean.period-time-ms=30000 ...@@ -84,7 +84,7 @@ nacos.naming.empty-service.clean.period-time-ms=30000
#*************** Metrics Related Configurations ***************# #*************** Metrics Related Configurations ***************#
# 指向 ruoyi-monitor 监控 # 指向 ruoyi-monitor 监控
spring.boot.admin.client.url=http://47.101.208.124:9100 spring.boot.admin.client.url=http://localhost:9100
spring.boot.admin.client.username=ruoyi spring.boot.admin.client.username=ruoyi
spring.boot.admin.client.password=123456 spring.boot.admin.client.password=123456
spring.boot.admin.client.instance.service-host-type=IP spring.boot.admin.client.instance.service-host-type=IP
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论