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

机票模块修改

上级 4f6e99cb
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
<module>ruoyi-common-bus</module> <module>ruoyi-common-bus</module>
<module>ruoyi-common-sse</module> <module>ruoyi-common-sse</module>
<module>ruoyi-common-weixin</module> <module>ruoyi-common-weixin</module>
<module>ruoyi-common-ys</module>
</modules> </modules>
<artifactId>ruoyi-common</artifactId> <artifactId>ruoyi-common</artifactId>
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* @author Javen * @author Javen
*/ */
package org.dromara.common.ys.service.model; package org.dromara.common.ys.model;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
......
package org.dromara.common.ys.service.model.req.airport; package org.dromara.common.ys.model.req.airport;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.dromara.common.ys.service.model.BaseModel; import org.dromara.common.ys.model.BaseModel;
/** /**
* @author hzh * @author hzh
......
package org.dromara.common.ys.service.model.req.airport; package org.dromara.common.ys.model.req.airport;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.dromara.common.ys.service.model.BaseModel; import org.dromara.common.ys.model.BaseModel;
/** /**
* @author hzh * @author hzh
......
package org.dromara.common.ys.service.model.req.airport; package org.dromara.common.ys.model.req.airport;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.dromara.common.ys.service.model.BaseModel; import org.dromara.common.ys.model.BaseModel;
/** /**
* @author hzh * @author hzh
......
package org.dromara.common.ys.service.model.req.airport; package org.dromara.common.ys.model.req.airport;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.dromara.common.ys.service.model.BaseModel; import org.dromara.common.ys.model.BaseModel;
/** /**
* @author hzh * @author hzh
......
package org.dromara.common.ys.service.model.req.airport; package org.dromara.common.ys.model.req.airport;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.dromara.common.ys.service.model.BaseModel; import org.dromara.common.ys.model.BaseModel;
/** /**
* @author hzh * @author hzh
......
package org.dromara.common.ys.service.model.req.airport.bookOrder; package org.dromara.common.ys.model.req.airport.bookOrder;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
......
package org.dromara.common.ys.service.model.req.airport.bookOrder; package org.dromara.common.ys.model.req.airport.bookOrder;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.dromara.common.ys.service.model.BaseModel; import org.dromara.common.ys.model.BaseModel;
import java.util.List; import java.util.List;
...@@ -21,11 +21,11 @@ public class BookOrderModel extends BaseModel { ...@@ -21,11 +21,11 @@ public class BookOrderModel extends BaseModel {
/** /**
* 乘机人集合 * 乘机人集合
*/ */
private List<com.wenhe.base.model.req.airport.bookOrder.BookOrderPsg> psgList; private List<BookOrderPsg> psgList;
/** /**
* 航程集合 * 航程集合
*/ */
private List<com.wenhe.base.model.req.airport.bookOrder.BookOrderRange> rangeList; private List<BookOrderRange> rangeList;
/** /**
* 保险信息 * 保险信息
*/ */
......
package org.dromara.common.ys.service.model.req.airport.bookOrder; package org.dromara.common.ys.model.req.airport.bookOrder;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
......
package org.dromara.common.ys.service.model.req.airport.bookOrder; package org.dromara.common.ys.model.req.airport.bookOrder;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
......
package org.dromara.common.ys.service.model.req.commonResource; package org.dromara.common.ys.model.req.commonResource;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.dromara.common.ys.service.model.BaseModel; import org.dromara.common.ys.model.BaseModel;
/** /**
* @author hzh * @author hzh
......
package org.dromara.common.ys.service.model.req.commonResource; package org.dromara.common.ys.model.req.commonResource;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.dromara.common.ys.service.model.BaseModel; import org.dromara.common.ys.model.BaseModel;
/** /**
* @author hzh * @author hzh
......
package org.dromara.common.ys.service.model.req.commonResource; package org.dromara.common.ys.model.req.commonResource;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.dromara.common.ys.service.model.BaseModel; import org.dromara.common.ys.model.BaseModel;
/** /**
* @author hzh * @author hzh
......
package org.dromara.common.ys.service.model.req.commonResource; package org.dromara.common.ys.model.req.commonResource;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.dromara.common.ys.service.model.BaseModel; import org.dromara.common.ys.model.BaseModel;
/** /**
* @author hzh * @author hzh
......
package org.dromara.common.ys.service.model.req.commonResource; package org.dromara.common.ys.model.req.commonResource;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.dromara.common.ys.service.model.BaseModel; import org.dromara.common.ys.model.BaseModel;
/** /**
* @author hzh * @author hzh
......
package org.dromara.common.ys.service.model.req.commonResource; package org.dromara.common.ys.model.req.commonResource;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.dromara.common.ys.service.model.BaseModel; import org.dromara.common.ys.model.BaseModel;
/** /**
* @author hzh * @author hzh
......
package org.dromara.common.ys.service.model.req.commonResource; package org.dromara.common.ys.model.req.commonResource;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.dromara.common.ys.service.model.BaseModel; import org.dromara.common.ys.model.BaseModel;
/** /**
* @author hzh * @author hzh
......
package org.dromara.common.ys.service.model.req.insurance; package org.dromara.common.ys.model.req.insurance;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.dromara.common.ys.service.model.BaseModel; import org.dromara.common.ys.model.BaseModel;
/** /**
* @author hzh * @author hzh
......
package org.dromara.common.ys.service.model.req.org; package org.dromara.common.ys.model.req.org;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.dromara.common.ys.service.model.BaseModel; import org.dromara.common.ys.model.BaseModel;
/** /**
* @author hzh * @author hzh
......
package org.dromara.common.ys.service.model.req.train; package org.dromara.common.ys.model.req.train;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.dromara.common.ys.service.model.BaseModel; import org.dromara.common.ys.model.BaseModel;
/** /**
* @author hzh * @author hzh
......
package org.dromara.common.ys.service.model.req.train; package org.dromara.common.ys.model.req.train;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.dromara.common.ys.service.model.BaseModel; import org.dromara.common.ys.model.BaseModel;
/** /**
* @author hzh * @author hzh
......
package org.dromara.common.ys.service.model.req.vehicles; package org.dromara.common.ys.model.req.vehicles;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.dromara.common.ys.service.model.BaseModel; import org.dromara.common.ys.model.BaseModel;
import java.math.BigDecimal; import java.math.BigDecimal;
......
package org.dromara.common.ys.service.model.req.vehicles; package org.dromara.common.ys.model.req.vehicles;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.dromara.common.ys.service.model.BaseModel; import org.dromara.common.ys.model.BaseModel;
import java.math.BigDecimal; import java.math.BigDecimal;
......
package org.dromara.common.ys.service.model.res.airport; package org.dromara.common.ys.model.res.airport;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.dromara.common.ys.service.model.res.airport.other.*; import org.dromara.common.ys.model.res.airport.other.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
......
package org.dromara.common.ys.service.model.res.airport.other; package org.dromara.common.ys.model.res.airport.other;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
......
package org.dromara.common.ys.service.model.res.airport.other; package org.dromara.common.ys.model.res.airport.other;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
......
package org.dromara.common.ys.service.model.res.airport.other; package org.dromara.common.ys.model.res.airport.other;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
......
package org.dromara.common.ys.service.model.res.airport.other; package org.dromara.common.ys.model.res.airport.other;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
......
package org.dromara.common.ys.service.model.res.airport.other; package org.dromara.common.ys.model.res.airport.other;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
......
package org.dromara.common.ys.service.model.res.airport.other; package org.dromara.common.ys.model.res.airport.other;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
......
package org.dromara.common.ys.service.model.res.airport.other; package org.dromara.common.ys.model.res.airport.other;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
......
package org.dromara.common.ys.service.model.res.airport.other; package org.dromara.common.ys.model.res.airport.other;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
......
package org.dromara.common.ys.service.model.res.comomResource; package org.dromara.common.ys.model.res.comomResource;
import lombok.Data; import lombok.Data;
......
package org.dromara.common.ys.service.model.res.comomResource; package org.dromara.common.ys.model.res.comomResource;
import lombok.Data; import lombok.Data;
......
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);
}
}
...@@ -2,7 +2,8 @@ package org.dromara.common.ys.service; ...@@ -2,7 +2,8 @@ package org.dromara.common.ys.service;
import org.dromara.common.ys.common.PageInfo; import org.dromara.common.ys.common.PageInfo;
import org.dromara.common.ys.service.model.res.airport.*; import org.dromara.common.ys.model.req.airport.*;
import org.dromara.common.ys.model.req.airport.bookOrder.BookOrderModel;
import java.util.List; import java.util.List;
...@@ -18,7 +19,7 @@ public interface IAirportService { ...@@ -18,7 +19,7 @@ public interface IAirportService {
* @param model 查询参数 * @param model 查询参数
* @return 查询结果 * @return 查询结果
*/ */
QueryFlightModel queryFlight(String userId, org.dromara.common.ys.service.model.req.airport.QueryFlightModel model); org.dromara.common.ys.model.res.airport.QueryFlightModel queryFlight(String userId, QueryFlightModel model);
/** /**
* 查询航班最低价 * 查询航班最低价
...@@ -27,7 +28,7 @@ public interface IAirportService { ...@@ -27,7 +28,7 @@ public interface IAirportService {
* @param model 查询参数 * @param model 查询参数
* @return 查询结果 * @return 查询结果
*/ */
QueryFlightMinPriceModel queryFlightMinPrice(String userId, org.dromara.common.ys.service.model.req.airport.QueryFlightMinPriceModel model); org.dromara.common.ys.model.res.airport.QueryFlightMinPriceModel queryFlightMinPrice(String userId, QueryFlightMinPriceModel model);
/** /**
* 查询航班停靠城市 * 查询航班停靠城市
...@@ -36,7 +37,7 @@ public interface IAirportService { ...@@ -36,7 +37,7 @@ public interface IAirportService {
* @param model 查询参数 * @param model 查询参数
* @return 查询结果 * @return 查询结果
*/ */
QueryFlightStopModel queryFlightStop(String userId, org.dromara.common.ys.service.model.req.airport.QueryFlightStopModel model); org.dromara.common.ys.model.res.airport.QueryFlightStopModel queryFlightStop(String userId, QueryFlightStopModel model);
/** /**
* 创建订单 * 创建订单
...@@ -45,7 +46,7 @@ public interface IAirportService { ...@@ -45,7 +46,7 @@ public interface IAirportService {
* @param model 订单 * @param model 订单
* @return 订单列表 * @return 订单列表
*/ */
List<BookOrderModel> bookOrder(String userId, org.dromara.common.ys.service.model.req.airport.bookOrder.BookOrderModel model); List<org.dromara.common.ys.model.res.airport.BookOrderModel> bookOrder(String userId, BookOrderModel model);
/** /**
* 查询订单列表 * 查询订单列表
...@@ -54,7 +55,7 @@ public interface IAirportService { ...@@ -54,7 +55,7 @@ public interface IAirportService {
* @param model 查询参数 * @param model 查询参数
* @return 查询结果 * @return 查询结果
*/ */
PageInfo<OrderListModel> orderList(String userId, org.dromara.common.ys.service.model.req.airport.OrderListModel model); PageInfo<org.dromara.common.ys.model.res.airport.OrderListModel> orderList(String userId, OrderListModel model);
/** /**
* 查询订单详情 * 查询订单详情
...@@ -63,6 +64,6 @@ public interface IAirportService { ...@@ -63,6 +64,6 @@ public interface IAirportService {
* @param model 查询参数 * @param model 查询参数
* @return 查询结果 * @return 查询结果
*/ */
QueryTkOrderModel detail(String userId, org.dromara.common.ys.service.model.req.airport.QueryTkOrderModel model); org.dromara.common.ys.model.res.airport.QueryTkOrderModel detail(String userId, QueryTkOrderModel model);
} }
package org.dromara.common.ys.service; package org.dromara.common.ys.service;
import org.dromara.common.ys.service.model.res.comomResource.*; import org.dromara.common.ys.model.res.comomResource.*;
import java.util.List; import java.util.List;
......
package org.dromara.common.ys.service; package org.dromara.common.ys.service;
import org.dromara.common.ys.service.model.res.insurance.BxcpModel; import org.dromara.common.ys.model.req.insurance.BxcpModel;
import java.util.List; import java.util.List;
...@@ -16,6 +16,6 @@ public interface IInsuranceService { ...@@ -16,6 +16,6 @@ public interface IInsuranceService {
* @param model 查询条件 * @param model 查询条件
* @return 查询结果 * @return 查询结果
*/ */
List<BxcpModel> list(String userId, org.dromara.common.ys.service.model.req.insurance.BxcpModel model); List<org.dromara.common.ys.model.res.insurance.BxcpModel> list(String userId, BxcpModel model);
} }
package org.dromara.common.ys.service; package org.dromara.common.ys.service;
import org.dromara.common.ys.service.model.req.org.EditEmployeeModel; import org.dromara.common.ys.model.req.org.EditEmployeeModel;
/** /**
* @author wenhe * @author wenhe
......
package org.dromara.common.ys.service; package org.dromara.common.ys.service;
import org.dromara.common.ys.service.model.res.train.AllStationModel; import org.dromara.common.ys.model.req.train.QueryModel;
import org.dromara.common.ys.service.model.res.train.QueryModel; import org.dromara.common.ys.model.res.train.AllStationModel;
import java.util.List; import java.util.List;
...@@ -18,7 +18,7 @@ public interface ITrainService { ...@@ -18,7 +18,7 @@ public interface ITrainService {
* @param model 查询参数 * @param model 查询参数
* @return 查询结果 * @return 查询结果
*/ */
List<QueryModel> queryModel(String userId, org.dromara.common.ys.service.model.req.train.QueryModel model); List<org.dromara.common.ys.model.res.train.QueryModel> queryModel(String userId, QueryModel model);
/** /**
* 查询所有车站信息 * 查询所有车站信息
......
package org.dromara.common.ys.service; package org.dromara.common.ys.service;
import org.dromara.common.ys.service.model.res.vehicles.EstimateJsycPriceModel; import org.dromara.common.ys.model.req.vehicles.EstimateJsycPriceModel;
import org.dromara.common.ys.service.model.res.vehicles.EstimateYyycPriceModel; import org.dromara.common.ys.model.req.vehicles.EstimateYyycPriceModel;
/** /**
* @author wenhe * @author wenhe
...@@ -16,7 +16,7 @@ public interface IVehiclesService { ...@@ -16,7 +16,7 @@ public interface IVehiclesService {
* @param model 即时用车预估价查询参数 * @param model 即时用车预估价查询参数
* @return 即时用车预估价查询结果 * @return 即时用车预估价查询结果
*/ */
EstimateJsycPriceModel estimateJsycPrice(String userId, org.dromara.common.ys.service.model.req.vehicles.EstimateJsycPriceModel model); org.dromara.common.ys.model.res.vehicles.EstimateJsycPriceModel estimateJsycPrice(String userId, EstimateJsycPriceModel model);
/** /**
* 预约用车预估价查询 * 预约用车预估价查询
...@@ -25,6 +25,6 @@ public interface IVehiclesService { ...@@ -25,6 +25,6 @@ public interface IVehiclesService {
* @param model 预约用车预估价查询参数 * @param model 预约用车预估价查询参数
* @return 预约用车预估价查询结果 * @return 预约用车预估价查询结果
*/ */
EstimateYyycPriceModel estimateYyycPrice(String userId, org.dromara.common.ys.service.model.req.vehicles.EstimateYyycPriceModel model); org.dromara.common.ys.model.res.vehicles.EstimateYyycPriceModel estimateYyycPrice(String userId, EstimateYyycPriceModel model);
} }
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);
}
}
...@@ -9,8 +9,9 @@ import org.dromara.common.ys.common.Code; ...@@ -9,8 +9,9 @@ import org.dromara.common.ys.common.Code;
import org.dromara.common.ys.common.PageInfo; import org.dromara.common.ys.common.PageInfo;
import org.dromara.common.ys.enums.DomainEnum; import org.dromara.common.ys.enums.DomainEnum;
import org.dromara.common.ys.enums.airport.AirportApiEnum; 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 org.dromara.common.ys.service.IAirportService; import org.dromara.common.ys.service.IAirportService;
import org.dromara.common.ys.service.model.res.airport.*;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
...@@ -24,7 +25,7 @@ import java.util.List; ...@@ -24,7 +25,7 @@ import java.util.List;
public class AirPortServiceImpl implements IAirportService { public class AirPortServiceImpl implements IAirportService {
@Override @Override
public QueryFlightModel queryFlight(String userId, org.dromara.common.ys.service.model.req.airport.QueryFlightModel model) { public org.dromara.common.ys.model.res.airport.QueryFlightModel queryFlight(String userId, QueryFlightModel model) {
ApiHttpResponse res = Api.v1( ApiHttpResponse res = Api.v1(
RequestMethodEnum.POST, RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(), DomainEnum.TEST.getDomain(),
...@@ -36,11 +37,11 @@ public class AirPortServiceImpl implements IAirportService { ...@@ -36,11 +37,11 @@ public class AirPortServiceImpl implements IAirportService {
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) { if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips()); throw new RuntimeException(res.getTips());
} }
return JSON.parseObject(res.getData(), QueryFlightModel.class); return JSON.parseObject(res.getData(), org.dromara.common.ys.model.res.airport.QueryFlightModel.class);
} }
@Override @Override
public QueryFlightMinPriceModel queryFlightMinPrice(String userId, org.dromara.common.ys.service.model.req.airport.QueryFlightMinPriceModel model) { public org.dromara.common.ys.model.res.airport.QueryFlightMinPriceModel queryFlightMinPrice(String userId, QueryFlightMinPriceModel model) {
ApiHttpResponse res = Api.v1( ApiHttpResponse res = Api.v1(
RequestMethodEnum.POST, RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(), DomainEnum.TEST.getDomain(),
...@@ -52,11 +53,11 @@ public class AirPortServiceImpl implements IAirportService { ...@@ -52,11 +53,11 @@ public class AirPortServiceImpl implements IAirportService {
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) { if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips()); throw new RuntimeException(res.getTips());
} }
return JSON.parseObject(res.getData(), QueryFlightMinPriceModel.class); return JSON.parseObject(res.getData(), org.dromara.common.ys.model.res.airport.QueryFlightMinPriceModel.class);
} }
@Override @Override
public QueryFlightStopModel queryFlightStop(String userId, org.dromara.common.ys.service.model.req.airport.QueryFlightStopModel model) { public org.dromara.common.ys.model.res.airport.QueryFlightStopModel queryFlightStop(String userId, QueryFlightStopModel model) {
ApiHttpResponse res = Api.v1( ApiHttpResponse res = Api.v1(
RequestMethodEnum.POST, RequestMethodEnum.POST,
DomainEnum.PROD.getDomain(), DomainEnum.PROD.getDomain(),
...@@ -68,11 +69,11 @@ public class AirPortServiceImpl implements IAirportService { ...@@ -68,11 +69,11 @@ public class AirPortServiceImpl implements IAirportService {
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) { if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips()); throw new RuntimeException(res.getTips());
} }
return JSON.parseObject(res.getData(), QueryFlightStopModel.class); return JSON.parseObject(res.getData(), org.dromara.common.ys.model.res.airport.QueryFlightStopModel.class);
} }
@Override @Override
public List<BookOrderModel> bookOrder(String userId, org.dromara.common.ys.service.model.req.airport.bookOrder.BookOrderModel model) { public List<org.dromara.common.ys.model.res.airport.BookOrderModel> bookOrder(String userId, BookOrderModel model) {
ApiHttpResponse res = Api.v1( ApiHttpResponse res = Api.v1(
RequestMethodEnum.POST, RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(), DomainEnum.TEST.getDomain(),
...@@ -84,11 +85,11 @@ public class AirPortServiceImpl implements IAirportService { ...@@ -84,11 +85,11 @@ public class AirPortServiceImpl implements IAirportService {
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) { if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips()); throw new RuntimeException(res.getTips());
} }
return JSON.parseArray(JSON.parseObject(res.getData()).getString("orderList"), BookOrderModel.class); return JSON.parseArray(JSON.parseObject(res.getData()).getString("orderList"), org.dromara.common.ys.model.res.airport.BookOrderModel.class);
} }
@Override @Override
public PageInfo<OrderListModel> orderList(String userId, org.dromara.common.ys.service.model.req.airport.OrderListModel model) { public PageInfo<org.dromara.common.ys.model.res.airport.OrderListModel> orderList(String userId, OrderListModel model) {
ApiHttpResponse res = Api.v1( ApiHttpResponse res = Api.v1(
RequestMethodEnum.POST, RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(), DomainEnum.TEST.getDomain(),
...@@ -107,11 +108,11 @@ public class AirPortServiceImpl implements IAirportService { ...@@ -107,11 +108,11 @@ public class AirPortServiceImpl implements IAirportService {
.setPageNum(pageInfo.getPageNum()) .setPageNum(pageInfo.getPageNum())
.setPages(pageInfo.getPages()) .setPages(pageInfo.getPages())
.setTotal(pageInfo.getTotal()) .setTotal(pageInfo.getTotal())
.setList(JSON.parseArray(JSON.toJSONString(pageInfo.getList()), OrderListModel.class)); .setList(JSON.parseArray(JSON.toJSONString(pageInfo.getList()), org.dromara.common.ys.model.res.airport.OrderListModel.class));
} }
@Override @Override
public QueryTkOrderModel detail(String userId, org.dromara.common.ys.service.model.req.airport.QueryTkOrderModel model) { public org.dromara.common.ys.model.res.airport.QueryTkOrderModel detail(String userId, QueryTkOrderModel model) {
ApiHttpResponse res = Api.v1( ApiHttpResponse res = Api.v1(
RequestMethodEnum.POST, RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(), DomainEnum.TEST.getDomain(),
...@@ -123,6 +124,6 @@ public class AirPortServiceImpl implements IAirportService { ...@@ -123,6 +124,6 @@ public class AirPortServiceImpl implements IAirportService {
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) { if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips()); throw new RuntimeException(res.getTips());
} }
return JSON.parseObject(res.getData(), QueryTkOrderModel.class); return JSON.parseObject(res.getData(), org.dromara.common.ys.model.res.airport.QueryTkOrderModel.class);
} }
} }
...@@ -7,8 +7,8 @@ import org.dromara.common.ys.common.ApiHttpResponse; ...@@ -7,8 +7,8 @@ import org.dromara.common.ys.common.ApiHttpResponse;
import org.dromara.common.ys.common.Code; import org.dromara.common.ys.common.Code;
import org.dromara.common.ys.enums.DomainEnum; import org.dromara.common.ys.enums.DomainEnum;
import org.dromara.common.ys.enums.resource.CommonResourceApiEnum; import org.dromara.common.ys.enums.resource.CommonResourceApiEnum;
import org.dromara.common.ys.model.req.commonResource.*;
import org.dromara.common.ys.service.ICommonResourceService; import org.dromara.common.ys.service.ICommonResourceService;
import org.dromara.common.ys.service.model.res.comomResource.*;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -23,43 +23,43 @@ import java.util.List; ...@@ -23,43 +23,43 @@ import java.util.List;
public class CommonResourceServiceImpl implements ICommonResourceService { public class CommonResourceServiceImpl implements ICommonResourceService {
@Override @Override
public List<CountryModel> getCountryList(String userId) { public List<org.dromara.common.ys.model.res.comomResource.CountryModel> getCountryList(String userId) {
ApiHttpResponse res = Api.v1( ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST, com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(), DomainEnum.TEST.getDomain(),
CommonResourceApiEnum.COUNTRY_DATA.getUrl(), CommonResourceApiEnum.COUNTRY_DATA.getUrl(),
userId, userId,
JSON.toJSONString(new org.dromara.common.ys.service.model.req.commonResource.CountryModel()) JSON.toJSONString(new CountryModel())
); );
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) { if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips()); throw new RuntimeException(res.getTips());
} }
return JSON.parseArray(JSON.parseObject(res.getData()).getString("countryDataList"), CountryModel.class); return JSON.parseArray(JSON.parseObject(res.getData()).getString("countryDataList"), org.dromara.common.ys.model.res.comomResource.CountryModel.class);
} }
@Override @Override
public List<ProvinceModel> getProvinceList(String userId) { public List<org.dromara.common.ys.model.res.comomResource.ProvinceModel> getProvinceList(String userId) {
ApiHttpResponse res = Api.v1( ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST, com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(), DomainEnum.TEST.getDomain(),
CommonResourceApiEnum.PROVINCE_DATA.getUrl(), CommonResourceApiEnum.PROVINCE_DATA.getUrl(),
userId, userId,
JSON.toJSONString(new org.dromara.common.ys.service.model.req.commonResource.ProvinceModel()) JSON.toJSONString(new ProvinceModel())
); );
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) { if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips()); throw new RuntimeException(res.getTips());
} }
return JSON.parseArray(JSON.parseObject(res.getData()).getString("provinceDataList"), ProvinceModel.class); return JSON.parseArray(JSON.parseObject(res.getData()).getString("provinceDataList"), org.dromara.common.ys.model.res.comomResource.ProvinceModel.class);
} }
@Override @Override
public List<CityModel> getCityList(String userId) { public List<org.dromara.common.ys.model.res.comomResource.CityModel> getCityList(String userId) {
ApiHttpResponse res = Api.v1( ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST, com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(), DomainEnum.TEST.getDomain(),
CommonResourceApiEnum.CITY_DATA.getUrl(), CommonResourceApiEnum.CITY_DATA.getUrl(),
userId, userId,
JSON.toJSONString(new org.dromara.common.ys.service.model.req.commonResource.CityModel()) JSON.toJSONString(new CityModel())
); );
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) { if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips()); throw new RuntimeException(res.getTips());
...@@ -67,17 +67,17 @@ public class CommonResourceServiceImpl implements ICommonResourceService { ...@@ -67,17 +67,17 @@ public class CommonResourceServiceImpl implements ICommonResourceService {
if (res.getData() == null) { if (res.getData() == null) {
return new ArrayList<>(); return new ArrayList<>();
} }
return JSON.parseArray(JSON.parseObject(res.getData()).getString("cityDataList"), CityModel.class); return JSON.parseArray(JSON.parseObject(res.getData()).getString("cityDataList"), org.dromara.common.ys.model.res.comomResource.CityModel.class);
} }
@Override @Override
public List<AirportModel> getAirportList(String userId) { public List<org.dromara.common.ys.model.res.comomResource.AirportModel> getAirportList(String userId) {
ApiHttpResponse res = Api.v1( ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST, com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(), DomainEnum.TEST.getDomain(),
CommonResourceApiEnum.AIRPORT_DATA.getUrl(), CommonResourceApiEnum.AIRPORT_DATA.getUrl(),
userId, userId,
JSON.toJSONString(new org.dromara.common.ys.service.model.req.commonResource.AirportModel()) JSON.toJSONString(new AirportModel())
); );
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) { if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips()); throw new RuntimeException(res.getTips());
...@@ -85,18 +85,18 @@ public class CommonResourceServiceImpl implements ICommonResourceService { ...@@ -85,18 +85,18 @@ public class CommonResourceServiceImpl implements ICommonResourceService {
if (res.getData() == null) { if (res.getData() == null) {
return new ArrayList<>(); return new ArrayList<>();
} }
return JSON.parseArray(JSON.parseObject(res.getData()).getString("airportDataList"), AirportModel.class); return JSON.parseArray(JSON.parseObject(res.getData()).getString("airportDataList"), org.dromara.common.ys.model.res.comomResource.AirportModel.class);
} }
@Override @Override
public List<StationModel> getStationList(String userId) { public List<org.dromara.common.ys.model.res.comomResource.StationModel> getStationList(String userId) {
ApiHttpResponse res = Api.v1( ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST, com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(), DomainEnum.TEST.getDomain(),
CommonResourceApiEnum.STATION_DATA.getUrl(), CommonResourceApiEnum.STATION_DATA.getUrl(),
userId, userId,
null, null,
JSON.toJSONString(new org.dromara.common.ys.service.model.req.commonResource.StationModel()) JSON.toJSONString(new StationModel())
); );
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) { if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips()); throw new RuntimeException(res.getTips());
...@@ -104,18 +104,18 @@ public class CommonResourceServiceImpl implements ICommonResourceService { ...@@ -104,18 +104,18 @@ public class CommonResourceServiceImpl implements ICommonResourceService {
if (res.getData() == null) { if (res.getData() == null) {
return new ArrayList<>(); return new ArrayList<>();
} }
return JSON.parseArray(JSON.parseObject(res.getData()).getString("stationDataList"), StationModel.class); return JSON.parseArray(JSON.parseObject(res.getData()).getString("stationDataList"), org.dromara.common.ys.model.res.comomResource.StationModel.class);
} }
@Override @Override
public List<TrainBaseModel> getTrainBaseList(String userId) { public List<org.dromara.common.ys.model.res.comomResource.TrainBaseModel> getTrainBaseList(String userId) {
ApiHttpResponse res = Api.v1( ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST, com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(), DomainEnum.TEST.getDomain(),
CommonResourceApiEnum.TRAIN_BASE_DATA.getUrl(), CommonResourceApiEnum.TRAIN_BASE_DATA.getUrl(),
userId, userId,
null, null,
JSON.toJSONString(new org.dromara.common.ys.service.model.req.commonResource.TrainBaseModel()) JSON.toJSONString(new TrainBaseModel())
); );
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) { if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips()); throw new RuntimeException(res.getTips());
...@@ -123,12 +123,12 @@ public class CommonResourceServiceImpl implements ICommonResourceService { ...@@ -123,12 +123,12 @@ public class CommonResourceServiceImpl implements ICommonResourceService {
if (res.getData() == null) { if (res.getData() == null) {
return new ArrayList<>(); return new ArrayList<>();
} }
return JSON.parseArray(JSON.parseObject(res.getData()).getString("trainBaseDataList"), TrainBaseModel.class); return JSON.parseArray(JSON.parseObject(res.getData()).getString("trainBaseDataList"), org.dromara.common.ys.model.res.comomResource.TrainBaseModel.class);
} }
@Override @Override
public List<DictModel> getDictList(String userId, String parType) { public List<org.dromara.common.ys.model.res.comomResource.DictModel> getDictList(String userId, String parType) {
org.dromara.common.ys.service.model.req.commonResource.DictModel model = new org.dromara.common.ys.service.model.req.commonResource.DictModel().setParType(parType); DictModel model = new DictModel().setParType(parType);
ApiHttpResponse res = Api.v1( ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST, com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(), DomainEnum.TEST.getDomain(),
...@@ -143,6 +143,6 @@ public class CommonResourceServiceImpl implements ICommonResourceService { ...@@ -143,6 +143,6 @@ public class CommonResourceServiceImpl implements ICommonResourceService {
if (res.getData() == null) { if (res.getData() == null) {
return new ArrayList<>(); return new ArrayList<>();
} }
return JSON.parseArray(JSON.parseObject(res.getData()).getString("baseDataList"), DictModel.class); return JSON.parseArray(JSON.parseObject(res.getData()).getString("baseDataList"), org.dromara.common.ys.model.res.comomResource.DictModel.class);
} }
} }
...@@ -7,8 +7,8 @@ import org.dromara.common.ys.common.ApiHttpResponse; ...@@ -7,8 +7,8 @@ import org.dromara.common.ys.common.ApiHttpResponse;
import org.dromara.common.ys.common.Code; import org.dromara.common.ys.common.Code;
import org.dromara.common.ys.enums.DomainEnum; import org.dromara.common.ys.enums.DomainEnum;
import org.dromara.common.ys.enums.insurance.InsuranceApiEnum; import org.dromara.common.ys.enums.insurance.InsuranceApiEnum;
import org.dromara.common.ys.model.req.insurance.BxcpModel;
import org.dromara.common.ys.service.IInsuranceService; import org.dromara.common.ys.service.IInsuranceService;
import org.dromara.common.ys.service.model.res.insurance.BxcpModel;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
...@@ -21,7 +21,7 @@ import java.util.List; ...@@ -21,7 +21,7 @@ import java.util.List;
public class InsuranceServiceImpl implements IInsuranceService { public class InsuranceServiceImpl implements IInsuranceService {
@Override @Override
public List<BxcpModel> list(String userId, org.dromara.common.ys.service.model.req.insurance.BxcpModel model) { public List<org.dromara.common.ys.model.res.insurance.BxcpModel> list(String userId, BxcpModel model) {
ApiHttpResponse res = Api.v1( ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST, com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(), DomainEnum.TEST.getDomain(),
...@@ -33,6 +33,6 @@ public class InsuranceServiceImpl implements IInsuranceService { ...@@ -33,6 +33,6 @@ public class InsuranceServiceImpl implements IInsuranceService {
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) { if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips()); throw new RuntimeException(res.getTips());
} }
return JSON.parseArray(JSON.parseObject(res.getData()).getString("cpList"), BxcpModel.class); return JSON.parseArray(JSON.parseObject(res.getData()).getString("cpList"), org.dromara.common.ys.model.res.insurance.BxcpModel.class);
} }
} }
...@@ -8,7 +8,7 @@ import org.dromara.common.ys.common.Code; ...@@ -8,7 +8,7 @@ import org.dromara.common.ys.common.Code;
import org.dromara.common.ys.enums.DomainEnum; import org.dromara.common.ys.enums.DomainEnum;
import org.dromara.common.ys.enums.org.OrgApiEnum; import org.dromara.common.ys.enums.org.OrgApiEnum;
import org.dromara.common.ys.service.IOrgService; import org.dromara.common.ys.service.IOrgService;
import org.dromara.common.ys.service.model.req.org.EditEmployeeModel; import org.dromara.common.ys.model.req.org.EditEmployeeModel;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
......
...@@ -8,9 +8,9 @@ import org.dromara.common.ys.common.ApiHttpResponse; ...@@ -8,9 +8,9 @@ import org.dromara.common.ys.common.ApiHttpResponse;
import org.dromara.common.ys.common.Code; import org.dromara.common.ys.common.Code;
import org.dromara.common.ys.enums.DomainEnum; import org.dromara.common.ys.enums.DomainEnum;
import org.dromara.common.ys.enums.train.TrainApiEnum; 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 org.dromara.common.ys.service.ITrainService; import org.dromara.common.ys.service.ITrainService;
import org.dromara.common.ys.service.model.res.train.AllStationModel;
import org.dromara.common.ys.service.model.res.train.QueryModel;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Collections; import java.util.Collections;
...@@ -24,7 +24,7 @@ import java.util.List; ...@@ -24,7 +24,7 @@ import java.util.List;
public class TrainServiceImpl implements ITrainService { public class TrainServiceImpl implements ITrainService {
@Override @Override
public List<QueryModel> queryModel(String userId, org.dromara.common.ys.service.model.req.train.QueryModel model) { public List<org.dromara.common.ys.model.res.train.QueryModel> queryModel(String userId, QueryModel model) {
ApiHttpResponse res = Api.v1( ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST, com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(), DomainEnum.TEST.getDomain(),
...@@ -38,21 +38,21 @@ public class TrainServiceImpl implements ITrainService { ...@@ -38,21 +38,21 @@ public class TrainServiceImpl implements ITrainService {
if (StrUtil.isEmpty(res.getData())) { if (StrUtil.isEmpty(res.getData())) {
return Collections.emptyList(); return Collections.emptyList();
} }
return JSON.parseArray(JSON.parseObject(res.getData()).getString("trainList"), QueryModel.class); return JSON.parseArray(JSON.parseObject(res.getData()).getString("trainList"), org.dromara.common.ys.model.res.train.QueryModel.class);
} }
@Override @Override
public List<AllStationModel> getAllStation(String userId) { public List<org.dromara.common.ys.model.res.train.AllStationModel> getAllStation(String userId) {
ApiHttpResponse res = Api.v1( ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST, com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(), DomainEnum.TEST.getDomain(),
TrainApiEnum.FIND_ALL_STATION.getUrl(), TrainApiEnum.FIND_ALL_STATION.getUrl(),
userId, userId,
JSON.toJSONString(new org.dromara.common.ys.service.model.req.train.AllStationModel()) JSON.toJSONString(new AllStationModel())
); );
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) { if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips()); throw new RuntimeException(res.getTips());
} }
return JSON.parseArray(JSON.parseObject(res.getData()).getString("list"), AllStationModel.class); return JSON.parseArray(JSON.parseObject(res.getData()).getString("list"), org.dromara.common.ys.model.res.train.AllStationModel.class);
} }
} }
...@@ -7,9 +7,9 @@ import org.dromara.common.ys.common.ApiHttpResponse; ...@@ -7,9 +7,9 @@ import org.dromara.common.ys.common.ApiHttpResponse;
import org.dromara.common.ys.common.Code; import org.dromara.common.ys.common.Code;
import org.dromara.common.ys.enums.DomainEnum; import org.dromara.common.ys.enums.DomainEnum;
import org.dromara.common.ys.enums.vehicles.VehiclesApiEnum; 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;
import org.dromara.common.ys.service.IVehiclesService; import org.dromara.common.ys.service.IVehiclesService;
import org.dromara.common.ys.service.model.res.vehicles.EstimateJsycPriceModel;
import org.dromara.common.ys.service.model.res.vehicles.EstimateYyycPriceModel;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
...@@ -20,7 +20,7 @@ import org.springframework.stereotype.Service; ...@@ -20,7 +20,7 @@ import org.springframework.stereotype.Service;
public class VehiclesServiceImpl implements IVehiclesService { public class VehiclesServiceImpl implements IVehiclesService {
@Override @Override
public EstimateYyycPriceModel estimateYyycPrice(String userId, org.dromara.common.ys.service.model.req.vehicles.EstimateYyycPriceModel model) { public org.dromara.common.ys.model.res.vehicles.EstimateYyycPriceModel estimateYyycPrice(String userId, EstimateYyycPriceModel model) {
ApiHttpResponse res = Api.v1( ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST, com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(), DomainEnum.TEST.getDomain(),
...@@ -32,11 +32,11 @@ public class VehiclesServiceImpl implements IVehiclesService { ...@@ -32,11 +32,11 @@ public class VehiclesServiceImpl implements IVehiclesService {
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) { if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips()); throw new RuntimeException(res.getTips());
} }
return JSON.parseObject(res.getData(), EstimateYyycPriceModel.class); return JSON.parseObject(res.getData(), org.dromara.common.ys.model.res.vehicles.EstimateYyycPriceModel.class);
} }
@Override @Override
public EstimateJsycPriceModel estimateJsycPrice(String userId, org.dromara.common.ys.service.model.req.vehicles.EstimateJsycPriceModel model) { public org.dromara.common.ys.model.res.vehicles.EstimateJsycPriceModel estimateJsycPrice(String userId, EstimateJsycPriceModel model) {
ApiHttpResponse res = Api.v1( ApiHttpResponse res = Api.v1(
com.wenhe.base.base.RequestMethodEnum.POST, com.wenhe.base.base.RequestMethodEnum.POST,
DomainEnum.TEST.getDomain(), DomainEnum.TEST.getDomain(),
...@@ -48,6 +48,6 @@ public class VehiclesServiceImpl implements IVehiclesService { ...@@ -48,6 +48,6 @@ public class VehiclesServiceImpl implements IVehiclesService {
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) { if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips()); throw new RuntimeException(res.getTips());
} }
return JSON.parseObject(res.getData(), EstimateJsycPriceModel.class); return JSON.parseObject(res.getData(), org.dromara.common.ys.model.res.vehicles.EstimateJsycPriceModel.class);
} }
} }
package org.dromara.resource.base;
/**
* @author hzh
* @date 2024-11-12
**/
public class BaseController {
/**
* 获取云上id
*
* @return id
*/
public String getUserId() {
return "BKCq8Lk5sOWr2HUjh3IdBxGiZyLpkzK23HtpLGHAvuNmmCfQJ7krbvFfIBO9Lzuu-15133366666" ;
}
}
package org.dromara.resource.controller.airport;
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;
import org.dromara.common.ys.model.req.airport.OrderListModel;
import org.dromara.common.ys.model.req.airport.bookOrder.BookOrderModel;
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.QueryTkOrderModel;
import org.dromara.common.ys.model.res.comomResource.AirportModel;
import org.dromara.common.ys.service.AirPortService;
import org.dromara.common.ys.service.CommonResourceService;
import org.dromara.common.ys.service.InsuranceService;
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
**/
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/airport/ys")
public class AirportController extends BaseController {
private static final String AIRPORT = "airport:ys" ;
/**
* 查询航班信息
*/
@GetMapping("list")
public R<QueryFlightModel> list(org.dromara.common.ys.model.req.airport.QueryFlightModel model) {
List<AirportModel> airPortList = getAirPortList();
model.setArriveAirport(airPortList.stream().filter(item -> StringUtils.equals(model.getArriveAirport(), 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());
try {
return R.ok(AirPortService.queryFlight(getUserId(), model));
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
private List<AirportModel> getAirPortList() {
List<AirportModel> airPortList = RedisUtils.getCacheList(AIRPORT);
if (CollectionUtils.isEmpty(airPortList)) {
airPortList = CommonResourceService.getAirportList(getUserId());
RedisUtils.setCacheObject(AIRPORT, airPortList, Duration.ofMinutes(60 * 60 * 24L));
}
return airPortList;
}
/**
* 查询保险列表
*/
@GetMapping("/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())));
}
/**
* 查询基础列表
*/
@GetMapping("/airportList")
public R<List<AirportModel>> airportList(@RequestParam("keyword") String keyword) {
List<AirportModel> list = getAirPortList();
return R.ok(
list.stream().filter(item -> {
if (StringUtils.isNotEmpty(item.getCityName()) && item.getCityName().contains(keyword)) {
return true;
}
if (StringUtils.isNotEmpty(item.getAirportName()) && item.getAirportName().contains(keyword)) {
return true;
}
if (StringUtils.isNotEmpty(item.getThreeCode()) && item.getThreeCode().contains(keyword)) {
return true;
}
return false;
}).collect(Collectors.toList()));
}
/**
* 下单接口
*/
@PostMapping("/bookOrder")
public R<List<org.dromara.common.ys.model.res.airport.BookOrderModel>> bookOrder(@RequestBody BookOrderModel model) {
model.setTripType(TripType.PUBLIC.getCode());
List<org.dromara.common.ys.model.res.airport.BookOrderModel> orderList = AirPortService.bookOrder(getUserId(), model);
return R.ok(orderList);
}
/**
* 订单列表
*/
@GetMapping("/orderList")
public R<PageInfo<org.dromara.common.ys.model.res.airport.OrderListModel>> orderList(OrderListModel model) {
model.setBookNo(getUserId());
return R.ok(AirPortService.orderList(getUserId(), model));
}
/**
* 订单详情
*/
@GetMapping("/orderDetail")
public R<QueryTkOrderModel> orderDetail(org.dromara.common.ys.model.req.airport.QueryTkOrderModel model) {
return R.ok(AirPortService.detail(getUserId(), model));
}
}
package org.dromara.resource.controller.train;
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;
import org.dromara.common.ys.model.res.train.AllStationModel;
import org.dromara.common.ys.service.CommonResourceService;
import org.dromara.common.ys.service.TrainService;
import org.dromara.resource.base.BaseController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
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;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.stream.Collectors;
/**
* @author hzh
* @date 2024-10-29
**/
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/train/ys")
public class TrainController extends BaseController {
private static final String TRAIN = "train:ys" ;
private static final String CITY = "city:ys" ;
@GetMapping("/stationList")
public R<List<AllStationModel>> stationList(@RequestParam("keyword") String keyword) {
List<AllStationModel> stationList = getStationList();
return R.ok(
stationList.stream().filter(item -> {
if (StringUtils.isNotEmpty(item.getCityName()) && item.getCityName().contains(keyword)) {
return true;
}
if (StringUtils.isNotEmpty(item.getEname()) && item.getEname().contains(keyword)) {
return true;
}
if (StringUtils.isNotEmpty(item.getZdmc()) && item.getZdmc().contains(keyword)) {
return true;
}
if (StringUtils.isNotEmpty(item.getPyjsm()) && item.getPyjsm().contains(keyword)) {
return true;
}
return false;
}).collect(Collectors.toList())
);
}
private List<AllStationModel> getStationList() {
List<AllStationModel> stationList = RedisUtils.getCacheList(TRAIN);
if (CollectionUtils.isEmpty(stationList)) {
stationList = TrainService.getAllStation(getUserId());
RedisUtils.setCacheObject(TRAIN, stationList, Duration.ofMinutes(60 * 60 * 24L));
}
return stationList;
}
/**
* 线程数
*/
private static final int NUM_THREADS = 100;
@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 = "fromCity", required = false) String fromCity,
@RequestParam(value = "toCity", required = false) String toCity
) throws InterruptedException {
//获取出发站点
List<String> fromStationCodeList = getStationCodeList(fromStationCode, fromCity);
//获取目的站点
List<String> toStationCodeList = getStationCodeList(toStationCode, toCity);
String userId = getUserId();
List<Callable<List<org.dromara.common.ys.model.res.train.QueryModel>>> taskList = fromStationCodeList.stream().flatMap(fromCode ->
toStationCodeList.stream().map(toCode -> (Callable<List<org.dromara.common.ys.model.res.train.QueryModel>>) () -> {
QueryModel query = new QueryModel()
.setFromDate(fromDate)
.setFromStationCode(fromCode)
.setToStationCode(toCode)
.setTripType(TripType.PUBLIC.getCode());
return TrainService.queryModel(userId, query);
})).collect(Collectors.toList());
// 创建一个线程池
ExecutorService executorService = Executors.newFixedThreadPool(NUM_THREADS);
// 提交任务并等待完成
List<Future<List<org.dromara.common.ys.model.res.train.QueryModel>>> futures = executorService.invokeAll(taskList);
// 关闭线程池
executorService.shutdown();
// 检查任务是否完成
List<org.dromara.common.ys.model.res.train.QueryModel> list = futures.stream().flatMap(f -> {
try {
return f.get().stream();
} catch (Exception e) {
return new ArrayList<org.dromara.common.ys.model.res.train.QueryModel>().stream();
}
}).collect(Collectors.groupingBy(org.dromara.common.ys.model.res.train.QueryModel::getTrainCode))
.entrySet().stream().map(entry -> entry.getValue().get(0)).collect(Collectors.toList());
return R.ok(list);
}
private List<String> getStationCodeList(String stationCode, String city) {
List<String> stationCodeList = new ArrayList<>();
if (StringUtils.isNotEmpty(stationCode)) {
stationCodeList.add(stationCode);
} else {
stationCodeList = getStationList().stream().filter(item -> StringUtils.equals(item.getCityName(), city)).map(AllStationModel::getZddm)
.collect(Collectors.toList());
}
return stationCodeList;
}
@GetMapping("/cityList")
public R<List<CityModel>> list(@RequestParam("keyword") String keyword) {
List<CityModel> cityList = getCityList();
return R.ok(cityList.stream().filter(item -> StringUtils.equals(item.getCityName(), keyword)).collect(Collectors.toList()));
}
private List<CityModel> getCityList() {
List<CityModel> cityList = RedisUtils.getCacheList(CITY);
if (CollectionUtils.isEmpty(cityList)) {
cityList = CommonResourceService.getCityList(getUserId());
RedisUtils.setCacheObject(CITY, cityList, Duration.ofMinutes(60 * 60 * 24L));
}
return cityList;
}
}
package org.dromara.resource.controller.vehicle;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.ys.constant.TripType;
import org.dromara.common.ys.model.req.vehicles.EstimateJsycPriceModel;
import org.dromara.common.ys.model.req.vehicles.EstimateYyycPriceModel;
import org.dromara.common.ys.service.VehiclesService;
import org.dromara.resource.base.BaseController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author hzh
* @date 2024-10-29
**/
@RestController
@RequiredArgsConstructor
@RequestMapping("/vehicle/ys")
public class VehiclesController extends BaseController {
@RequestMapping("/immediate")
public R<org.dromara.common.ys.model.res.vehicles.EstimateJsycPriceModel> immediate(EstimateJsycPriceModel model) {
model.setTripType(TripType.PUBLIC.getCode());
return R.ok(VehiclesService.estimateJsycPrice(getUserId(), model));
}
@RequestMapping("/prebook")
public R<org.dromara.common.ys.model.res.vehicles.EstimateYyycPriceModel> prebook(EstimateYyycPriceModel model) {
model.setTripType(TripType.PUBLIC.getCode());
return R.ok(VehiclesService.estimateYyycPrice(getUserId(), model));
}
}
//package org.dromara.resource.service.airport;
//
//import com.alibaba.druid.util.StringUtils;
//import org.apache.commons.collections4.CollectionUtils;
//import org.dromara.common.core.constant.Constants;
//import org.dromara.common.core.domain.R;
//import org.dromara.common.redis.utils.RedisUtils;
//import org.dromara.common.ys.constant.Cplx;
//import org.dromara.common.ys.constant.TripType;
//import org.dromara.common.ys.service.IAirportService;
//import org.dromara.common.ys.service.ICommonResourceService;
//import org.dromara.common.ys.service.IInsuranceService;
//import org.dromara.common.ys.service.model.res.airport.BookOrderModel;
//import org.dromara.common.ys.service.model.res.airport.QueryFlightModel;
//import org.dromara.common.ys.service.model.res.comomResource.AirportModel;
//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
// **/
//@RestController
//@RequestMapping("/biz/airport/ys")
//public class AirportController {
//
//
// private static final String AIRPORT = "airport:ys";
//
// private IAirportService service;
//
// private IInsuranceService insuranceService;
//
// private ICommonResourceService commonResourceService;
//
// @GetMapping("list")
// public R<QueryFlightModel> list(org.dromara.common.ys.service.model.req.airport.QueryFlightModel model) {
// List<AirportModel> airPortList = getAirPortList();
// model.setArriveAirport(airPortList.stream().filter(item -> StringUtils.equals(model.getArriveAirport(), 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());
// try {
// return R.ok(service.queryFlight(getUserId(), model));
// } catch (Exception e) {
// throw new RuntimeException(e.getMessage());
// }
// }
//
// private List<AirportModel> getAirPortList() {
// List<AirportModel> airPortList = cacheService.get(AIRPORT);
// if (CollectionUtils.isEmpty(airPortList)) {
// airPortList = commonResourceService.getAirportList(getUserId());
// RedisUtils.setCacheObject(verifyKey, code, Duration.ofMinutes(Constants.CAPTCHA_EXPIRATION));
// cacheService.put(AIRPORT, airPortList, 60 * 60 * 24L);
// }
// return airPortList;
// }
//
// @GetMapping("/insuranceList")
// public CommonResponse<List<com.wenhe.base.model.res.insurance.BxcpModel>> insuranceList() {
// return CommonResponse.ok(insuranceService.list(getUserId(), new BxcpModel().setCplx(Cplx.DOMESTIC.getCode())));
// }
//
// @GetMapping("/airportList")
// public CommonResponse<List<AirportModel>> airportList(@RequestParam("keyword") String keyword) {
// List<AirportModel> list = getAirPortList();
// return CommonResponse.ok(
// list.stream().filter(item->{
// if (com.wenhe.base.service.tool.StringUtils.isNotEmpty(item.getCityName()) && item.getCityName().contains(keyword)) {
// return true;
// }
// if (com.wenhe.base.service.tool.StringUtils.isNotEmpty(item.getAirportName()) && item.getAirportName().contains(keyword)) {
// return true;
// }
// if (com.wenhe.base.service.tool.StringUtils.isNotEmpty(item.getThreeCode()) && item.getThreeCode().contains(keyword)) {
// return true;
// }
// return false;
// }).collect(Collectors.toList()));
// }
//
// /**
// * 下单接口
// *
// * @param model model
// * @return 订单详情
// */
// @PostMapping("/bookOrder")
// public CommonResponse<List<BookOrderModel>> bookOrder(@RequestBody com.wenhe.base.model.req.airport.bookOrder.BookOrderModel model) {
// model.setTripType(TripType.PUBLIC.getCode());
// List<BookOrderModel> orderList = service.bookOrder(getUserId(), model);
// return CommonResponse.ok(orderList);
// }
//
// @GetMapping("/orderList")
// public CommonResponse<PageInfo<OrderListModel>> orderList(com.wenhe.base.model.req.airport.OrderListModel model) {
// model.setBookNo(getUserId());
// return CommonResponse.ok(service.orderList(getUserId(), model));
// }
//
//
// @GetMapping("/orderDetail")
// public CommonResponse<QueryTkOrderModel> orderDetail(com.wenhe.base.model.req.airport.QueryTkOrderModel model) {
// return CommonResponse.ok(service.detail(getUserId(), model));
// }
//}
//package org.dromara.resource.service.train;
//
//import com.wenhe.base.api.common.CommonResponse;
//import com.wenhe.base.api.tool.IBaseCacheService;
//import com.wenhe.base.common.web.controller.AbstractCommonController;
//import com.wenhe.base.constant.TripType;
//import com.wenhe.base.model.req.train.QueryModel;
//import com.wenhe.base.model.res.comomResource.CityModel;
//import com.wenhe.base.model.res.train.AllStationModel;
//import com.wenhe.base.service.ICommonResourceService;
//import com.wenhe.base.service.ITrainService;
//import com.wenhe.base.service.tool.StringUtils;
//import com.wenhe.base.util.collection.CollectionUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.concurrent.Callable;
//import java.util.concurrent.ExecutorService;
//import java.util.concurrent.Executors;
//import java.util.concurrent.Future;
//import java.util.stream.Collectors;
//
///**
// * @author hzh
// * @date 2024-10-29
// **/
//@RestController
//@RequestMapping("/biz/train/ys")
//public class TrainController extends AbstractCommonController {
//
// @Autowired
// private ITrainService trainService;
//
// @Autowired
// private ICommonResourceService commonResourceService;
//
// @Autowired
// private IBaseCacheService<List> cacheService;
//
// private static final String TRAIN = "train:ys";
// private static final String CITY = "city:ys";
//
// @GetMapping("/stationList")
// public CommonResponse<List<AllStationModel>> stationList(@RequestParam("keyword") String keyword) {
// List<AllStationModel> stationList = getStationList();
// return CommonResponse.ok(
// stationList.stream().filter(item -> {
// if (StringUtils.isNotEmpty(item.getCityName()) && item.getCityName().contains(keyword)) {
// return true;
// }
// if (StringUtils.isNotEmpty(item.getEname()) && item.getEname().contains(keyword)) {
// return true;
// }
// if (StringUtils.isNotEmpty(item.getZdmc()) && item.getZdmc().contains(keyword)) {
// return true;
// }
// if (StringUtils.isNotEmpty(item.getPyjsm()) && item.getPyjsm().contains(keyword)) {
// return true;
// }
// return false;
// }).collect(Collectors.toList())
// );
// }
//
// private List<AllStationModel> getStationList() {
// List<AllStationModel> stationList = (List<AllStationModel>) cacheService.get(TRAIN);
// if (CollectionUtils.isEmpty(stationList)) {
// stationList = trainService.getAllStation(getUserId());
// cacheService.put(TRAIN, stationList, 60 * 60 * 24L);
// }
// return stationList;
// }
//
// /**
// * 线程数
// */
// private static final int NUM_THREADS = 100;
//
// @GetMapping("/list")
// public CommonResponse<List<com.wenhe.base.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 = "fromCity", required = false) String fromCity,
// @RequestParam(value = "toCity", required = false) String toCity
// ) throws InterruptedException {
// //获取出发站点
// List<String> fromStationCodeList = getStationCodeList(fromStationCode, fromCity);
// //获取目的站点
// List<String> toStationCodeList = getStationCodeList(toStationCode, toCity);
//
// String userId = getUserId();
//
// List<Callable<List<com.wenhe.base.model.res.train.QueryModel>>> taskList = fromStationCodeList.stream().flatMap(fromCode ->
// toStationCodeList.stream().map(toCode -> (Callable<List<com.wenhe.base.model.res.train.QueryModel>>) () -> {
// QueryModel query = new QueryModel()
// .setFromDate(fromDate)
// .setFromStationCode(fromCode)
// .setToStationCode(toCode)
// .setTripType(TripType.PUBLIC.getCode());
// return trainService.queryModel(userId, query);
// })).collect(Collectors.toList());
//
//
// // 创建一个线程池
// ExecutorService executorService = Executors.newFixedThreadPool(NUM_THREADS);
//
// // 提交任务并等待完成
// List<Future<List<com.wenhe.base.model.res.train.QueryModel>>> futures = executorService.invokeAll(taskList);
//
// // 关闭线程池
// executorService.shutdown();
//
// // 检查任务是否完成
// List<com.wenhe.base.model.res.train.QueryModel> list = futures.stream().flatMap(f -> {
// try {
// return f.get().stream();
// } catch (Exception e) {
// return new ArrayList<com.wenhe.base.model.res.train.QueryModel>().stream();
// }
// }).collect(Collectors.groupingBy(com.wenhe.base.model.res.train.QueryModel::getTrainCode))
// .entrySet().stream().map(entry -> entry.getValue().get(0)).collect(Collectors.toList());
//
// return CommonResponse.ok(list);
// }
//
// private List<String> getStationCodeList(String stationCode, String city) {
// List<String> stationCodeList = new ArrayList<>();
// if (StringUtils.isNotEmpty(stationCode)) {
// stationCodeList.add(stationCode);
// } else {
// stationCodeList = getStationList().stream().filter(item -> StringUtils.equals(item.getCityName(), city)).map(AllStationModel::getZddm)
//
// .collect(Collectors.toList());
// }
// return stationCodeList;
// }
//
//
// @GetMapping("/cityList")
// public CommonResponse<List<CityModel>> list(@RequestParam("keyword") String keyword) {
// List<CityModel> cityList = getCityList();
// return CommonResponse.ok(cityList.stream().filter(item -> StringUtils.equals(item.getCityName(), keyword)).collect(Collectors.toList()));
// }
//
// private List<CityModel> getCityList() {
// List<CityModel> cityList = (List<CityModel>) cacheService.get(CITY);
// if (CollectionUtils.isEmpty(cityList)) {
// cityList = commonResourceService.getCityList(getUserId());
// cacheService.put(CITY, cityList, 60 * 60 * 24L);
// }
// return cityList;
// }
//
//}
//package org.dromara.resource.service.vehicle;
//
//import com.wenhe.base.api.common.CommonResponse;
//import com.wenhe.base.common.web.controller.AbstractCommonController;
//import com.wenhe.base.constant.TripType;
//import com.wenhe.base.model.req.vehicles.EstimateJsycPriceModel;
//import com.wenhe.base.model.req.vehicles.EstimateYyycPriceModel;
//import com.wenhe.base.service.IVehiclesService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * @author hzh
// * @date 2024-10-29
// **/
//@RestController
//@RequestMapping("/biz/vehicle/ys")
//public class VehiclesController extends AbstractCommonController {
//
// @Autowired
// private IVehiclesService vehiclesService;
//
// @RequestMapping("/immediate")
// public CommonResponse<com.wenhe.base.model.res.vehicles.EstimateJsycPriceModel> immediate(EstimateJsycPriceModel model) {
// model.setTripType(TripType.PUBLIC.getCode());
// return CommonResponse.ok(vehiclesService.estimateJsycPrice(getUserId(), model));
// }
//
// @RequestMapping("/prebook")
// public CommonResponse<com.wenhe.base.model.res.vehicles.EstimateYyycPriceModel> prebook(EstimateYyycPriceModel model) {
// model.setTripType(TripType.PUBLIC.getCode());
// return CommonResponse.ok(vehiclesService.estimateYyycPrice(getUserId(), model));
// }
//
//
//}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论